1 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 ; 16 17 22 public class UIBPDefinition extends UIExoCommand { 23 public static String 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 getFamily() { 35 return "org.exoplatform.portlets.workflow.component.UIBPDefinition"; 36 } 37 38 public List 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 { 52 Long processId = new Long (Long.parseLong((String ) 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 |