01: /*
02: * JBoss, Home of Professional Open Source
03: * Copyright 2005, JBoss Inc., and individual contributors as indicated
04: * by the @authors tag. See the copyright.txt in the distribution for a
05: * full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jbpm.taskmgmt.def;
23:
24: import java.util.*;
25:
26: import org.jbpm.module.def.*;
27: import org.jbpm.module.exe.*;
28: import org.jbpm.taskmgmt.exe.*;
29:
30: /**
31: * extends a process definition with information about tasks, swimlanes (for task assignment).
32: */
33: public class TaskMgmtDefinition extends ModuleDefinition {
34:
35: private static final long serialVersionUID = 1L;
36:
37: protected Map swimlanes = null;
38: protected Map tasks = null;
39: protected Task startTask = null;
40:
41: // constructors /////////////////////////////////////////////////////////////
42:
43: public TaskMgmtDefinition() {
44: }
45:
46: public ModuleInstance createInstance() {
47: return new TaskMgmtInstance(this );
48: }
49:
50: // swimlanes ////////////////////////////////////////////////////////////////
51:
52: public void addSwimlane(Swimlane swimlane) {
53: if (swimlanes == null)
54: swimlanes = new HashMap();
55: swimlanes.put(swimlane.getName(), swimlane);
56: swimlane.setTaskMgmtDefinition(this );
57: }
58:
59: public Map getSwimlanes() {
60: return swimlanes;
61: }
62:
63: public Swimlane getSwimlane(String swimlaneName) {
64: if (swimlanes == null)
65: return null;
66: return (Swimlane) swimlanes.get(swimlaneName);
67: }
68:
69: // tasks ////////////////////////////////////////////////////////////////////
70:
71: public void addTask(Task task) {
72: if (tasks == null)
73: tasks = new HashMap();
74: tasks.put(task.getName(), task);
75: task.setTaskMgmtDefinition(this );
76: }
77:
78: public Map getTasks() {
79: return tasks;
80: }
81:
82: public Task getTask(String taskName) {
83: if (tasks == null)
84: return null;
85: return (Task) tasks.get(taskName);
86: }
87:
88: // start task ///////////////////////////////////////////////////////////////
89:
90: public Task getStartTask() {
91: return startTask;
92: }
93:
94: public void setStartTask(Task startTask) {
95: this.startTask = startTask;
96: }
97: }
|