KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > workflow > component > UIBPDefinition


1 /*
2  * Copyright 2001-2003 The eXo platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  */

5
6 package org.exoplatform.portlets.workflow.component;
7
8 import org.apache.commons.logging.Log;
9 import org.exoplatform.faces.core.component.UIExoCommand;
10 import org.exoplatform.faces.core.event.ExoActionEvent;
11 import org.exoplatform.faces.core.event.ExoActionListener;
12 import org.exoplatform.services.workflow.WorkflowExecutionService;
13 import org.exoplatform.services.workflow.WorkflowServiceContainer;
14
15 import java.util.List JavaDoc;
16
17 /**
18  * Created y the eXo platform team
19  * User: Benjamin Mestrallet
20  * Date: 15 mai 2004
21  */

22 public class UIBPDefinition extends UIExoCommand {
23   public static String JavaDoc MANAGE_START = "manageStart";
24
25   private WorkflowServiceContainer service_;
26
27   public UIBPDefinition(WorkflowServiceContainer workflowServiceContainer) {
28     setRendererType("BPDefinitionRenderer");
29     setId("bp-definition");
30     service_ = workflowServiceContainer;
31     addActionListener(StartListener.class, MANAGE_START);
32   }
33
34   public String JavaDoc getFamily() {
35     return "org.exoplatform.portlets.workflow.component.UIBPDefinition";
36   }
37
38   public List JavaDoc getAllDefinition() {
39     WorkflowExecutionService workflowExecutionService = null;
40     try {
41       workflowExecutionService = service_.createWorkflowExecutionService();
42       return workflowExecutionService.getAllDefinitions();
43     } finally {
44       if(workflowExecutionService != null)
45         workflowExecutionService.close();
46     }
47
48   }
49
50   public static class StartListener extends ExoActionListener {
51     public void execute(ExoActionEvent event) throws Exception JavaDoc {
52       Long JavaDoc processId = new Long JavaDoc(Long.parseLong((String JavaDoc) event.getParameter("process")));
53       UITask start = (UITask) ((UIBPDefinitionController) event.getComponent().getParent()).
54           getChildComponentOfType(UITask.class);
55       start.setIdentification(processId);
56       start.updateUITree();
57       ((UIBPDefinitionController) event.getComponent().getParent()).
58           setRenderedComponent(start.getId());
59     }
60   }
61
62 }
63
Popular Tags