001: /*
002: * Copyright 2005-2006 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.actionrequests;
018:
019: import java.sql.Timestamp;
020: import java.util.ArrayList;
021: import java.util.Iterator;
022: import java.util.List;
023:
024: import org.apache.commons.beanutils.BeanUtils;
025: import org.apache.commons.lang.StringUtils;
026:
027: import edu.iu.uis.eden.EdenConstants;
028: import edu.iu.uis.eden.KEWServiceLocator;
029: import edu.iu.uis.eden.WorkflowPersistable;
030: import edu.iu.uis.eden.actiontaken.ActionTakenValue;
031: import edu.iu.uis.eden.engine.CompatUtils;
032: import edu.iu.uis.eden.engine.node.RouteNode;
033: import edu.iu.uis.eden.engine.node.RouteNodeInstance;
034: import edu.iu.uis.eden.exception.EdenUserNotFoundException;
035: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
036: import edu.iu.uis.eden.routetemplate.RuleBaseValues;
037: import edu.iu.uis.eden.routetemplate.RuleService;
038: import edu.iu.uis.eden.user.Recipient;
039: import edu.iu.uis.eden.user.RoleRecipient;
040: import edu.iu.uis.eden.user.UserService;
041: import edu.iu.uis.eden.user.WorkflowUser;
042: import edu.iu.uis.eden.user.WorkflowUserId;
043: import edu.iu.uis.eden.util.CodeTranslator;
044: import edu.iu.uis.eden.workgroup.WorkflowGroupId;
045: import edu.iu.uis.eden.workgroup.Workgroup;
046: import edu.iu.uis.eden.workgroup.WorkgroupService;
047:
048: /**
049: * Bean mapped to DB. Represents ActionRequest to a workgroup, user or role. Contains
050: * references to children/parent if a member of a graph
051: *
052: * @author rkirkend
053: * @author ewestfal
054: */
055: public class ActionRequestValue implements WorkflowPersistable {
056:
057: private static final long serialVersionUID = 8781414791855848385L;
058:
059: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
060: .getLogger(ActionRequestValue.class);
061:
062: private static final String ACTION_CODE_RANK = "FKACB";//B is a hack for allowing blanket approves to count for approve and complete requests in findPreviousAction in ActionTakenService this is a hack and accounts for the -3 on compareActionCode
063: private static final String RECIPIENT_TYPE_RANK = "RWU";
064: private static final String DELEGATION_TYPE_RANK = "SPN";
065:
066: private java.lang.Long actionRequestId;
067: private java.lang.String actionRequested;
068: private java.lang.Long routeHeaderId;
069: private java.lang.String status;
070: private java.lang.Long responsibilityId;
071: private java.lang.Long workgroupId;
072: private java.lang.String recipientTypeCd;
073: private java.lang.Integer priority;
074: private java.lang.Integer routeLevel;
075: private java.lang.Long actionTakenId;
076: private java.lang.Integer docVersion = new Integer(1);
077: private java.sql.Timestamp createDate;
078: private java.lang.String responsibilityDesc;
079: private java.lang.String annotation;
080: private java.lang.Integer jrfVerNbr;
081: private java.lang.String workflowId;
082: private Boolean ignorePrevAction;
083: private Long parentActionRequestId;
084: private String qualifiedRoleName;
085: private String roleName;
086: private String qualifiedRoleNameLabel;
087: private String displayStatus;
088: private Long ruleBaseValuesId;
089:
090: private String delegationType = EdenConstants.DELEGATION_NONE;
091: private String approvePolicy;
092:
093: private ActionRequestValue parentActionRequest;
094: private List childrenRequests = new ArrayList();
095: private ActionTakenValue actionTaken;
096: private DocumentRouteHeaderValue routeHeader;
097: private List actionItems = new ArrayList();
098: private Boolean currentIndicator = new Boolean(true);
099: private String createDateString;
100:
101: /* New Workflow 2.1 Field */
102: // The node instance at which this request was generated
103: private RouteNodeInstance nodeInstance;
104:
105: public ActionRequestValue() {
106: createDate = new Timestamp(System.currentTimeMillis());
107: }
108:
109: public Workgroup getWorkgroup() throws EdenUserNotFoundException {
110: if (getWorkgroupId() == null) {
111: LOG
112: .error("Attempting to get a workgroup with a blank workgroup id");
113: return null;
114: }
115: WorkgroupService workgroupSrv = (WorkgroupService) KEWServiceLocator
116: .getService(KEWServiceLocator.WORKGROUP_SRV);
117: return workgroupSrv.getWorkgroup(new WorkflowGroupId(
118: getWorkgroupId()));
119: }
120:
121: public String getRouteLevelName() {
122: // this is for backward compatibility of requests which have not been converted
123: if (CompatUtils.isRouteLevelRequest(this )) {
124: int routeLevelInt = getRouteLevel().intValue();
125: if (routeLevelInt == EdenConstants.EXCEPTION_ROUTE_LEVEL) {
126: return "Exception";
127: }
128:
129: List routeLevelNodes = CompatUtils
130: .getRouteLevelCompatibleNodeList(routeHeader
131: .getDocumentType());
132: if (!(routeLevelInt < routeLevelNodes.size())) {
133: return "Not Found";
134: }
135: return ((RouteNode) routeLevelNodes.get(routeLevelInt))
136: .getRouteNodeName();
137: } else {
138: return (nodeInstance == null ? "Exception" : nodeInstance
139: .getName());
140: }
141: }
142:
143: public boolean isUserRequest() {
144: return workflowId != null;
145: }
146:
147: public WorkflowUser getWorkflowUser()
148: throws EdenUserNotFoundException {
149: if (getWorkflowId() == null) {
150: return null;
151: }
152: UserService userSrv = (UserService) KEWServiceLocator
153: .getService(KEWServiceLocator.USER_SERVICE);
154: return userSrv.getWorkflowUser(new WorkflowUserId(
155: getWorkflowId()));
156: }
157:
158: public Recipient getRecipient() throws EdenUserNotFoundException {
159: if (getWorkflowId() != null) {
160: return getWorkflowUser();
161: } else if (getWorkgroupId() != null) {
162: return getWorkgroup();
163: } else {
164: return new RoleRecipient(this .getRoleName());
165: }
166: }
167:
168: public boolean isPending() {
169: return EdenConstants.ACTION_REQUEST_INITIALIZED.equals(status)
170: || EdenConstants.ACTION_REQUEST_ACTIVATED
171: .equals(status);
172: }
173:
174: public DocumentRouteHeaderValue getRouteHeader() {
175: return routeHeader;
176: }
177:
178: public String getStatusLabel() {
179: return CodeTranslator.getActionRequestStatusLabel(getStatus());
180: }
181:
182: public String getActionRequestedLabel() {
183: return CodeTranslator
184: .getActionRequestLabel(getActionRequested());
185: }
186:
187: /**
188: * @param routeHeader
189: * The routeHeader to set.
190: */
191: public void setRouteHeader(DocumentRouteHeaderValue routeHeader) {
192: this .routeHeader = routeHeader;
193: }
194:
195: /**
196: * @return Returns the actionTaken.
197: */
198: public ActionTakenValue getActionTaken() {
199: return actionTaken;
200: }
201:
202: /**
203: * @param actionTaken
204: * The actionTaken to set.
205: */
206: public void setActionTaken(ActionTakenValue actionTaken) {
207: this .actionTaken = actionTaken;
208: }
209:
210: /**
211: * @return Returns the actionRequested.
212: */
213: public java.lang.String getActionRequested() {
214: return actionRequested;
215: }
216:
217: /**
218: * @param actionRequested
219: * The actionRequested to set.
220: */
221: public void setActionRequested(java.lang.String actionRequested) {
222: this .actionRequested = actionRequested;
223: }
224:
225: /**
226: * @return Returns the actionRequestId.
227: */
228: public java.lang.Long getActionRequestId() {
229: return actionRequestId;
230: }
231:
232: /**
233: * @param actionRequestId
234: * The actionRequestId to set.
235: */
236: public void setActionRequestId(java.lang.Long actionRequestId) {
237: this .actionRequestId = actionRequestId;
238: }
239:
240: /**
241: * @return Returns the actionTakenId.
242: */
243: public java.lang.Long getActionTakenId() {
244: return actionTakenId;
245: }
246:
247: /**
248: * @param actionTakenId
249: * The actionTakenId to set.
250: */
251: public void setActionTakenId(java.lang.Long actionTakenId) {
252: this .actionTakenId = actionTakenId;
253: }
254:
255: /**
256: * @return Returns the annotation.
257: */
258: public java.lang.String getAnnotation() {
259: return annotation;
260: }
261:
262: /**
263: * @param annotation
264: * The annotation to set.
265: */
266: public void setAnnotation(java.lang.String annotation) {
267: this .annotation = annotation;
268: }
269:
270: /**
271: * @return Returns the createDate.
272: */
273: public java.sql.Timestamp getCreateDate() {
274: return createDate;
275: }
276:
277: /**
278: * @param createDate
279: * The createDate to set.
280: */
281: public void setCreateDate(java.sql.Timestamp createDate) {
282: this .createDate = createDate;
283: }
284:
285: /**
286: * @return Returns the docVersion.
287: */
288: public java.lang.Integer getDocVersion() {
289: return docVersion;
290: }
291:
292: /**
293: * @param docVersion
294: * The docVersion to set.
295: */
296: public void setDocVersion(java.lang.Integer docVersion) {
297: this .docVersion = docVersion;
298: }
299:
300: public java.lang.String getWorkflowId() {
301: return workflowId;
302: }
303:
304: public void setWorkflowId(java.lang.String workflowId) {
305: this .workflowId = workflowId;
306: }
307:
308: /**
309: * @return Returns the ignorePrevAction.
310: */
311: public Boolean getIgnorePrevAction() {
312: return ignorePrevAction;
313: }
314:
315: /**
316: * @param ignorePrevAction
317: * The ignorePrevAction to set.
318: */
319: public void setIgnorePrevAction(Boolean ignorePrevAction) {
320: this .ignorePrevAction = ignorePrevAction;
321: }
322:
323: /**
324: * @return Returns the jrfVerNbr.
325: */
326: public java.lang.Integer getJrfVerNbr() {
327: return jrfVerNbr;
328: }
329:
330: /**
331: * @param jrfVerNbr
332: * The jrfVerNbr to set.
333: */
334: public void setJrfVerNbr(java.lang.Integer jrfVerNbr) {
335: this .jrfVerNbr = jrfVerNbr;
336: }
337:
338: /**
339: * @return Returns the priority.
340: */
341: public java.lang.Integer getPriority() {
342: return priority;
343: }
344:
345: /**
346: * @param priority
347: * The priority to set.
348: */
349: public void setPriority(java.lang.Integer priority) {
350: this .priority = priority;
351: }
352:
353: /**
354: * @return Returns the recipientTypeCd.
355: */
356: public java.lang.String getRecipientTypeCd() {
357: return recipientTypeCd;
358: }
359:
360: /**
361: * @param recipientTypeCd
362: * The recipientTypeCd to set.
363: */
364: public void setRecipientTypeCd(java.lang.String recipientTypeCd) {
365: this .recipientTypeCd = recipientTypeCd;
366: }
367:
368: /**
369: * @return Returns the responsibilityDesc.
370: */
371: public java.lang.String getResponsibilityDesc() {
372: return responsibilityDesc;
373: }
374:
375: /**
376: * @param responsibilityDesc
377: * The responsibilityDesc to set.
378: */
379: public void setResponsibilityDesc(
380: java.lang.String responsibilityDesc) {
381: this .responsibilityDesc = responsibilityDesc;
382: }
383:
384: /**
385: * @return Returns the responsibilityId.
386: */
387: public java.lang.Long getResponsibilityId() {
388: return responsibilityId;
389: }
390:
391: /**
392: * @param responsibilityId
393: * The responsibilityId to set.
394: */
395: public void setResponsibilityId(java.lang.Long responsibilityId) {
396: this .responsibilityId = responsibilityId;
397: }
398:
399: /**
400: * @return Returns the routeHeaderId.
401: */
402: public java.lang.Long getRouteHeaderId() {
403: return routeHeaderId;
404: }
405:
406: public void setRouteHeaderId(java.lang.Long routeHeaderId) {
407: this .routeHeaderId = routeHeaderId;
408: }
409:
410: public java.lang.Integer getRouteLevel() {
411: return routeLevel;
412: }
413:
414: public void setRouteLevel(java.lang.Integer routeLevel) {
415: this .routeLevel = routeLevel;
416: }
417:
418: // public java.lang.String getRouteMethodName() {
419: // return routeMethodName;
420: // }
421: //
422: // public void setRouteMethodName(java.lang.String routeMethodName) {
423: // this.routeMethodName = routeMethodName;
424: // }
425:
426: public java.lang.String getStatus() {
427: return status;
428: }
429:
430: public void setStatus(java.lang.String status) {
431: this .status = status;
432: }
433:
434: public java.lang.Long getWorkgroupId() {
435: return workgroupId;
436: }
437:
438: public void setWorkgroupId(java.lang.Long workgroupId) {
439: this .workgroupId = workgroupId;
440: }
441:
442: public Object copy(boolean preserveKeys) {
443: ActionRequestValue clone = new ActionRequestValue();
444: try {
445: BeanUtils.copyProperties(clone, this );
446: } catch (Exception e) {
447: throw new RuntimeException(e);
448: }
449: if (!preserveKeys) {
450: clone.setActionRequestId(null);
451: }
452: ActionTakenValue actionTakenClone = (ActionTakenValue) getActionTaken()
453: .copy(preserveKeys);
454: clone.setActionTaken(actionTakenClone);
455: return clone;
456: }
457:
458: public boolean isInitialized() {
459: return EdenConstants.ACTION_REQUEST_INITIALIZED
460: .equals(getStatus());
461: }
462:
463: public boolean isActive() {
464: return EdenConstants.ACTION_REQUEST_ACTIVATED
465: .equals(getStatus());
466: }
467:
468: public boolean isApproveOrCompleteRequest() {
469: return EdenConstants.ACTION_REQUEST_APPROVE_REQ
470: .equals(getActionRequested())
471: || EdenConstants.ACTION_REQUEST_COMPLETE_REQ
472: .equals(getActionRequested());
473: }
474:
475: public boolean isDone() {
476: return EdenConstants.ACTION_REQUEST_DONE_STATE
477: .equals(getStatus());
478: }
479:
480: public boolean isReviewerUser() {
481: return EdenConstants.ACTION_REQUEST_USER_RECIPIENT_CD
482: .equals(getRecipientTypeCd());
483: }
484:
485: public boolean isRecipientRoutedRequest(Recipient recipient)
486: throws EdenUserNotFoundException {
487: //before altering this method it is used in EdenUtility checkRouteLogAuthentication
488: //don't break that method
489: if (recipient == null) {
490: return false;
491: }
492: boolean isRecipientInGraph = false;
493: if (isReviewerUser()) {
494: if (recipient instanceof WorkflowUser) {
495: isRecipientInGraph = getWorkflowId().equals(
496: ((WorkflowUser) recipient).getWorkflowUserId()
497: .getWorkflowId());
498: } else {
499: isRecipientInGraph = ((Workgroup) recipient)
500: .hasMember(getWorkflowUser());
501: }
502:
503: } else if (isWorkgroupRequest()) {
504: if (recipient instanceof WorkflowUser) {
505: Workgroup workgroup = getWorkgroup();
506: if (workgroup == null) {
507: LOG.error("Was unable to retrieve workgroup "
508: + getWorkgroupId());
509: }
510: isRecipientInGraph = workgroup
511: .hasMember((WorkflowUser) recipient);
512: } else {
513: isRecipientInGraph = ((Workgroup) recipient)
514: .getWorkflowGroupId().getGroupId().equals(
515: getWorkgroupId());
516: }
517: }
518:
519: for (Iterator iter = getChildrenRequests().iterator(); iter
520: .hasNext();) {
521: ActionRequestValue childRequest = (ActionRequestValue) iter
522: .next();
523: isRecipientInGraph = isRecipientInGraph
524: || childRequest.isRecipientRoutedRequest(recipient);
525: }
526:
527: return isRecipientInGraph;
528: }
529:
530: public boolean isWorkgroupRequest() {
531: return EdenConstants.ACTION_REQUEST_WORKGROUP_RECIPIENT_CD
532: .equals(getRecipientTypeCd());
533: }
534:
535: public boolean isRoleRequest() {
536: return EdenConstants.ACTION_REQUEST_ROLE_RECIPIENT_CD
537: .equals(getRecipientTypeCd());
538: }
539:
540: public boolean isAcknowledgeRequest() {
541: return EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ
542: .equals(getActionRequested());
543: }
544:
545: public boolean isApproveRequest() {
546: return EdenConstants.ACTION_REQUEST_COMPLETE_REQ
547: .equals(getActionRequested())
548: || EdenConstants.ACTION_REQUEST_APPROVE_REQ
549: .equals(getActionRequested());
550: }
551:
552: public boolean isCompleteRequst() {
553: return EdenConstants.ACTION_REQUEST_COMPLETE_REQ
554: .equals(getActionRequested());
555: }
556:
557: public boolean isFYIRequest() {
558: return EdenConstants.ACTION_REQUEST_FYI_REQ
559: .equals(getActionRequested());
560: }
561:
562: /**
563: * Allows comparison of action requests to see which is greater responsibility. -1 : indicates code 1 is lesser responsibility than code 2 0 : indicates the same responsibility 1 : indicates code1 is greater responsibility than code 2 The priority of action requests is as follows: fyi < acknowledge < (approve == complete)
564: *
565: * @param code1
566: * @param code2
567: * @return -1 if less than, 0 if equal, 1 if greater than
568: */
569: public static int compareActionCode(String code1, String code2) {
570: // hacked so that APPROVE and COMPLETE are equal
571: int cutoff = ACTION_CODE_RANK.length() - 3;
572: Integer code1Index = new Integer(Math.min(ACTION_CODE_RANK
573: .indexOf(code1), cutoff));
574: Integer code2Index = new Integer(Math.min(ACTION_CODE_RANK
575: .indexOf(code2), cutoff));
576: return code1Index.compareTo(code2Index);
577: }
578:
579: /**
580: * Allows comparison of action requests to see which is greater responsibility. -1 : indicates type 1 is lesser responsibility than type 2 0 : indicates the same responsibility 1 : indicates type1 is greater responsibility than type 2
581: *
582: * @param type1
583: * @param type2
584: * @return -1 if less than, 0 if equal, 1 if greater than
585: */
586: public static int compareRecipientType(String type1, String type2) {
587: Integer type1Index = new Integer(RECIPIENT_TYPE_RANK
588: .indexOf(type1));
589: Integer type2Index = new Integer(RECIPIENT_TYPE_RANK
590: .indexOf(type2));
591: return type1Index.compareTo(type2Index);
592: }
593:
594: public static int compareDelegationType(String type1, String type2) {
595: if (StringUtils.isEmpty(type1)) {
596: type1 = "N";
597: }
598: if (StringUtils.isEmpty(type2)) {
599: type2 = "N";
600: }
601: Integer type1Index = new Integer(DELEGATION_TYPE_RANK
602: .indexOf(type1));
603: Integer type2Index = new Integer(DELEGATION_TYPE_RANK
604: .indexOf(type2));
605: return type1Index.compareTo(type2Index);
606: }
607:
608: public List getActionItems() {
609: return actionItems;
610: }
611:
612: public void setActionItems(List actionItems) {
613: this .actionItems = actionItems;
614: }
615:
616: public Boolean getCurrentIndicator() {
617: return currentIndicator;
618: }
619:
620: public void setCurrentIndicator(Boolean currentIndicator) {
621: this .currentIndicator = currentIndicator;
622: }
623:
624: public Long getParentActionRequestId() {
625: return parentActionRequestId;
626: }
627:
628: public void setParentActionRequestId(Long parentActionRequestId) {
629: this .parentActionRequestId = parentActionRequestId;
630: }
631:
632: public ActionRequestValue getParentActionRequest() {
633: return parentActionRequest;
634: }
635:
636: public void setParentActionRequest(
637: ActionRequestValue parentActionRequest) {
638: this .parentActionRequest = parentActionRequest;
639: }
640:
641: public List getChildrenRequests() {
642: return childrenRequests;
643: }
644:
645: public void setChildrenRequests(List childrenRequests) {
646: this .childrenRequests = childrenRequests;
647: }
648:
649: public String getQualifiedRoleName() {
650: return qualifiedRoleName;
651: }
652:
653: public void setQualifiedRoleName(String roleName) {
654: this .qualifiedRoleName = roleName;
655: }
656:
657: public String getDelegationType() {
658: return delegationType;
659: }
660:
661: public void setDelegationType(String delegatePolicy) {
662: this .delegationType = delegatePolicy;
663: }
664:
665: public String getRoleName() {
666: return roleName;
667: }
668:
669: public void setRoleName(String roleName) {
670: this .roleName = roleName;
671: }
672:
673: public String getApprovePolicy() {
674: return approvePolicy;
675: }
676:
677: public void setApprovePolicy(String requestType) {
678: this .approvePolicy = requestType;
679: }
680:
681: public boolean getHasApprovePolicy() {
682: return getApprovePolicy() != null;
683: }
684:
685: public boolean isDeactivated() {
686: return EdenConstants.ACTION_REQUEST_DONE_STATE
687: .equals(getStatus());
688: }
689:
690: public boolean hasParent() {
691: return getParentActionRequest() != null;
692: }
693:
694: public boolean hasChild(ActionRequestValue actionRequest) {
695: if (actionRequest == null)
696: return false;
697: Long actionRequestId = actionRequest.getActionRequestId();
698: for (Iterator iter = getChildrenRequests().iterator(); iter
699: .hasNext();) {
700: ActionRequestValue childRequest = (ActionRequestValue) iter
701: .next();
702: if (childRequest.equals(actionRequest)
703: || (actionRequestId != null && actionRequestId
704: .equals(childRequest.getActionRequestId()))) {
705: return true;
706: }
707: }
708: return false;
709: }
710:
711: public String getDisplayStatus() {
712: return displayStatus;
713: }
714:
715: public void setDisplayStatus(String displayStatus) {
716: this .displayStatus = displayStatus;
717: }
718:
719: public String getQualifiedRoleNameLabel() {
720: return qualifiedRoleNameLabel;
721: }
722:
723: public void setQualifiedRoleNameLabel(String qualifiedRoleNameLabel) {
724: this .qualifiedRoleNameLabel = qualifiedRoleNameLabel;
725: }
726:
727: public String getCreateDateString() {
728: if (createDateString == null
729: || createDateString.trim().equals("")) {
730: return EdenConstants.getDefaultDateFormat().format(
731: getCreateDate());
732: } else {
733: return createDateString;
734: }
735: }
736:
737: public void setCreateDateString(String createDateString) {
738: this .createDateString = createDateString;
739: }
740:
741: public RouteNodeInstance getNodeInstance() {
742: return nodeInstance;
743: }
744:
745: public String getPotentialNodeName() {
746: return (getNodeInstance() == null ? "" : getNodeInstance()
747: .getName());
748: }
749:
750: public void setNodeInstance(RouteNodeInstance nodeInstance) {
751: this .nodeInstance = nodeInstance;
752: }
753:
754: public String getRecipientTypeLabel() {
755: return (String) EdenConstants.ACTION_REQUEST_RECIPIENT_TYPE
756: .get(getRecipientTypeCd());
757: }
758:
759: public RuleBaseValues getRuleBaseValues() {
760: if (ruleBaseValuesId != null) {
761: return getRuleService().findRuleBaseValuesById(
762: ruleBaseValuesId);
763: }
764: return null;
765: }
766:
767: public Long getRuleBaseValuesId() {
768: return ruleBaseValuesId;
769: }
770:
771: public void setRuleBaseValuesId(Long ruleBaseValuesId) {
772: this .ruleBaseValuesId = ruleBaseValuesId;
773: }
774:
775: // public java.lang.String getRouteMethodName() {
776: // return routeMethodName;
777: // }
778: //
779: // public void setRouteMethodName(java.lang.String routeMethodName) {
780: // this.routeMethodName = routeMethodName;
781: // }
782:
783: private RuleService getRuleService() {
784: return (RuleService) KEWServiceLocator
785: .getService(KEWServiceLocator.RULE_SERVICE);
786: }
787:
788: public boolean isPrimaryDelegator() {
789: boolean primaryDelegator = false;
790: for (Iterator iter = childrenRequests.iterator(); iter
791: .hasNext();) {
792: ActionRequestValue childRequest = (ActionRequestValue) iter
793: .next();
794: primaryDelegator = EdenConstants.DELEGATION_PRIMARY
795: .equals(childRequest.getDelegationType())
796: || primaryDelegator;
797: }
798: return primaryDelegator;
799: }
800:
801: /**
802: * Used to get primary delegate names on route log in the 'Requested Of' section so primary delegate requests
803: * list the delegate and not the delegator as having the request 'IN ACTION LIST'. This method doesn't recurse
804: * and therefore assume an AR structure.
805: *
806: * @return primary delgate requests
807: */
808: public List getPrimaryDelegateRequests() {
809: List primaryDelegateRequests = new ArrayList();
810: for (Iterator iter = childrenRequests.iterator(); iter
811: .hasNext();) {
812: ActionRequestValue childRequest = (ActionRequestValue) iter
813: .next();
814: if (EdenConstants.DELEGATION_PRIMARY.equals(childRequest
815: .getDelegationType())) {
816: if (childRequest.isRoleRequest()) {
817: for (Iterator iterator = childRequest
818: .getChildrenRequests().iterator(); iterator
819: .hasNext();) {
820: primaryDelegateRequests.add(iterator.next());
821: }
822: } else {
823: primaryDelegateRequests.add(childRequest);
824: }
825: }
826: }
827: return primaryDelegateRequests;
828: }
829:
830: public boolean isAdHocRequest() {
831: return EdenConstants.ADHOC_REQUEST_RESPONSIBILITY_ID
832: .equals(getResponsibilityId());
833: }
834:
835: public boolean isGeneratedRequest() {
836: return EdenConstants.MACHINE_GENERATED_RESPONSIBILITY_ID
837: .equals(getResponsibilityId());
838: }
839:
840: public boolean isExceptionRequest() {
841: return EdenConstants.EXCEPTION_REQUEST_RESPONSIBILITY_ID
842: .equals(getResponsibilityId());
843: }
844:
845: public boolean isRouteModuleRequest() {
846: return getResponsibilityId().longValue() > 0;
847: }
848:
849: }
|