View Javadoc

1   /*
2    * Copyright 2005-2008 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.dto;
18  
19  import java.util.Collection;
20  import java.util.Iterator;
21  
22  public class RuleDTO implements java.io.Serializable {
23      
24      private static final long serialVersionUID = -6559003022586974704L;
25  
26      private String ruleTemplateId;
27      private Boolean activeInd;
28      private String description;
29      private String docTypeName;
30      private String fromDate;
31      private String toDate;
32      private Boolean forceAction;
33      private RuleResponsibilityDTO[] ruleResponsibilities;
34      private RuleExtensionDTO[] ruleExtensions;
35      private String ruleTemplateName;
36      
37      public RuleDTO() {}
38  
39      public Boolean getActiveInd() {
40          return activeInd;
41      }
42  
43      public void setActiveInd(Boolean activeInd) {
44          this.activeInd = activeInd;
45      }
46  
47      public String getDescription() {
48          return description;
49      }
50  
51      public void setDescription(String description) {
52          this.description = description;
53      }
54  
55      public String getDocTypeName() {
56          return docTypeName;
57      }
58  
59      public void setDocTypeName(String docTypeName) {
60          this.docTypeName = docTypeName;
61      }
62  
63      public String getFromDate() {
64          return fromDate;
65      }
66  
67      public void setFromDate(String fromDate) {
68          this.fromDate = fromDate;
69      }
70  
71      public Boolean getForceAction() {
72          return forceAction;
73      }
74  
75      public void setForceAction(Boolean forceAction) {
76          this.forceAction = forceAction;
77      }
78  
79      public RuleExtensionDTO[] getRuleExtensions() {
80          return ruleExtensions;
81      }
82  
83      public void setRuleExtensions(RuleExtensionDTO[] ruleExtensions) {
84          this.ruleExtensions = ruleExtensions;
85      }
86  
87      public void addRuleExtensions(Collection<RuleExtensionDTO> additionalRuleExtensions) {
88          if (getRuleExtensions() == null) {
89              setRuleExtensions(new RuleExtensionDTO[0]);
90          }
91          RuleExtensionDTO[] newRuleExtensions = new RuleExtensionDTO[getRuleExtensions().length+additionalRuleExtensions.size()];
92          System.arraycopy(getRuleExtensions(), 0, newRuleExtensions, 0, getRuleExtensions().length);
93          int i = getRuleExtensions().length;
94          for (Iterator iter = additionalRuleExtensions.iterator(); iter.hasNext();) {
95              RuleExtensionDTO ruleExtension = (RuleExtensionDTO) iter.next();
96              newRuleExtensions[i] = ruleExtension;
97              i++;
98          }
99          setRuleExtensions(newRuleExtensions);
100     }
101     
102     public RuleResponsibilityDTO[] getRuleResponsibilities() {
103         return ruleResponsibilities;
104     }
105 
106     public void setRuleResponsibilities(RuleResponsibilityDTO[] ruleResponsibilities) {
107         this.ruleResponsibilities = ruleResponsibilities;
108     }
109 
110     public void addRuleResponsibility(RuleResponsibilityDTO ruleResponsibility) {
111         if (getRuleResponsibilities() == null) {
112             setRuleResponsibilities(new RuleResponsibilityDTO[0]);
113         }
114         RuleResponsibilityDTO[] newRuleResponsibilities = new RuleResponsibilityDTO[getRuleResponsibilities().length+1];
115         System.arraycopy(getRuleResponsibilities(), 0, newRuleResponsibilities, 0, getRuleResponsibilities().length);
116         newRuleResponsibilities[getRuleResponsibilities().length] = ruleResponsibility;
117         setRuleResponsibilities(newRuleResponsibilities);
118     }
119     
120     public String getRuleTemplateId() {
121         return ruleTemplateId;
122     }
123 
124     public void setRuleTemplateId(String ruleTemplateId) {
125         this.ruleTemplateId = ruleTemplateId;
126     }
127 
128     public String getRuleTemplateName() {
129         return ruleTemplateName;
130     }
131 
132     public void setRuleTemplateName(String ruleTemplateName) {
133         this.ruleTemplateName = ruleTemplateName;
134     }
135 
136     public String getToDate() {
137         return toDate;
138     }
139 
140     public void setToDate(String toDate) {
141         this.toDate = toDate;
142     }
143     
144     
145 }