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.Collection ; 16 17 22 public class UITaskList extends UIExoCommand { 23 24 protected static Log log_ = getLog("org.exoplatform.portal.portlets.workflow") ; 25 26 private static final String TASK_LIST_RENDERER = "TaskListRenderer"; 27 public static final String MANAGE_STATE = "manageState"; 28 private WorkflowServiceContainer workflowServiceContainer; 29 30 public UITaskList(WorkflowServiceContainer workflowServiceContainer) { 31 setRendererType(TASK_LIST_RENDERER); 32 setId("task-list") ; 33 this.workflowServiceContainer = workflowServiceContainer; 34 addActionListener(StateListener.class, MANAGE_STATE); 35 } 36 37 public String getFamily() { 38 return "org.exoplatform.portlets.workflow.component.UITaskList"; 39 } 40 41 public Collection getTaskList(String actorId) { 42 WorkflowExecutionService executionService = null; 43 try { 44 executionService = workflowServiceContainer.createWorkflowExecutionService(); 45 return executionService.getTaskList(actorId, null); 46 } finally { 47 executionService.close(); 48 } 49 } 50 51 public static class StateListener extends ExoActionListener { 52 public void execute(ExoActionEvent event) throws Exception { 53 Long tokenId = new Long (Long.parseLong((String ) event.getParameter("token"))); 54 log_.debug("Manage state : " + tokenId); 55 UITask task = (UITask) ((UITaskListController)event.getComponent().getParent()). 56 getChildComponentOfType(UITask.class); 57 task.setIdentification(tokenId); 58 task.updateUITree(); 59 ((UITaskListController)event.getComponent().getParent()). 60 setRenderedComponent(task.getId()); 61 } 62 } 63 64 } 65 | Popular Tags |