View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    *
4    *
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.opensource.org/licenses/ecl2.php
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.kuali.rice.kew.rule;
18  
19  import java.sql.Timestamp;
20  import java.util.ArrayList;
21  import java.util.Date;
22  import java.util.HashMap;
23  import java.util.Iterator;
24  import java.util.LinkedHashMap;
25  import java.util.List;
26  import java.util.Map;
27  
28  import javax.persistence.CascadeType;
29  import javax.persistence.Column;
30  import javax.persistence.Entity;
31  import javax.persistence.FetchType;
32  import javax.persistence.Id;
33  import javax.persistence.JoinColumn;
34  import javax.persistence.ManyToOne;
35  import javax.persistence.OneToMany;
36  import javax.persistence.OneToOne;
37  import javax.persistence.Table;
38  import javax.persistence.Transient;
39  
40  import org.hibernate.annotations.Fetch;
41  import org.hibernate.annotations.FetchMode;
42  import org.kuali.rice.core.jpa.annotations.Sequence;
43  import org.kuali.rice.core.util.RiceConstants;
44  import org.kuali.rice.kew.bo.KewPersistableBusinessObjectBase;
45  import org.kuali.rice.kew.doctype.bo.DocumentType;
46  import org.kuali.rice.kew.lookupable.MyColumns;
47  import org.kuali.rice.kew.routeheader.DocumentContent;
48  import org.kuali.rice.kew.rule.bo.RuleAttribute;
49  import org.kuali.rice.kew.rule.bo.RuleTemplate;
50  import org.kuali.rice.kew.rule.bo.RuleTemplateAttribute;
51  import org.kuali.rice.kew.rule.service.RuleService;
52  import org.kuali.rice.kew.rule.xmlrouting.GenericXMLRuleAttribute;
53  import org.kuali.rice.kew.service.KEWServiceLocator;
54  import org.kuali.rice.kew.util.CodeTranslator;
55  import org.kuali.rice.kew.util.KEWConstants;
56  import org.kuali.rice.kim.bo.impl.GroupImpl;
57  import org.kuali.rice.kim.bo.impl.PersonImpl;
58  import org.kuali.rice.kns.util.TypedArrayList;
59  import org.kuali.rice.kns.web.ui.Field;
60  import org.kuali.rice.kns.web.ui.Row;
61  
62  
63  /**
64   * A model bean for a Rule within the KEW rules engine.
65   *
66   * @author Kuali Rice Team (rice.collab@kuali.org)
67   */
68  @Entity
69  @Table(name="KREW_RULE_T")
70  @Sequence(name="KREW_RTE_TMPL_S", property="ruleBaseValuesId")
71  public class RuleBaseValues extends KewPersistableBusinessObjectBase {
72  
73      private static final long serialVersionUID = 6137765574728530156L;
74      @Id
75  	@Column(name="RULE_ID")
76      private Long ruleBaseValuesId;
77      /**
78       * Unique Rule name
79       */
80      @Column(name="NM")
81  	private String name;
82      @Column(name="RULE_TMPL_ID", insertable=false, updatable=false)
83  	private Long ruleTemplateId;
84      @Column(name="PREV_RULE_VER_NBR")
85  	private Long previousVersionId;
86      @Column(name="ACTV_IND")
87  	private Boolean activeInd;
88      @Column(name="RULE_BASE_VAL_DESC")
89  	private String description;
90      @Column(name="DOC_TYP_NM")
91  	private String docTypeName;
92      @Column(name="DOC_HDR_ID")
93  	private Long routeHeaderId;
94  	@Column(name="FRM_DT")
95  	private Timestamp fromDate;
96  	@Column(name="TO_DT", nullable=false)
97  	private Timestamp toDate;
98  	@Column(name="DACTVN_DT")
99  	private Timestamp deactivationDate;
100     @Column(name="CUR_IND")
101 	private Boolean currentInd;
102     @Column(name="RULE_VER_NBR")
103 	private Integer versionNbr;
104     @Column(name="FRC_ACTN")
105 	private Boolean forceAction;
106     @Fetch(value = FetchMode.SUBSELECT)
107     @OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE},
108            targetEntity=org.kuali.rice.kew.rule.RuleResponsibility.class, mappedBy="ruleBaseValues")
109 	private List<RuleResponsibility> responsibilities;
110     @Fetch(value = FetchMode.SUBSELECT)
111     @OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE},
112            targetEntity=org.kuali.rice.kew.rule.RuleExtension.class, mappedBy="ruleBaseValues")
113 	private List<RuleExtension> ruleExtensions;
114     @ManyToOne(fetch=FetchType.EAGER)
115 	@JoinColumn(name="RULE_TMPL_ID")
116 	private RuleTemplate ruleTemplate;
117     @OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE})
118 	@JoinColumn(name="RULE_EXPR_ID")
119 	private RuleExpressionDef ruleExpressionDef;
120     @Transient
121     private RuleBaseValues previousVersion;
122     @Column(name="ACTVN_DT")
123 	private Timestamp activationDate;
124     @Column(name="DLGN_IND")
125     private Boolean delegateRule = Boolean.FALSE;
126     /**
127      * Indicator that signifies that this rule is a defaults/template rule which contains
128      * template-defined rule defaults for other rules which use the associated template
129      */
130     @Column(name="TMPL_RULE_IND")
131     private Boolean templateRuleInd = Boolean.FALSE;
132 
133     // required to be lookupable
134     @Transient
135     private String returnUrl;
136     @Transient
137     private String destinationUrl;
138     @Transient
139     private MyColumns myColumns;
140     @Transient
141     private List<PersonRuleResponsibility> personResponsibilities;
142     @Transient
143     private List<GroupRuleResponsibility> groupResponsibilities;
144     @Transient
145     private List<RoleRuleResponsibility> roleResponsibilities;
146     @Transient
147     private Map<String, String> fieldValues;
148     @Transient
149     private String groupReviewerName;
150     @Transient
151     private String groupReviewerNamespace;
152     @Transient
153     private String personReviewer;
154     @Transient
155     private String personReviewerType;
156 
157     public RuleBaseValues() {
158         responsibilities = new ArrayList<RuleResponsibility>();
159         ruleExtensions = new ArrayList<RuleExtension>();
160         personResponsibilities = new TypedArrayList(PersonRuleResponsibility.class);
161         groupResponsibilities = new TypedArrayList(GroupRuleResponsibility.class);
162         roleResponsibilities = new TypedArrayList(RoleRuleResponsibility.class);
163         fieldValues = new HashMap<String, String>();
164     }
165 
166     /**
167      * @return the rule expression definition for this rule, if defined
168      */
169     public RuleExpressionDef getRuleExpressionDef() {
170         return ruleExpressionDef;
171     }
172 
173     /**
174      * @param ruleExpressionDef the rule expression definition to set for this rule
175      */
176     public void setRuleExpressionDef(RuleExpressionDef ruleExpressionDef) {
177         this.ruleExpressionDef = ruleExpressionDef;
178     }
179 
180     public Map getRuleExtensionValueLabels() {
181         Map extensionLabels = new HashMap();
182         for (Iterator iterator2 = getRuleExtensions().iterator(); iterator2.hasNext();) {
183             RuleExtension ruleExtension = (RuleExtension) iterator2.next();
184             if (!ruleExtension.getRuleTemplateAttribute().isWorkflowAttribute()) {
185                 continue;
186             }
187             WorkflowAttribute workflowAttribute = ruleExtension.getRuleTemplateAttribute().getWorkflowAttribute();
188 
189             RuleAttribute ruleAttribute = ruleExtension.getRuleTemplateAttribute().getRuleAttribute();
190             if (ruleAttribute.getType().equals(KEWConstants.RULE_XML_ATTRIBUTE_TYPE)) {
191                 ((GenericXMLRuleAttribute) workflowAttribute).setRuleAttribute(ruleAttribute);
192             }
193             for (Iterator iterator = workflowAttribute.getRuleRows().iterator(); iterator.hasNext();) {
194                 Row row = (Row) iterator.next();
195                 for (Iterator iterator3 = row.getFields().iterator(); iterator3.hasNext();) {
196                     Field field = (Field) iterator3.next();
197                     if (ruleAttribute.getType().equals(KEWConstants.RULE_XML_ATTRIBUTE_TYPE)) {
198                         extensionLabels.put(field.getPropertyName(), field.getFieldLabel());
199                     //} else if (!Utilities.isEmpty(field.getDefaultLookupableName())) {
200                     //    extensionLabels.put(field.getDefaultLookupableName(), field.getFieldLabel());
201                     } else {
202                         extensionLabels.put(field.getPropertyName(), field.getFieldLabel());
203                     }
204                 }
205             }
206         }
207         return extensionLabels;
208     }
209 
210     public String getRuleTemplateName() {
211         if (ruleTemplate != null) {
212             return ruleTemplate.getName();
213         }
214         return null;
215     }
216 
217     public RuleBaseValues getPreviousVersion() {
218         if (previousVersion == null) {
219             RuleService ruleService = (RuleService) KEWServiceLocator.getService(KEWServiceLocator.RULE_SERVICE);
220             return ruleService.findRuleBaseValuesById(previousVersionId);
221         }
222         return previousVersion;
223     }
224 
225     public void setPreviousVersion(RuleBaseValues previousVersion) {
226         this.previousVersion = previousVersion;
227     }
228 
229     public RuleResponsibility getResponsibility(int index) {
230         while (getResponsibilities().size() <= index) {
231             RuleResponsibility ruleResponsibility = new RuleResponsibility();
232             ruleResponsibility.setRuleBaseValues(this);
233             getResponsibilities().add(ruleResponsibility);
234         }
235         return (RuleResponsibility) getResponsibilities().get(index);
236     }
237 
238     public RuleExtension getRuleExtension(int index) {
239         while (getRuleExtensions().size() <= index) {
240             getRuleExtensions().add(new RuleExtension());
241         }
242         return (RuleExtension) getRuleExtensions().get(index);
243     }
244 
245     public RuleExtensionValue getRuleExtensionValue(String key) {
246         for (Iterator iter = getRuleExtensions().iterator(); iter.hasNext();) {
247             RuleExtension ruleExtension = (RuleExtension) iter.next();
248             for (Iterator iterator = ruleExtension.getExtensionValues().iterator(); iterator.hasNext();) {
249                 RuleExtensionValue ruleExtensionValue = (RuleExtensionValue) iterator.next();
250                 if (ruleExtensionValue.getKey().equals(key)) {
251                     return ruleExtensionValue;
252                 }
253             }
254         }
255         return null;
256     }
257 
258     public RuleExtensionValue getRuleExtensionValue(Long ruleTemplateAttributeId, String key) {
259         for (Iterator iter = getRuleExtensions().iterator(); iter.hasNext();) {
260             RuleExtension ruleExtension = (RuleExtension) iter.next();
261             if (ruleExtension.getRuleTemplateAttributeId().equals(ruleTemplateAttributeId)) {
262                 for (Iterator iterator = ruleExtension.getExtensionValues().iterator(); iterator.hasNext();) {
263                     RuleExtensionValue ruleExtensionValue = (RuleExtensionValue) iterator.next();
264                     if (ruleExtensionValue.getKey().equals(key)) {
265                         return ruleExtensionValue;
266                     }
267                 }
268             }
269         }
270         return null;
271     }
272 
273     public Long getPreviousVersionId() {
274         return previousVersionId;
275     }
276 
277     public void setPreviousVersionId(Long previousVersion) {
278         this.previousVersionId = previousVersion;
279     }
280 
281     public void addRuleResponsibility(RuleResponsibility ruleResponsibility) {
282         addRuleResponsibility(ruleResponsibility, new Integer(getResponsibilities().size()));
283     }
284 
285     public void addRuleResponsibility(RuleResponsibility ruleResponsibility, Integer counter) {
286         boolean alreadyAdded = false;
287         int location = 0;
288         if (counter != null) {
289             for (Iterator responsibilitiesIter = getResponsibilities().iterator(); responsibilitiesIter.hasNext();) {
290                 RuleResponsibility ruleResponsibilityRow = (RuleResponsibility) responsibilitiesIter.next();
291                 if (counter.intValue() == location) {
292                     ruleResponsibilityRow.setPriority(ruleResponsibility.getPriority());
293                     ruleResponsibilityRow.setActionRequestedCd(ruleResponsibility.getActionRequestedCd());
294                     ruleResponsibilityRow.setVersionNumber(ruleResponsibility.getVersionNumber());
295                     ruleResponsibilityRow.setRuleBaseValuesId(ruleResponsibility.getRuleBaseValuesId());
296                     ruleResponsibilityRow.setRuleResponsibilityName(ruleResponsibility.getRuleResponsibilityName());
297                     ruleResponsibilityRow.setRuleResponsibilityType(ruleResponsibility.getRuleResponsibilityType());
298                     //ruleResponsibilityRow.setDelegationRules(ruleResponsibility.getDelegationRules());
299                     ruleResponsibilityRow.setApprovePolicy(ruleResponsibility.getApprovePolicy());
300                     alreadyAdded = true;
301                 }
302                 location++;
303             }
304         }
305         if (!alreadyAdded) {
306             getResponsibilities().add(ruleResponsibility);
307         }
308     }
309 
310     public RuleTemplate getRuleTemplate() {
311         return ruleTemplate;
312     }
313 
314     public void setRuleTemplate(RuleTemplate ruleTemplate) {
315         this.ruleTemplate = ruleTemplate;
316     }
317 
318     public Long getRuleTemplateId() {
319         return ruleTemplateId;
320     }
321 
322     public void setRuleTemplateId(Long ruleTemplateId) {
323         this.ruleTemplateId = ruleTemplateId;
324     }
325 
326     public DocumentType getDocumentType() {
327     	return KEWServiceLocator.getDocumentTypeService().findByName(getDocTypeName());
328     }
329 
330     public String getDocTypeName() {
331         return docTypeName;
332     }
333 
334     public void setDocTypeName(String docTypeName) {
335         this.docTypeName = docTypeName;
336     }
337 
338     public List<RuleExtension> getRuleExtensions() {
339         return ruleExtensions;
340     }
341 
342     public void setRuleExtensions(List<RuleExtension> ruleExtensions) {
343         this.ruleExtensions = ruleExtensions;
344     }
345 
346     public List<RuleResponsibility> getResponsibilities() {
347         return responsibilities;
348     }
349 
350     public void setResponsibilities(List<RuleResponsibility> responsibilities) {
351         this.responsibilities = responsibilities;
352     }
353 
354     public RuleResponsibility getResponsibility(Long ruleResponsibilityKey) {
355         for (Iterator iterator = getResponsibilities().iterator(); iterator.hasNext();) {
356             RuleResponsibility responsibility = (RuleResponsibility) iterator.next();
357             if (responsibility.getRuleResponsibilityKey() != null
358                     && responsibility.getRuleResponsibilityKey().equals(ruleResponsibilityKey)) {
359                 return responsibility;
360             }
361         }
362         return null;
363     }
364 
365     public void removeResponsibility(int index) {
366         getResponsibilities().remove(index);
367     }
368 
369     public Boolean getActiveInd() {
370         return activeInd;
371     }
372 
373     public void setActiveInd(Boolean activeInd) {
374         this.activeInd = activeInd;
375     }
376 
377     public String getActiveIndDisplay() {
378         if (getActiveInd() == null) {
379             return KEWConstants.INACTIVE_LABEL_LOWER;
380         }
381         return CodeTranslator.getActiveIndicatorLabel(getActiveInd());
382     }
383 
384     public Boolean getCurrentInd() {
385         return currentInd;
386     }
387 
388     public void setCurrentInd(Boolean currentInd) {
389         this.currentInd = currentInd;
390     }
391 
392     public Timestamp getFromDate() {
393         return fromDate;
394     }
395 
396     public void setFromDate(Timestamp fromDate) {
397         this.fromDate = fromDate;
398     }
399 
400     public String getDescription() {
401         return description;
402     }
403 
404     public void setDescription(String description) {
405         this.description = description;
406     }
407 
408     public Long getRuleBaseValuesId() {
409         return ruleBaseValuesId;
410     }
411 
412     public void setRuleBaseValuesId(Long ruleBaseValuesId) {
413         this.ruleBaseValuesId = ruleBaseValuesId;
414     }
415 
416     public Timestamp getToDate() {
417         return toDate;
418     }
419 
420     public void setToDate(Timestamp toDate) {
421         this.toDate = toDate;
422     }
423 
424     public Integer getVersionNbr() {
425         return versionNbr;
426     }
427 
428     public void setVersionNbr(Integer versionNbr) {
429         this.versionNbr = versionNbr;
430     }
431 
432     public Object copy(boolean preserveKeys) {
433         RuleBaseValues ruleBaseValuesClone = new RuleBaseValues();
434 
435         if (preserveKeys && (ruleBaseValuesId != null)) {
436             ruleBaseValuesClone.setRuleBaseValuesId(new Long(ruleBaseValuesId.longValue()));
437         }
438         if (routeHeaderId != null) {
439             ruleBaseValuesClone.setRouteHeaderId(new Long(routeHeaderId.longValue()));
440         }
441         if (forceAction != null) {
442             ruleBaseValuesClone.setForceAction(new Boolean(forceAction.booleanValue()));
443         }
444         if (activeInd != null) {
445             ruleBaseValuesClone.setActiveInd(new Boolean(activeInd.booleanValue()));
446         }
447         if (currentInd != null) {
448             ruleBaseValuesClone.setCurrentInd(new Boolean(currentInd.booleanValue()));
449         }
450         if (docTypeName != null) {
451             ruleBaseValuesClone.setDocTypeName(new String(docTypeName));
452         }
453         if (fromDate != null) {
454             ruleBaseValuesClone.setFromDate(new Timestamp(fromDate.getTime()));
455         }
456         if (description != null) {
457             ruleBaseValuesClone.setDescription(new String(description));
458         }
459         if (delegateRule != null) {
460             ruleBaseValuesClone.setDelegateRule(new Boolean(delegateRule.booleanValue()));
461         }
462         if ((responsibilities != null) && !responsibilities.isEmpty()) {
463             List responsibilityList = new ArrayList();
464 
465             for (Iterator i = responsibilities.iterator(); i.hasNext();) {
466                 RuleResponsibility responsibility = (RuleResponsibility) i.next();
467                 RuleResponsibility responsibilityCopy = (RuleResponsibility) responsibility.copy(false);
468                 responsibilityCopy.setRuleBaseValues(ruleBaseValuesClone);
469                 responsibilityList.add(responsibilityCopy);
470             }
471             ruleBaseValuesClone.setResponsibilities(responsibilityList);
472         }
473 
474         if ((ruleExtensions != null) && !ruleExtensions.isEmpty()) {
475             List<RuleExtension> ruleExtensionsList = new ArrayList<RuleExtension>();
476 
477             for (Iterator i = ruleExtensions.iterator(); i.hasNext();) {
478                 RuleExtension ruleExtension = (RuleExtension) i.next();
479                 RuleExtension ruleExtensionCopy = (RuleExtension) ruleExtension.copy(preserveKeys);
480                 ruleExtensionCopy.setRuleBaseValues(ruleBaseValuesClone);
481                 ruleExtensionsList.add(ruleExtensionCopy);
482             }
483             ruleBaseValuesClone.setRuleExtensions(ruleExtensionsList);
484         }
485         if (toDate != null) {
486             ruleBaseValuesClone.setToDate(new Timestamp(toDate.getTime()));
487         }
488         if (versionNbr != null) {
489             ruleBaseValuesClone.setVersionNbr(new Integer(versionNbr.intValue()));
490         }
491         ruleBaseValuesClone.setActivationDate(getActivationDate());
492         ruleBaseValuesClone.setRuleTemplate(getRuleTemplate());
493         return ruleBaseValuesClone;
494     }
495 
496     public String getReturnUrl() {
497         return returnUrl;
498     }
499 
500     public void setReturnUrl(String returnUrl) {
501         this.returnUrl = returnUrl;
502     }
503 
504     public String getFromDateString() {
505         if (this.fromDate != null) {
506             return RiceConstants.getDefaultDateFormat().format(this.fromDate);
507         }
508         return null;
509     }
510 
511     public String getToDateString() {
512         if (this.toDate != null) {
513             return RiceConstants.getDefaultDateFormat().format(this.toDate);
514         }
515         return null;
516     }
517 
518     public Boolean getForceAction() {
519         return forceAction;
520     }
521 
522     public void setForceAction(Boolean forceAction) {
523         this.forceAction = forceAction;
524     }
525 
526     public boolean isActive(Date date) {
527     	boolean isAfterFromDate = getFromDate() == null || date.after(getFromDate());
528     	boolean isBeforeToDate = getToDate() == null || date.before(getToDate());
529     	return getActiveInd() && isAfterFromDate && isBeforeToDate;
530     }
531 
532     public boolean isMatch(DocumentContent docContent) {
533         for (Iterator iter = getRuleTemplate().getActiveRuleTemplateAttributes().iterator(); iter.hasNext();) {
534             RuleTemplateAttribute ruleTemplateAttribute = (RuleTemplateAttribute) iter.next();
535             if (!ruleTemplateAttribute.isWorkflowAttribute()) {
536                 continue;
537             }
538             WorkflowAttribute routingAttribute = (WorkflowAttribute) ruleTemplateAttribute.getWorkflowAttribute();
539 
540             RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute();
541             if (ruleAttribute.getType().equals(KEWConstants.RULE_XML_ATTRIBUTE_TYPE)) {
542                 ((GenericXMLRuleAttribute) routingAttribute).setRuleAttribute(ruleAttribute);
543             }
544             String className = ruleAttribute.getClassName();
545             List<RuleExtension> editedRuleExtensions = new ArrayList<RuleExtension>();
546             for (Iterator iter2 = getRuleExtensions().iterator(); iter2.hasNext();) {
547                 RuleExtension extension = (RuleExtension) iter2.next();
548                 if (extension.getRuleTemplateAttribute().getRuleAttribute().getClassName().equals(className)) {
549                     editedRuleExtensions.add(extension);
550                 }
551             }
552             if (!routingAttribute.isMatch(docContent, editedRuleExtensions)) {
553                 return false;
554             }
555         }
556         return true;
557     }
558 
559     public RuleResponsibility findResponsibility(String roleName) {
560         for (Iterator iter = getResponsibilities().iterator(); iter.hasNext();) {
561             RuleResponsibility resp = (RuleResponsibility) iter.next();
562             if (KEWConstants.RULE_RESPONSIBILITY_ROLE_ID.equals(resp.getRuleResponsibilityType())
563                     && roleName.equals(resp.getRuleResponsibilityName())) {
564                 return resp;
565             }
566         }
567         return null;
568     }
569 
570     public Long getRouteHeaderId() {
571         return routeHeaderId;
572     }
573 
574     public void setRouteHeaderId(Long routeHeaderId) {
575         this.routeHeaderId = routeHeaderId;
576     }
577 
578     public Boolean getDelegateRule() {
579         return delegateRule;
580     }
581 
582     public void setDelegateRule(Boolean isDelegateRule) {
583         this.delegateRule = isDelegateRule;
584     }
585 
586     public Timestamp getActivationDate() {
587         return activationDate;
588     }
589 
590     public void setActivationDate(Timestamp activationDate) {
591         this.activationDate = activationDate;
592     }
593 
594     public MyColumns getMyColumns() {
595         return myColumns;
596     }
597 
598     public void setMyColumns(MyColumns additionalColumns) {
599         this.myColumns = additionalColumns;
600     }
601 
602     public String getDestinationUrl() {
603         return destinationUrl;
604     }
605 
606     public void setDestinationUrl(String destinationUrl) {
607         this.destinationUrl = destinationUrl;
608     }
609 
610     public Timestamp getDeactivationDate() {
611         return deactivationDate;
612     }
613 
614     public void setDeactivationDate(Timestamp deactivationDate) {
615         this.deactivationDate = deactivationDate;
616     }
617 
618     /**
619      * @return whether this is a defaults/template rule
620      */
621     public Boolean getTemplateRuleInd() {
622         return templateRuleInd;
623     }
624 
625     /**
626      * @param templateRuleInd whether this is a defaults/template rule
627      */
628     public void setTemplateRuleInd(Boolean templateRuleInd) {
629         this.templateRuleInd = templateRuleInd;
630     }
631 
632     /**
633      * Get the rule name
634      * @return the rule name
635      */
636     public String getName() {
637         return name;
638     }
639 
640     /**
641      * Set the rule name
642      * @param name the rule name
643      */
644     public void setName(String name) {
645         this.name = name;
646     }
647 
648 	public List<PersonRuleResponsibility> getPersonResponsibilities() {
649 		return this.personResponsibilities;
650 	}
651 
652 	public void setPersonResponsibilities(List<PersonRuleResponsibility> personResponsibilities) {
653 		this.personResponsibilities = personResponsibilities;
654 	}
655 
656 	public List<GroupRuleResponsibility> getGroupResponsibilities() {
657 		return this.groupResponsibilities;
658 	}
659 
660 	public void setGroupResponsibilities(List<GroupRuleResponsibility> groupResponsibilities) {
661 		this.groupResponsibilities = groupResponsibilities;
662 	}
663 
664 	public List<RoleRuleResponsibility> getRoleResponsibilities() {
665 		return this.roleResponsibilities;
666 	}
667 
668 	public void setRoleResponsibilities(List<RoleRuleResponsibility> roleResponsibilities) {
669 		this.roleResponsibilities = roleResponsibilities;
670 	}
671 
672 	/**
673 	 * @return the fieldValues
674 	 */
675 	public Map<String, String> getFieldValues() {
676 		return this.fieldValues;
677 	}
678 
679 	/**
680 	 * @param fieldValues the fieldValues to set
681 	 */
682 	public void setFieldValues(Map<String, String> fieldValues) {
683 		this.fieldValues = fieldValues;
684 	}
685 
686 	@Override
687 	protected LinkedHashMap<String, Object> toStringMapper() {
688 		LinkedHashMap<String, Object> mapper = new LinkedHashMap<String, Object>();
689         mapper.put("ruleBaseValuesId", ruleBaseValuesId);
690         mapper.put("description", description);
691         mapper.put("docTypeName", docTypeName);
692         mapper.put("routeHeaderId", routeHeaderId);
693         mapper.put("delegateRule", delegateRule);
694         mapper.put("forceAction", forceAction);
695         mapper.put("activeInd", activeInd);
696         mapper.put("currentInd", currentInd);
697         mapper.put("versionNbr", versionNbr);
698         mapper.put("previousVersionId", previousVersionId);
699         mapper.put("ruleTemplateId", ruleTemplateId);
700         mapper.put("returnUrl", returnUrl);
701         mapper.put("responsibilities", responsibilities == null ? responsibilities : "size: " + responsibilities.size());
702 		return mapper;
703 	}
704 
705     public String getGroupReviewerName() {
706         return this.groupReviewerName;
707     }
708 
709     public String getGroupReviewerNamespace() {
710         return this.groupReviewerNamespace;
711     }
712 
713     public String getPersonReviewer() {
714         return this.personReviewer;
715     }
716 
717     public void setGroupReviewerName(String groupReviewerName) {
718         this.groupReviewerName = groupReviewerName;
719     }
720 
721     public void setGroupReviewerNamespace(String groupReviewerNamespace) {
722         this.groupReviewerNamespace = groupReviewerNamespace;
723     }
724 
725     public void setPersonReviewer(String personReviewer) {
726         this.personReviewer = personReviewer;
727     }
728 
729     public GroupImpl getKimGroupImpl() {
730         return new GroupImpl();
731     }
732 
733     public PersonImpl getPersonImpl() {
734         return new PersonImpl();
735     }
736 
737     public String getPersonReviewerType() {
738         return this.personReviewerType;
739     }
740 
741     public void setPersonReviewerType(String personReviewerType) {
742         this.personReviewerType = personReviewerType;
743     }
744 }