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.io.Serializable; |
20 | |
import java.util.ArrayList; |
21 | |
import java.util.Iterator; |
22 | |
import java.util.List; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
public class MyRules implements Serializable { |
33 | |
|
34 | |
|
35 | |
private static final long serialVersionUID = 9178574188141418571L; |
36 | |
private List rules; |
37 | |
|
38 | 0 | public MyRules() { |
39 | 0 | rules = new ArrayList(); |
40 | 0 | } |
41 | |
|
42 | |
public void addRule(RuleBaseValues rule, Integer counter) { |
43 | 0 | boolean alreadyAdded = false; |
44 | 0 | int location = 0; |
45 | 0 | for (Iterator ruleIter = getRules().iterator(); ruleIter.hasNext();) { |
46 | 0 | RuleBaseValues ruleRow = (RuleBaseValues) ruleIter.next(); |
47 | |
|
48 | 0 | if (counter != null && counter.intValue() == location) { |
49 | 0 | ruleRow.setActiveInd(rule.getActiveInd()); |
50 | 0 | ruleRow.setCurrentInd(rule.getCurrentInd()); |
51 | 0 | ruleRow.setVersionNumber(rule.getVersionNumber()); |
52 | 0 | ruleRow.setDescription(rule.getDescription()); |
53 | 0 | ruleRow.setForceAction(rule.getForceAction()); |
54 | 0 | ruleRow.setDocTypeName(rule.getDocTypeName()); |
55 | 0 | ruleRow.setFromDate(rule.getFromDate()); |
56 | 0 | ruleRow.setToDate(rule.getToDate()); |
57 | 0 | ruleRow.setRuleTemplate(rule.getRuleTemplate()); |
58 | 0 | ruleRow.setVersionNbr(rule.getVersionNbr()); |
59 | 0 | ruleRow.setResponsibilities(rule.getResponsibilities()); |
60 | 0 | ruleRow.setRuleExtensions(rule.getRuleExtensions()); |
61 | |
|
62 | 0 | alreadyAdded = true; |
63 | |
} |
64 | 0 | location++; |
65 | 0 | } |
66 | 0 | if (!alreadyAdded) { |
67 | 0 | getRules().add(rule); |
68 | |
} |
69 | 0 | } |
70 | |
|
71 | |
public RuleBaseValues getRule(int index) { |
72 | 0 | while (getRules().size() <= index) { |
73 | 0 | RuleBaseValues rule = new RuleBaseValues(); |
74 | |
|
75 | 0 | getRules().add(rule); |
76 | 0 | } |
77 | 0 | return (RuleBaseValues) getRules().get(index); |
78 | |
} |
79 | |
|
80 | |
public List getRules() { |
81 | 0 | return rules; |
82 | |
} |
83 | |
|
84 | |
public void setRules(List rules) { |
85 | 0 | this.rules = rules; |
86 | 0 | } |
87 | |
} |