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 public MyRules() {
39 rules = new ArrayList();
40 }
41
42 public void addRule(RuleBaseValues rule, Integer counter) {
43 boolean alreadyAdded = false;
44 int location = 0;
45 for (Iterator ruleIter = getRules().iterator(); ruleIter.hasNext();) {
46 RuleBaseValues ruleRow = (RuleBaseValues) ruleIter.next();
47
48 if (counter != null && counter.intValue() == location) {
49 ruleRow.setActiveInd(rule.getActiveInd());
50 ruleRow.setCurrentInd(rule.getCurrentInd());
51 ruleRow.setVersionNumber(rule.getVersionNumber());
52 ruleRow.setDescription(rule.getDescription());
53 ruleRow.setForceAction(rule.getForceAction());
54 ruleRow.setDocTypeName(rule.getDocTypeName());
55 ruleRow.setFromDate(rule.getFromDate());
56 ruleRow.setToDate(rule.getToDate());
57 ruleRow.setRuleTemplate(rule.getRuleTemplate());
58 ruleRow.setVersionNbr(rule.getVersionNbr());
59 ruleRow.setResponsibilities(rule.getResponsibilities());
60 ruleRow.setRuleExtensions(rule.getRuleExtensions());
61
62 alreadyAdded = true;
63 }
64 location++;
65 }
66 if (!alreadyAdded) {
67 getRules().add(rule);
68 }
69 }
70
71 public RuleBaseValues getRule(int index) {
72 while (getRules().size() <= index) {
73 RuleBaseValues rule = new RuleBaseValues();
74
75 getRules().add(rule);
76 }
77 return (RuleBaseValues) getRules().get(index);
78 }
79
80 public List getRules() {
81 return rules;
82 }
83
84 public void setRules(List rules) {
85 this.rules = rules;
86 }
87 }