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.HashMap; |
22 | |
import java.util.Iterator; |
23 | |
import java.util.List; |
24 | |
import java.util.Map; |
25 | |
|
26 | |
import org.kuali.rice.kew.rule.web.WebRuleBaseValues; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public class MyRules2 implements Serializable { |
38 | |
|
39 | |
private static final long serialVersionUID = -5405951937698910224L; |
40 | 0 | private List rules = new ArrayList(); |
41 | |
|
42 | |
public void addRule(WebRuleBaseValues rule) { |
43 | 0 | addRule(rule, new Integer(rules.size())); |
44 | 0 | } |
45 | |
|
46 | |
|
47 | |
|
48 | |
public void addRule(WebRuleBaseValues rule, Integer counter) { |
49 | 0 | boolean alreadyAdded = false; |
50 | 0 | int location = 0; |
51 | 0 | for (Iterator ruleIter = getRules().iterator(); ruleIter.hasNext();) { |
52 | 0 | WebRuleBaseValues ruleRow = (WebRuleBaseValues)ruleIter.next(); |
53 | |
|
54 | 0 | if (counter != null && counter.intValue() == location) { |
55 | 0 | ruleRow.setActiveInd(rule.getActiveInd()); |
56 | 0 | ruleRow.setCurrentInd(rule.getCurrentInd()); |
57 | 0 | ruleRow.setVersionNumber(rule.getVersionNumber()); |
58 | 0 | ruleRow.setDescription(rule.getDescription()); |
59 | 0 | ruleRow.setForceAction(rule.getForceAction()); |
60 | 0 | ruleRow.setDocTypeName(rule.getDocTypeName()); |
61 | 0 | ruleRow.setFromDate(rule.getFromDate()); |
62 | 0 | ruleRow.setToDate(rule.getToDate()); |
63 | 0 | ruleRow.setRuleTemplate(rule.getRuleTemplate()); |
64 | 0 | ruleRow.setVersionNbr(rule.getVersionNbr()); |
65 | 0 | ruleRow.setResponsibilities(rule.getResponsibilities()); |
66 | 0 | ruleRow.setRuleExtensions(rule.getRuleExtensions()); |
67 | |
|
68 | 0 | alreadyAdded = true; |
69 | |
} |
70 | 0 | location++; |
71 | 0 | } |
72 | 0 | if (!alreadyAdded) { |
73 | 0 | getRules().add(rule); |
74 | |
} |
75 | 0 | } |
76 | |
|
77 | |
public WebRuleBaseValues getRule(int index) { |
78 | 0 | while (getRules().size() <= index) { |
79 | 0 | addRule(new WebRuleBaseValues()); |
80 | |
} |
81 | 0 | return (WebRuleBaseValues) getRules().get(index); |
82 | |
} |
83 | |
|
84 | |
|
85 | |
public List getRules() { |
86 | 0 | return rules; |
87 | |
} |
88 | |
|
89 | |
public void setRules(List rules) { |
90 | 0 | this.rules = rules; |
91 | 0 | } |
92 | |
|
93 | |
public int getSize() { |
94 | 0 | return getRules().size(); |
95 | |
} |
96 | |
|
97 | 0 | public static class MyRule implements Serializable{ |
98 | |
|
99 | |
private static final long serialVersionUID = 1531326501498462883L; |
100 | |
private RuleBaseValues rule; |
101 | 0 | private List ruleTemplateAttributes = new ArrayList(); |
102 | 0 | private Map fields = new HashMap(); |
103 | 0 | private List roles = new ArrayList(); |
104 | |
private String fromDate; |
105 | |
private String toDate; |
106 | |
|
107 | |
public MyRule() { |
108 | 0 | this(new RuleBaseValues()); |
109 | 0 | } |
110 | 0 | public MyRule(RuleBaseValues rule) { |
111 | 0 | this.rule = rule; |
112 | 0 | } |
113 | |
public Map getFields() { |
114 | 0 | return fields; |
115 | |
} |
116 | |
public void setFields(Map fields) { |
117 | 0 | this.fields = fields; |
118 | 0 | } |
119 | |
public RuleBaseValues getRule() { |
120 | 0 | return rule; |
121 | |
} |
122 | |
public void setRule(RuleBaseValues rule) { |
123 | 0 | this.rule = rule; |
124 | 0 | } |
125 | |
public List getRuleTemplateAttributes() { |
126 | 0 | return ruleTemplateAttributes; |
127 | |
} |
128 | |
public void setRuleTemplateAttributes(List ruleTemplateAttributes) { |
129 | 0 | this.ruleTemplateAttributes = ruleTemplateAttributes; |
130 | 0 | } |
131 | |
public List getRoles() { |
132 | 0 | return roles; |
133 | |
} |
134 | |
public void setRoles(List roles) { |
135 | 0 | this.roles = roles; |
136 | 0 | } |
137 | |
|
138 | |
public String getFromDate() { |
139 | 0 | return fromDate; |
140 | |
} |
141 | |
public void setFromDate(String fromDate) { |
142 | 0 | this.fromDate = fromDate; |
143 | 0 | } |
144 | |
public String getToDate() { |
145 | 0 | return toDate; |
146 | |
} |
147 | |
public void setToDate(String toDate) { |
148 | 0 | this.toDate = toDate; |
149 | 0 | } |
150 | |
} |
151 | |
|
152 | |
} |