001: /*
002:
003: * Copyright 2005-2006 The Kuali Foundation.
004:
005: *
006:
007: *
008:
009: * Licensed under the Educational Community License, Version 1.0 (the "License");
010:
011: * you may not use this file except in compliance with the License.
012:
013: * You may obtain a copy of the License at
014:
015: *
016:
017: * http://www.opensource.org/licenses/ecl1.php
018:
019: *
020:
021: * Unless required by applicable law or agreed to in writing, software
022:
023: * distributed under the License is distributed on an "AS IS" BASIS,
024:
025: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
026:
027: * See the License for the specific language governing permissions and
028:
029: * limitations under the License.
030:
031: */
032:
033: package edu.iu.uis.eden.engine.node;
034:
035: import java.io.Serializable;
036:
037: import java.util.ArrayList;
038:
039: import java.util.List;
040:
041: import edu.iu.uis.eden.EdenConstants;
042:
043: import edu.iu.uis.eden.KEWServiceLocator;
044:
045: import edu.iu.uis.eden.doctype.DocumentType;
046:
047: import edu.iu.uis.eden.exception.EdenUserNotFoundException;
048:
049: import edu.iu.uis.eden.routetemplate.RuleTemplate;
050:
051: import edu.iu.uis.eden.routetemplate.RuleTemplateService;
052:
053: import edu.iu.uis.eden.workgroup.WorkflowGroupId;
054:
055: import edu.iu.uis.eden.workgroup.Workgroup;
056:
057: /**
058:
059: * Represents the prototype definition of a node in the route path of {@link DocumentType}.
060:
061: *
062:
063: * @author ewestfal
064:
065: */
066:
067: public class RouteNode implements Serializable {
068:
069: private static final long serialVersionUID = 4891233177051752726L;
070:
071: private Long routeNodeId;
072:
073: private Long documentTypeId;
074:
075: private String routeNodeName;
076:
077: private String routeMethodName;
078:
079: private Boolean finalApprovalInd;
080:
081: private Boolean mandatoryRouteInd;
082:
083: private Long exceptionWorkgroupId;
084:
085: private String routeMethodCode;
086:
087: private String activationType = ActivationTypeEnum.PARALLEL
088: .getCode();
089:
090: private String contentFragment;
091:
092: private Integer lockVerNbr;
093:
094: private DocumentType documentType;
095:
096: private String exceptionWorkgroupName;
097:
098: private RuleTemplate ruleTemplate;
099:
100: private String nodeType = RequestsNode.class.getName();
101:
102: private List previousNodes = new ArrayList();
103:
104: private List nextNodes = new ArrayList();
105:
106: private BranchPrototype branch;
107:
108: public String getContentFragment() {
109:
110: return contentFragment;
111:
112: }
113:
114: public void setContentFragment(String contentFragment) {
115:
116: this .contentFragment = contentFragment;
117:
118: }
119:
120: public String getActivationType() {
121:
122: return activationType;
123:
124: }
125:
126: public void setActivationType(String activationType) {
127:
128: /* Cleanse the input.
129:
130: * This is surely not the best way to validate the activation types;
131:
132: * it would probably be better to use typesafe enums accross the board
133:
134: * but that would probably entail refactoring large swaths of code, not
135:
136: * to mention reconfiguring OJB (can typesafe enums be used?) and dealing
137:
138: * with serialization compatibility issues (if any).
139:
140: * So instead, let's just be sure to fail-fast.
141:
142: */
143:
144: ActivationTypeEnum at = ActivationTypeEnum
145: .lookupCode(activationType);
146:
147: this .activationType = at.getCode();
148:
149: }
150:
151: public Workgroup getExceptionWorkgroup()
152: throws EdenUserNotFoundException {
153:
154: return KEWServiceLocator.getWorkgroupService().getWorkgroup(
155: new WorkflowGroupId(this .exceptionWorkgroupId));
156:
157: }
158:
159: public Long getExceptionWorkgroupId() {
160:
161: return exceptionWorkgroupId;
162:
163: }
164:
165: public void setExceptionWorkgroupId(Long workgroupId) {
166:
167: this .exceptionWorkgroupId = workgroupId;
168:
169: }
170:
171: public void setFinalApprovalInd(Boolean finalApprovalInd) {
172:
173: this .finalApprovalInd = finalApprovalInd;
174:
175: }
176:
177: public void setMandatoryRouteInd(Boolean mandatoryRouteInd) {
178:
179: this .mandatoryRouteInd = mandatoryRouteInd;
180:
181: }
182:
183: public String getRouteMethodName() {
184:
185: return routeMethodName;
186:
187: }
188:
189: public void setRouteMethodName(String routeMethodName) {
190:
191: this .routeMethodName = routeMethodName;
192:
193: }
194:
195: public Long getDocumentTypeId() {
196:
197: return documentTypeId;
198:
199: }
200:
201: public void setDocumentTypeId(Long documentTypeId) {
202:
203: this .documentTypeId = documentTypeId;
204:
205: }
206:
207: public Long getRouteNodeId() {
208:
209: return routeNodeId;
210:
211: }
212:
213: public void setRouteNodeId(Long routeNodeId) {
214:
215: this .routeNodeId = routeNodeId;
216:
217: }
218:
219: public String getRouteNodeName() {
220:
221: return routeNodeName;
222:
223: }
224:
225: public void setRouteNodeName(String routeLevelName) {
226:
227: this .routeNodeName = routeLevelName;
228:
229: }
230:
231: public DocumentType getDocumentType() {
232:
233: return documentType;
234:
235: }
236:
237: public void setDocumentType(DocumentType documentType) {
238:
239: this .documentType = documentType;
240:
241: }
242:
243: public String getRouteMethodCode() {
244:
245: return routeMethodCode;
246:
247: }
248:
249: public void setRouteMethodCode(String routeMethodCode) {
250:
251: this .routeMethodCode = routeMethodCode;
252:
253: }
254:
255: public String getExceptionWorkgroupName() {
256:
257: if (exceptionWorkgroupName == null
258: || exceptionWorkgroupName.equals("")) {
259:
260: if (exceptionWorkgroupId != null) {
261:
262: return KEWServiceLocator.getWorkgroupService()
263: .getWorkgroup(
264: new WorkflowGroupId(
265: exceptionWorkgroupId))
266: .getGroupNameId().getNameId();
267:
268: }
269:
270: }
271:
272: return exceptionWorkgroupName;
273:
274: }
275:
276: public void setExceptionWorkgroupName(String exceptionWorkgroupName) {
277:
278: this .exceptionWorkgroupName = exceptionWorkgroupName;
279:
280: }
281:
282: public Integer getLockVerNbr() {
283:
284: return lockVerNbr;
285:
286: }
287:
288: public void setLockVerNbr(Integer lockVerNbr) {
289:
290: this .lockVerNbr = lockVerNbr;
291:
292: }
293:
294: public boolean isFlexRM() {
295:
296: return routeMethodCode != null
297: && routeMethodCode
298: .equals(EdenConstants.ROUTE_LEVEL_FLEX_RM);
299:
300: }
301:
302: public Boolean getFinalApprovalInd() {
303:
304: return finalApprovalInd;
305:
306: }
307:
308: public Boolean getMandatoryRouteInd() {
309:
310: return mandatoryRouteInd;
311:
312: }
313:
314: public void addNextNode(RouteNode nextNode) {
315:
316: getNextNodes().add(nextNode);
317:
318: nextNode.getPreviousNodes().add(this );
319:
320: }
321:
322: public List getNextNodes() {
323:
324: return nextNodes;
325:
326: }
327:
328: public void setNextNodes(List nextNodes) {
329:
330: this .nextNodes = nextNodes;
331:
332: }
333:
334: public List getPreviousNodes() {
335:
336: return previousNodes;
337:
338: }
339:
340: public void setPreviousNodes(List parentNodes) {
341:
342: this .previousNodes = parentNodes;
343:
344: }
345:
346: public RuleTemplate getRuleTemplate() {
347:
348: if (ruleTemplate == null) {
349:
350: RuleTemplateService ruleTemplateService = (RuleTemplateService) KEWServiceLocator
351: .getService(KEWServiceLocator.RULE_TEMPLATE_SERVICE);
352:
353: ruleTemplate = ruleTemplateService
354: .findByRuleTemplateName(getRouteMethodName());
355:
356: }
357:
358: return ruleTemplate;
359:
360: }
361:
362: public String getNodeType() {
363:
364: return nodeType;
365:
366: }
367:
368: public void setNodeType(String nodeType) {
369:
370: this .nodeType = nodeType;
371:
372: }
373:
374: public BranchPrototype getBranch() {
375:
376: return branch;
377:
378: }
379:
380: public void setBranch(BranchPrototype branch) {
381:
382: this.branch = branch;
383:
384: }
385:
386: }
|