KickJava   Java API By Example, From Geeks To Geeks.

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


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.Collection JavaDoc;
16
17 /**
18  * Created y the eXo platform team
19  * User: Benjamin Mestrallet
20  * Date: 16 mai 2004
21  */

22 public class UITaskList extends UIExoCommand {
23
24   protected static Log log_ = getLog("org.exoplatform.portal.portlets.workflow") ;
25
26   private static final String JavaDoc TASK_LIST_RENDERER = "TaskListRenderer";
27   public static final String JavaDoc 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 JavaDoc getFamily() {
38     return "org.exoplatform.portlets.workflow.component.UITaskList";
39   }
40
41   public Collection JavaDoc getTaskList(String JavaDoc 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 JavaDoc {
53       Long JavaDoc tokenId = new Long JavaDoc(Long.parseLong((String JavaDoc) 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