KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > workfloweditor > model > WorkflowStage


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.workfloweditor.model;
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.List JavaDoc;
23
24 /**
25  * A workflow stage instance.
26  *
27  * @author Matthew Large
28  * @version $Revision: 1.1 $
29  *
30  */

31 public class WorkflowStage {
32
33     /**
34      * List of {@link WorkflowStage} objects.
35      */

36     private ArrayList JavaDoc m_dependancies = new ArrayList JavaDoc();
37     
38     /**
39      * true if a stage is mandatory.
40      */

41     private boolean m_bMandatory = false;
42     
43     /**
44      * true if a stage will remain check after a revision.
45      */

46     private boolean m_bInheritance = false;
47     
48     /**
49      * Workflow model this is part of.
50      */

51     private WorkflowModel m_model = null;
52     
53     /**
54      * List of {@link Role} objects.
55      */

56     private ArrayList JavaDoc m_roles = new ArrayList JavaDoc();
57     
58     /**
59      * Definition for this workflow stage.
60      */

61     private WorkflowStageDefinition m_definition = null;
62
63     protected WorkflowStage() {
64         super();
65     }
66
67     /**
68      * Constructs a new workflow stage.
69      *
70      * @param definition Definition
71      * @param model Model
72      */

73     public WorkflowStage(WorkflowStageDefinition definition, WorkflowModel model) {
74         super();
75         this.m_model = model;
76         this.m_definition = definition;
77     }
78
79     /**
80      * Constructs a new workflow stage.
81      *
82      * @param definition Definition
83      * @param dependancies List of {@link WorkflowStage} objects
84      * @param model Model
85      */

86     public WorkflowStage(WorkflowStageDefinition definition, List JavaDoc dependancies, WorkflowModel model) {
87         this(definition, model);
88         this.m_dependancies.addAll(dependancies);
89     }
90     
91     /**
92      * Returns the definition.
93      *
94      * @return Definition
95      */

96     public WorkflowStageDefinition getDefinition() {
97         return this.m_definition;
98     }
99     
100     /**
101      * Sets the definition.
102      *
103      * @param definition Definition
104      */

105     public void setDefinition(WorkflowStageDefinition definition) {
106         this.m_definition = definition;
107     }
108     
109     /**
110      * Adds a role.
111      *
112      * @param role Role to add
113      */

114     public void addRole(Role role) {
115         this.m_roles.add(role);
116     }
117     
118     /**
119      * Removes a role.
120      *
121      * @param role Role to remove
122      */

123     public void removeRole(Role role) {
124         this.m_roles.remove(role);
125     }
126     
127     /**
128      * Returns a list of the roles.
129      *
130      * @return List of {@link Role} objects
131      */

132     public List JavaDoc getRoles() {
133         return (List JavaDoc) this.m_roles.clone();
134     }
135     
136     /**
137      * Checks if this stage is inheritable.
138      *
139      * @return true if this stage is inheritable
140      */

141     public boolean isInheritable() {
142         return this.m_bInheritance;
143     }
144     
145     /**
146      * Sets if this stage is inheritable.
147      *
148      * @param bInheritable true is this stage is inheritable
149      */

150     public void setInheritable(boolean bInheritable) {
151         this.m_bInheritance = bInheritable;
152     }
153     
154     /**
155      * Checks if this stage is madatory.
156      *
157      * @return true if this stage is mandatory
158      */

159     public boolean isMandatory() {
160         return this.m_bMandatory;
161     }
162     
163     /**
164      * Sets if this stage is mandatory.
165      *
166      * @param bMandatory true to make this stage mandatory
167      */

168     public void setMandatory(boolean bMandatory) {
169         this.m_bMandatory = bMandatory;
170     }
171     
172     /**
173      * Adds a dependency.
174      *
175      * @param stage Stage to add
176      */

177     public void addDependancy(WorkflowStage stage) {
178         this.m_dependancies.add(stage);
179     }
180     
181     /**
182      * Removes a dependency.
183      *
184      * @param stage Stage to remove
185      */

186     public void removeDependancy(WorkflowStage stage) {
187         this.m_dependancies.remove(stage);
188     }
189     
190     /**
191      * Returns a list of all dependencies.
192      *
193      * @return List of {@link WorkflowStage} objects
194      */

195     public List JavaDoc getDependancies() {
196         return (List JavaDoc) this.m_dependancies.clone();
197     }
198     
199     /**
200      * Returns the title.
201      *
202      * @return Title
203      */

204     public String JavaDoc getTitle() {
205         return this.m_definition.getTitle();
206     }
207     
208     /**
209      * Returns the model.
210      *
211      * @return Model
212      */

213     public WorkflowModel getModel() {
214         return this.m_model;
215     }
216     
217     /**
218      * Sets the model.
219      *
220      * @param model Model
221      */

222     public void setModel(WorkflowModel model) {
223         this.m_model = model;
224     }
225
226 }
227
Popular Tags