KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > taskmgmt > def > TaskMgmtDefinition


1 package org.jbpm.taskmgmt.def;
2
3 import java.util.*;
4
5 import org.jbpm.module.def.*;
6 import org.jbpm.module.exe.*;
7 import org.jbpm.taskmgmt.exe.*;
8
9 /**
10  * extends a process definition with information about tasks, swimlanes (for task assignment).
11  */

12 public class TaskMgmtDefinition extends ModuleDefinition {
13
14   private static final long serialVersionUID = 1L;
15   
16   protected Map swimlanes = null;
17   protected Map tasks = null;
18   protected Task startTask = null;
19
20   // constructors /////////////////////////////////////////////////////////////
21

22   public TaskMgmtDefinition() {
23   }
24
25   public ModuleInstance createInstance() {
26     return new TaskMgmtInstance(this);
27   }
28
29   // swimlanes ////////////////////////////////////////////////////////////////
30

31   public void addSwimlane( Swimlane swimlane ) {
32     if (swimlanes==null) swimlanes = new HashMap();
33     swimlanes.put(swimlane.getName(), swimlane);
34     swimlane.setTaskMgmtDefinition(this);
35   }
36
37   public Map getSwimlanes() {
38     return swimlanes;
39   }
40   
41   public Swimlane getSwimlane( String JavaDoc swimlaneName ) {
42     if (swimlanes==null) return null;
43     return (Swimlane) swimlanes.get( swimlaneName );
44   }
45
46   // tasks ////////////////////////////////////////////////////////////////////
47

48   public void addTask( Task task ) {
49     if (tasks==null) tasks = new HashMap();
50     tasks.put(task.getName(), task);
51     task.setTaskMgmtDefinition(this);
52   }
53
54   public Map getTasks() {
55     return tasks;
56   }
57   
58   public Task getTask( String JavaDoc taskName ) {
59     if (tasks==null) return null;
60     return (Task) tasks.get( taskName );
61   }
62
63   // start task ///////////////////////////////////////////////////////////////
64

65   public Task getStartTask() {
66     return startTask;
67   }
68   public void setStartTask(Task startTask) {
69     this.startTask = startTask;
70   }
71 }
72
Popular Tags