1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
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 | |
|
65 | |
|
66 | |
|
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 | |
|
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 | 0 | @Column(name="DLGN_IND") |
125 | |
private Boolean delegateRule = Boolean.FALSE; |
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | 0 | @Column(name="TMPL_RULE_IND") |
131 | |
private Boolean templateRuleInd = Boolean.FALSE; |
132 | |
|
133 | |
|
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 | 0 | public RuleBaseValues() { |
158 | 0 | responsibilities = new ArrayList<RuleResponsibility>(); |
159 | 0 | ruleExtensions = new ArrayList<RuleExtension>(); |
160 | 0 | personResponsibilities = new TypedArrayList(PersonRuleResponsibility.class); |
161 | 0 | groupResponsibilities = new TypedArrayList(GroupRuleResponsibility.class); |
162 | 0 | roleResponsibilities = new TypedArrayList(RoleRuleResponsibility.class); |
163 | 0 | fieldValues = new HashMap<String, String>(); |
164 | 0 | } |
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
public RuleExpressionDef getRuleExpressionDef() { |
170 | 0 | return ruleExpressionDef; |
171 | |
} |
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
public void setRuleExpressionDef(RuleExpressionDef ruleExpressionDef) { |
177 | 0 | this.ruleExpressionDef = ruleExpressionDef; |
178 | 0 | } |
179 | |
|
180 | |
public Map getRuleExtensionValueLabels() { |
181 | 0 | Map extensionLabels = new HashMap(); |
182 | 0 | for (Iterator iterator2 = getRuleExtensions().iterator(); iterator2.hasNext();) { |
183 | 0 | RuleExtension ruleExtension = (RuleExtension) iterator2.next(); |
184 | 0 | if (!ruleExtension.getRuleTemplateAttribute().isWorkflowAttribute()) { |
185 | 0 | continue; |
186 | |
} |
187 | 0 | WorkflowAttribute workflowAttribute = ruleExtension.getRuleTemplateAttribute().getWorkflowAttribute(); |
188 | |
|
189 | 0 | RuleAttribute ruleAttribute = ruleExtension.getRuleTemplateAttribute().getRuleAttribute(); |
190 | 0 | if (ruleAttribute.getType().equals(KEWConstants.RULE_XML_ATTRIBUTE_TYPE)) { |
191 | 0 | ((GenericXMLRuleAttribute) workflowAttribute).setRuleAttribute(ruleAttribute); |
192 | |
} |
193 | 0 | for (Iterator iterator = workflowAttribute.getRuleRows().iterator(); iterator.hasNext();) { |
194 | 0 | Row row = (Row) iterator.next(); |
195 | 0 | for (Iterator iterator3 = row.getFields().iterator(); iterator3.hasNext();) { |
196 | 0 | Field field = (Field) iterator3.next(); |
197 | 0 | if (ruleAttribute.getType().equals(KEWConstants.RULE_XML_ATTRIBUTE_TYPE)) { |
198 | 0 | extensionLabels.put(field.getPropertyName(), field.getFieldLabel()); |
199 | |
|
200 | |
|
201 | |
} else { |
202 | 0 | extensionLabels.put(field.getPropertyName(), field.getFieldLabel()); |
203 | |
} |
204 | 0 | } |
205 | 0 | } |
206 | 0 | } |
207 | 0 | return extensionLabels; |
208 | |
} |
209 | |
|
210 | |
public String getRuleTemplateName() { |
211 | 0 | if (ruleTemplate != null) { |
212 | 0 | return ruleTemplate.getName(); |
213 | |
} |
214 | 0 | return null; |
215 | |
} |
216 | |
|
217 | |
public RuleBaseValues getPreviousVersion() { |
218 | 0 | if (previousVersion == null) { |
219 | 0 | RuleService ruleService = (RuleService) KEWServiceLocator.getService(KEWServiceLocator.RULE_SERVICE); |
220 | 0 | return ruleService.findRuleBaseValuesById(previousVersionId); |
221 | |
} |
222 | 0 | return previousVersion; |
223 | |
} |
224 | |
|
225 | |
public void setPreviousVersion(RuleBaseValues previousVersion) { |
226 | 0 | this.previousVersion = previousVersion; |
227 | 0 | } |
228 | |
|
229 | |
public RuleResponsibility getResponsibility(int index) { |
230 | 0 | while (getResponsibilities().size() <= index) { |
231 | 0 | RuleResponsibility ruleResponsibility = new RuleResponsibility(); |
232 | 0 | ruleResponsibility.setRuleBaseValues(this); |
233 | 0 | getResponsibilities().add(ruleResponsibility); |
234 | 0 | } |
235 | 0 | return (RuleResponsibility) getResponsibilities().get(index); |
236 | |
} |
237 | |
|
238 | |
public RuleExtension getRuleExtension(int index) { |
239 | 0 | while (getRuleExtensions().size() <= index) { |
240 | 0 | getRuleExtensions().add(new RuleExtension()); |
241 | |
} |
242 | 0 | return (RuleExtension) getRuleExtensions().get(index); |
243 | |
} |
244 | |
|
245 | |
public RuleExtensionValue getRuleExtensionValue(String key) { |
246 | 0 | for (Iterator iter = getRuleExtensions().iterator(); iter.hasNext();) { |
247 | 0 | RuleExtension ruleExtension = (RuleExtension) iter.next(); |
248 | 0 | for (Iterator iterator = ruleExtension.getExtensionValues().iterator(); iterator.hasNext();) { |
249 | 0 | RuleExtensionValue ruleExtensionValue = (RuleExtensionValue) iterator.next(); |
250 | 0 | if (ruleExtensionValue.getKey().equals(key)) { |
251 | 0 | return ruleExtensionValue; |
252 | |
} |
253 | 0 | } |
254 | 0 | } |
255 | 0 | return null; |
256 | |
} |
257 | |
|
258 | |
public RuleExtensionValue getRuleExtensionValue(Long ruleTemplateAttributeId, String key) { |
259 | 0 | for (Iterator iter = getRuleExtensions().iterator(); iter.hasNext();) { |
260 | 0 | RuleExtension ruleExtension = (RuleExtension) iter.next(); |
261 | 0 | if (ruleExtension.getRuleTemplateAttributeId().equals(ruleTemplateAttributeId)) { |
262 | 0 | for (Iterator iterator = ruleExtension.getExtensionValues().iterator(); iterator.hasNext();) { |
263 | 0 | RuleExtensionValue ruleExtensionValue = (RuleExtensionValue) iterator.next(); |
264 | 0 | if (ruleExtensionValue.getKey().equals(key)) { |
265 | 0 | return ruleExtensionValue; |
266 | |
} |
267 | 0 | } |
268 | |
} |
269 | 0 | } |
270 | 0 | return null; |
271 | |
} |
272 | |
|
273 | |
public Long getPreviousVersionId() { |
274 | 0 | return previousVersionId; |
275 | |
} |
276 | |
|
277 | |
public void setPreviousVersionId(Long previousVersion) { |
278 | 0 | this.previousVersionId = previousVersion; |
279 | 0 | } |
280 | |
|
281 | |
public void addRuleResponsibility(RuleResponsibility ruleResponsibility) { |
282 | 0 | addRuleResponsibility(ruleResponsibility, new Integer(getResponsibilities().size())); |
283 | 0 | } |
284 | |
|
285 | |
public void addRuleResponsibility(RuleResponsibility ruleResponsibility, Integer counter) { |
286 | 0 | boolean alreadyAdded = false; |
287 | 0 | int location = 0; |
288 | 0 | if (counter != null) { |
289 | 0 | for (Iterator responsibilitiesIter = getResponsibilities().iterator(); responsibilitiesIter.hasNext();) { |
290 | 0 | RuleResponsibility ruleResponsibilityRow = (RuleResponsibility) responsibilitiesIter.next(); |
291 | 0 | if (counter.intValue() == location) { |
292 | 0 | ruleResponsibilityRow.setPriority(ruleResponsibility.getPriority()); |
293 | 0 | ruleResponsibilityRow.setActionRequestedCd(ruleResponsibility.getActionRequestedCd()); |
294 | 0 | ruleResponsibilityRow.setVersionNumber(ruleResponsibility.getVersionNumber()); |
295 | 0 | ruleResponsibilityRow.setRuleBaseValuesId(ruleResponsibility.getRuleBaseValuesId()); |
296 | 0 | ruleResponsibilityRow.setRuleResponsibilityName(ruleResponsibility.getRuleResponsibilityName()); |
297 | 0 | ruleResponsibilityRow.setRuleResponsibilityType(ruleResponsibility.getRuleResponsibilityType()); |
298 | |
|
299 | 0 | ruleResponsibilityRow.setApprovePolicy(ruleResponsibility.getApprovePolicy()); |
300 | 0 | alreadyAdded = true; |
301 | |
} |
302 | 0 | location++; |
303 | 0 | } |
304 | |
} |
305 | 0 | if (!alreadyAdded) { |
306 | 0 | getResponsibilities().add(ruleResponsibility); |
307 | |
} |
308 | 0 | } |
309 | |
|
310 | |
public RuleTemplate getRuleTemplate() { |
311 | 0 | return ruleTemplate; |
312 | |
} |
313 | |
|
314 | |
public void setRuleTemplate(RuleTemplate ruleTemplate) { |
315 | 0 | this.ruleTemplate = ruleTemplate; |
316 | 0 | } |
317 | |
|
318 | |
public Long getRuleTemplateId() { |
319 | 0 | return ruleTemplateId; |
320 | |
} |
321 | |
|
322 | |
public void setRuleTemplateId(Long ruleTemplateId) { |
323 | 0 | this.ruleTemplateId = ruleTemplateId; |
324 | 0 | } |
325 | |
|
326 | |
public DocumentType getDocumentType() { |
327 | 0 | return KEWServiceLocator.getDocumentTypeService().findByName(getDocTypeName()); |
328 | |
} |
329 | |
|
330 | |
public String getDocTypeName() { |
331 | 0 | return docTypeName; |
332 | |
} |
333 | |
|
334 | |
public void setDocTypeName(String docTypeName) { |
335 | 0 | this.docTypeName = docTypeName; |
336 | 0 | } |
337 | |
|
338 | |
public List<RuleExtension> getRuleExtensions() { |
339 | 0 | return ruleExtensions; |
340 | |
} |
341 | |
|
342 | |
public void setRuleExtensions(List<RuleExtension> ruleExtensions) { |
343 | 0 | this.ruleExtensions = ruleExtensions; |
344 | 0 | } |
345 | |
|
346 | |
public List<RuleResponsibility> getResponsibilities() { |
347 | 0 | return responsibilities; |
348 | |
} |
349 | |
|
350 | |
public void setResponsibilities(List<RuleResponsibility> responsibilities) { |
351 | 0 | this.responsibilities = responsibilities; |
352 | 0 | } |
353 | |
|
354 | |
public RuleResponsibility getResponsibility(Long ruleResponsibilityKey) { |
355 | 0 | for (Iterator iterator = getResponsibilities().iterator(); iterator.hasNext();) { |
356 | 0 | RuleResponsibility responsibility = (RuleResponsibility) iterator.next(); |
357 | 0 | if (responsibility.getRuleResponsibilityKey() != null |
358 | |
&& responsibility.getRuleResponsibilityKey().equals(ruleResponsibilityKey)) { |
359 | 0 | return responsibility; |
360 | |
} |
361 | 0 | } |
362 | 0 | return null; |
363 | |
} |
364 | |
|
365 | |
public void removeResponsibility(int index) { |
366 | 0 | getResponsibilities().remove(index); |
367 | 0 | } |
368 | |
|
369 | |
public Boolean getActiveInd() { |
370 | 0 | return activeInd; |
371 | |
} |
372 | |
|
373 | |
public void setActiveInd(Boolean activeInd) { |
374 | 0 | this.activeInd = activeInd; |
375 | 0 | } |
376 | |
|
377 | |
public String getActiveIndDisplay() { |
378 | 0 | if (getActiveInd() == null) { |
379 | 0 | return KEWConstants.INACTIVE_LABEL_LOWER; |
380 | |
} |
381 | 0 | return CodeTranslator.getActiveIndicatorLabel(getActiveInd()); |
382 | |
} |
383 | |
|
384 | |
public Boolean getCurrentInd() { |
385 | 0 | return currentInd; |
386 | |
} |
387 | |
|
388 | |
public void setCurrentInd(Boolean currentInd) { |
389 | 0 | this.currentInd = currentInd; |
390 | 0 | } |
391 | |
|
392 | |
public Timestamp getFromDate() { |
393 | 0 | return fromDate; |
394 | |
} |
395 | |
|
396 | |
public void setFromDate(Timestamp fromDate) { |
397 | 0 | this.fromDate = fromDate; |
398 | 0 | } |
399 | |
|
400 | |
public String getDescription() { |
401 | 0 | return description; |
402 | |
} |
403 | |
|
404 | |
public void setDescription(String description) { |
405 | 0 | this.description = description; |
406 | 0 | } |
407 | |
|
408 | |
public Long getRuleBaseValuesId() { |
409 | 0 | return ruleBaseValuesId; |
410 | |
} |
411 | |
|
412 | |
public void setRuleBaseValuesId(Long ruleBaseValuesId) { |
413 | 0 | this.ruleBaseValuesId = ruleBaseValuesId; |
414 | 0 | } |
415 | |
|
416 | |
public Timestamp getToDate() { |
417 | 0 | return toDate; |
418 | |
} |
419 | |
|
420 | |
public void setToDate(Timestamp toDate) { |
421 | 0 | this.toDate = toDate; |
422 | 0 | } |
423 | |
|
424 | |
public Integer getVersionNbr() { |
425 | 0 | return versionNbr; |
426 | |
} |
427 | |
|
428 | |
public void setVersionNbr(Integer versionNbr) { |
429 | 0 | this.versionNbr = versionNbr; |
430 | 0 | } |
431 | |
|
432 | |
public Object copy(boolean preserveKeys) { |
433 | 0 | RuleBaseValues ruleBaseValuesClone = new RuleBaseValues(); |
434 | |
|
435 | 0 | if (preserveKeys && (ruleBaseValuesId != null)) { |
436 | 0 | ruleBaseValuesClone.setRuleBaseValuesId(new Long(ruleBaseValuesId.longValue())); |
437 | |
} |
438 | 0 | if (routeHeaderId != null) { |
439 | 0 | ruleBaseValuesClone.setRouteHeaderId(new Long(routeHeaderId.longValue())); |
440 | |
} |
441 | 0 | if (forceAction != null) { |
442 | 0 | ruleBaseValuesClone.setForceAction(new Boolean(forceAction.booleanValue())); |
443 | |
} |
444 | 0 | if (activeInd != null) { |
445 | 0 | ruleBaseValuesClone.setActiveInd(new Boolean(activeInd.booleanValue())); |
446 | |
} |
447 | 0 | if (currentInd != null) { |
448 | 0 | ruleBaseValuesClone.setCurrentInd(new Boolean(currentInd.booleanValue())); |
449 | |
} |
450 | 0 | if (docTypeName != null) { |
451 | 0 | ruleBaseValuesClone.setDocTypeName(new String(docTypeName)); |
452 | |
} |
453 | 0 | if (fromDate != null) { |
454 | 0 | ruleBaseValuesClone.setFromDate(new Timestamp(fromDate.getTime())); |
455 | |
} |
456 | 0 | if (description != null) { |
457 | 0 | ruleBaseValuesClone.setDescription(new String(description)); |
458 | |
} |
459 | 0 | if (delegateRule != null) { |
460 | 0 | ruleBaseValuesClone.setDelegateRule(new Boolean(delegateRule.booleanValue())); |
461 | |
} |
462 | 0 | if ((responsibilities != null) && !responsibilities.isEmpty()) { |
463 | 0 | List responsibilityList = new ArrayList(); |
464 | |
|
465 | 0 | for (Iterator i = responsibilities.iterator(); i.hasNext();) { |
466 | 0 | RuleResponsibility responsibility = (RuleResponsibility) i.next(); |
467 | 0 | RuleResponsibility responsibilityCopy = (RuleResponsibility) responsibility.copy(false); |
468 | 0 | responsibilityCopy.setRuleBaseValues(ruleBaseValuesClone); |
469 | 0 | responsibilityList.add(responsibilityCopy); |
470 | 0 | } |
471 | 0 | ruleBaseValuesClone.setResponsibilities(responsibilityList); |
472 | |
} |
473 | |
|
474 | 0 | if ((ruleExtensions != null) && !ruleExtensions.isEmpty()) { |
475 | 0 | List<RuleExtension> ruleExtensionsList = new ArrayList<RuleExtension>(); |
476 | |
|
477 | 0 | for (Iterator i = ruleExtensions.iterator(); i.hasNext();) { |
478 | 0 | RuleExtension ruleExtension = (RuleExtension) i.next(); |
479 | 0 | RuleExtension ruleExtensionCopy = (RuleExtension) ruleExtension.copy(preserveKeys); |
480 | 0 | ruleExtensionCopy.setRuleBaseValues(ruleBaseValuesClone); |
481 | 0 | ruleExtensionsList.add(ruleExtensionCopy); |
482 | 0 | } |
483 | 0 | ruleBaseValuesClone.setRuleExtensions(ruleExtensionsList); |
484 | |
} |
485 | 0 | if (toDate != null) { |
486 | 0 | ruleBaseValuesClone.setToDate(new Timestamp(toDate.getTime())); |
487 | |
} |
488 | 0 | if (versionNbr != null) { |
489 | 0 | ruleBaseValuesClone.setVersionNbr(new Integer(versionNbr.intValue())); |
490 | |
} |
491 | 0 | ruleBaseValuesClone.setActivationDate(getActivationDate()); |
492 | 0 | ruleBaseValuesClone.setRuleTemplate(getRuleTemplate()); |
493 | 0 | return ruleBaseValuesClone; |
494 | |
} |
495 | |
|
496 | |
public String getReturnUrl() { |
497 | 0 | return returnUrl; |
498 | |
} |
499 | |
|
500 | |
public void setReturnUrl(String returnUrl) { |
501 | 0 | this.returnUrl = returnUrl; |
502 | 0 | } |
503 | |
|
504 | |
public String getFromDateString() { |
505 | 0 | if (this.fromDate != null) { |
506 | 0 | return RiceConstants.getDefaultDateFormat().format(this.fromDate); |
507 | |
} |
508 | 0 | return null; |
509 | |
} |
510 | |
|
511 | |
public String getToDateString() { |
512 | 0 | if (this.toDate != null) { |
513 | 0 | return RiceConstants.getDefaultDateFormat().format(this.toDate); |
514 | |
} |
515 | 0 | return null; |
516 | |
} |
517 | |
|
518 | |
public Boolean getForceAction() { |
519 | 0 | return forceAction; |
520 | |
} |
521 | |
|
522 | |
public void setForceAction(Boolean forceAction) { |
523 | 0 | this.forceAction = forceAction; |
524 | 0 | } |
525 | |
|
526 | |
public boolean isActive(Date date) { |
527 | 0 | boolean isAfterFromDate = getFromDate() == null || date.after(getFromDate()); |
528 | 0 | boolean isBeforeToDate = getToDate() == null || date.before(getToDate()); |
529 | 0 | return getActiveInd() && isAfterFromDate && isBeforeToDate; |
530 | |
} |
531 | |
|
532 | |
public boolean isMatch(DocumentContent docContent) { |
533 | 0 | for (Iterator iter = getRuleTemplate().getActiveRuleTemplateAttributes().iterator(); iter.hasNext();) { |
534 | 0 | RuleTemplateAttribute ruleTemplateAttribute = (RuleTemplateAttribute) iter.next(); |
535 | 0 | if (!ruleTemplateAttribute.isWorkflowAttribute()) { |
536 | 0 | continue; |
537 | |
} |
538 | 0 | WorkflowAttribute routingAttribute = (WorkflowAttribute) ruleTemplateAttribute.getWorkflowAttribute(); |
539 | |
|
540 | 0 | RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute(); |
541 | 0 | if (ruleAttribute.getType().equals(KEWConstants.RULE_XML_ATTRIBUTE_TYPE)) { |
542 | 0 | ((GenericXMLRuleAttribute) routingAttribute).setRuleAttribute(ruleAttribute); |
543 | |
} |
544 | 0 | String className = ruleAttribute.getClassName(); |
545 | 0 | List<RuleExtension> editedRuleExtensions = new ArrayList<RuleExtension>(); |
546 | 0 | for (Iterator iter2 = getRuleExtensions().iterator(); iter2.hasNext();) { |
547 | 0 | RuleExtension extension = (RuleExtension) iter2.next(); |
548 | 0 | if (extension.getRuleTemplateAttribute().getRuleAttribute().getClassName().equals(className)) { |
549 | 0 | editedRuleExtensions.add(extension); |
550 | |
} |
551 | 0 | } |
552 | 0 | if (!routingAttribute.isMatch(docContent, editedRuleExtensions)) { |
553 | 0 | return false; |
554 | |
} |
555 | 0 | } |
556 | 0 | return true; |
557 | |
} |
558 | |
|
559 | |
public RuleResponsibility findResponsibility(String roleName) { |
560 | 0 | for (Iterator iter = getResponsibilities().iterator(); iter.hasNext();) { |
561 | 0 | RuleResponsibility resp = (RuleResponsibility) iter.next(); |
562 | 0 | if (KEWConstants.RULE_RESPONSIBILITY_ROLE_ID.equals(resp.getRuleResponsibilityType()) |
563 | |
&& roleName.equals(resp.getRuleResponsibilityName())) { |
564 | 0 | return resp; |
565 | |
} |
566 | 0 | } |
567 | 0 | return null; |
568 | |
} |
569 | |
|
570 | |
public Long getRouteHeaderId() { |
571 | 0 | return routeHeaderId; |
572 | |
} |
573 | |
|
574 | |
public void setRouteHeaderId(Long routeHeaderId) { |
575 | 0 | this.routeHeaderId = routeHeaderId; |
576 | 0 | } |
577 | |
|
578 | |
public Boolean getDelegateRule() { |
579 | 0 | return delegateRule; |
580 | |
} |
581 | |
|
582 | |
public void setDelegateRule(Boolean isDelegateRule) { |
583 | 0 | this.delegateRule = isDelegateRule; |
584 | 0 | } |
585 | |
|
586 | |
public Timestamp getActivationDate() { |
587 | 0 | return activationDate; |
588 | |
} |
589 | |
|
590 | |
public void setActivationDate(Timestamp activationDate) { |
591 | 0 | this.activationDate = activationDate; |
592 | 0 | } |
593 | |
|
594 | |
public MyColumns getMyColumns() { |
595 | 0 | return myColumns; |
596 | |
} |
597 | |
|
598 | |
public void setMyColumns(MyColumns additionalColumns) { |
599 | 0 | this.myColumns = additionalColumns; |
600 | 0 | } |
601 | |
|
602 | |
public String getDestinationUrl() { |
603 | 0 | return destinationUrl; |
604 | |
} |
605 | |
|
606 | |
public void setDestinationUrl(String destinationUrl) { |
607 | 0 | this.destinationUrl = destinationUrl; |
608 | 0 | } |
609 | |
|
610 | |
public Timestamp getDeactivationDate() { |
611 | 0 | return deactivationDate; |
612 | |
} |
613 | |
|
614 | |
public void setDeactivationDate(Timestamp deactivationDate) { |
615 | 0 | this.deactivationDate = deactivationDate; |
616 | 0 | } |
617 | |
|
618 | |
|
619 | |
|
620 | |
|
621 | |
public Boolean getTemplateRuleInd() { |
622 | 0 | return templateRuleInd; |
623 | |
} |
624 | |
|
625 | |
|
626 | |
|
627 | |
|
628 | |
public void setTemplateRuleInd(Boolean templateRuleInd) { |
629 | 0 | this.templateRuleInd = templateRuleInd; |
630 | 0 | } |
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
public String getName() { |
637 | 0 | return name; |
638 | |
} |
639 | |
|
640 | |
|
641 | |
|
642 | |
|
643 | |
|
644 | |
public void setName(String name) { |
645 | 0 | this.name = name; |
646 | 0 | } |
647 | |
|
648 | |
public List<PersonRuleResponsibility> getPersonResponsibilities() { |
649 | 0 | return this.personResponsibilities; |
650 | |
} |
651 | |
|
652 | |
public void setPersonResponsibilities(List<PersonRuleResponsibility> personResponsibilities) { |
653 | 0 | this.personResponsibilities = personResponsibilities; |
654 | 0 | } |
655 | |
|
656 | |
public List<GroupRuleResponsibility> getGroupResponsibilities() { |
657 | 0 | return this.groupResponsibilities; |
658 | |
} |
659 | |
|
660 | |
public void setGroupResponsibilities(List<GroupRuleResponsibility> groupResponsibilities) { |
661 | 0 | this.groupResponsibilities = groupResponsibilities; |
662 | 0 | } |
663 | |
|
664 | |
public List<RoleRuleResponsibility> getRoleResponsibilities() { |
665 | 0 | return this.roleResponsibilities; |
666 | |
} |
667 | |
|
668 | |
public void setRoleResponsibilities(List<RoleRuleResponsibility> roleResponsibilities) { |
669 | 0 | this.roleResponsibilities = roleResponsibilities; |
670 | 0 | } |
671 | |
|
672 | |
|
673 | |
|
674 | |
|
675 | |
public Map<String, String> getFieldValues() { |
676 | 0 | return this.fieldValues; |
677 | |
} |
678 | |
|
679 | |
|
680 | |
|
681 | |
|
682 | |
public void setFieldValues(Map<String, String> fieldValues) { |
683 | 0 | this.fieldValues = fieldValues; |
684 | 0 | } |
685 | |
|
686 | |
@Override |
687 | |
protected LinkedHashMap<String, Object> toStringMapper() { |
688 | 0 | LinkedHashMap<String, Object> mapper = new LinkedHashMap<String, Object>(); |
689 | 0 | mapper.put("ruleBaseValuesId", ruleBaseValuesId); |
690 | 0 | mapper.put("description", description); |
691 | 0 | mapper.put("docTypeName", docTypeName); |
692 | 0 | mapper.put("routeHeaderId", routeHeaderId); |
693 | 0 | mapper.put("delegateRule", delegateRule); |
694 | 0 | mapper.put("forceAction", forceAction); |
695 | 0 | mapper.put("activeInd", activeInd); |
696 | 0 | mapper.put("currentInd", currentInd); |
697 | 0 | mapper.put("versionNbr", versionNbr); |
698 | 0 | mapper.put("previousVersionId", previousVersionId); |
699 | 0 | mapper.put("ruleTemplateId", ruleTemplateId); |
700 | 0 | mapper.put("returnUrl", returnUrl); |
701 | 0 | mapper.put("responsibilities", responsibilities == null ? responsibilities : "size: " + responsibilities.size()); |
702 | 0 | return mapper; |
703 | |
} |
704 | |
|
705 | |
public String getGroupReviewerName() { |
706 | 0 | return this.groupReviewerName; |
707 | |
} |
708 | |
|
709 | |
public String getGroupReviewerNamespace() { |
710 | 0 | return this.groupReviewerNamespace; |
711 | |
} |
712 | |
|
713 | |
public String getPersonReviewer() { |
714 | 0 | return this.personReviewer; |
715 | |
} |
716 | |
|
717 | |
public void setGroupReviewerName(String groupReviewerName) { |
718 | 0 | this.groupReviewerName = groupReviewerName; |
719 | 0 | } |
720 | |
|
721 | |
public void setGroupReviewerNamespace(String groupReviewerNamespace) { |
722 | 0 | this.groupReviewerNamespace = groupReviewerNamespace; |
723 | 0 | } |
724 | |
|
725 | |
public void setPersonReviewer(String personReviewer) { |
726 | 0 | this.personReviewer = personReviewer; |
727 | 0 | } |
728 | |
|
729 | |
public GroupImpl getKimGroupImpl() { |
730 | 0 | return new GroupImpl(); |
731 | |
} |
732 | |
|
733 | |
public PersonImpl getPersonImpl() { |
734 | 0 | return new PersonImpl(); |
735 | |
} |
736 | |
|
737 | |
public String getPersonReviewerType() { |
738 | 0 | return this.personReviewerType; |
739 | |
} |
740 | |
|
741 | |
public void setPersonReviewerType(String personReviewerType) { |
742 | 0 | this.personReviewerType = personReviewerType; |
743 | 0 | } |
744 | |
} |