View Javadoc
1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krms.dto;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.rice.core.api.util.tree.Tree;
20  import org.kuali.rice.krad.web.form.UifFormBase;
21  import org.kuali.rice.krms.dto.AgendaEditor;
22  import org.kuali.rice.krms.dto.RuleEditor;
23  import org.kuali.rice.krms.tree.node.CompareTreeNode;
24  import org.kuali.rice.krms.tree.node.RuleEditorTreeNode;
25  import org.kuali.rice.krms.tree.node.TreeNode;
26  import org.kuali.student.common.util.DTOWrapperBase;
27  
28  import java.io.Serializable;
29  import java.util.ArrayList;
30  import java.util.List;
31  
32  /**
33   * @author Kuali Student Team
34   */
35  public class RuleManagementWrapper extends DTOWrapperBase implements Serializable, RuleManager {
36  
37      private String refObjectId;
38      private String viewId;
39      private String namespace;
40      private String refDiscriminatorType;
41  
42      private List<AgendaEditor> agendas;
43      private RuleEditor ruleEditor;
44      private AgendaEditor agendaEditor;
45      private boolean hasOptimisticLockingError;
46  
47      private Tree<CompareTreeNode, String> compareTree;
48  
49      private String compareLightBoxHeader;
50  
51      public String getRefObjectId() {
52          return refObjectId;
53      }
54  
55      public void setRefObjectId(String refObjectId) {
56          this.refObjectId = refObjectId;
57      }
58  
59      public String getViewId() {
60          return viewId;
61      }
62  
63      public void setViewId(String viewId) {
64          this.viewId = viewId;
65      }
66  
67      public List<AgendaEditor> getAgendas() {
68          if(agendas==null){
69              agendas = new ArrayList<AgendaEditor>();
70          }
71          return agendas;
72      }
73  
74      public void setAgendas(List<AgendaEditor> agendas) {
75          this.agendas = agendas;
76      }
77  
78      public Tree<CompareTreeNode, String> getCompareTree() {
79          return compareTree;
80      }
81  
82      public void setCompareTree(Tree<CompareTreeNode, String> compareTree) {
83          this.compareTree = compareTree;
84      }
85  
86      public RuleEditor getRuleEditor() {
87          return ruleEditor;
88      }
89  
90      public void setRuleEditor(RuleEditor ruleEditor) {
91          this.ruleEditor = ruleEditor;
92      }
93  
94      public AgendaEditor getAgendaEditor() {
95          return agendaEditor;
96      }
97  
98      public void setAgendaEditor(AgendaEditor agendaEditor) {
99          this.agendaEditor = agendaEditor;
100     }
101 
102     public Tree<RuleEditorTreeNode, String> getEditTree() {
103         if(this.getRuleEditor() == null){
104             return null;
105         }
106         return this.getRuleEditor().getEditTree();
107     }
108 
109     public Tree<TreeNode, String> getPreviewTree() {
110         if(this.getRuleEditor() == null){
111             return null;
112         }
113         return this.getRuleEditor().getPreviewTree();
114     }
115 
116     public Tree<TreeNode, String> getViewTree() {
117         if(this.getRuleEditor() == null){
118             return null;
119         }
120         return this.getRuleEditor().getViewTree();
121     }
122 
123     public void setActiveSelections(List<String> activeSelections) {
124         if (this.getRuleEditor() != null){
125             this.getRuleEditor().setActiveSelections(activeSelections);
126         }
127     }
128 
129     public List<String> getActiveSelections(){
130         if(this.getRuleEditor() == null){
131             return null;
132         }
133         return this.getRuleEditor().getActiveSelections();
134     }
135 
136     public String getSelectedKey() {
137         if(this.getRuleEditor() == null) {
138             return StringUtils.EMPTY;
139         }
140         return this.getRuleEditor().getSelectedKey();
141     }
142 
143     public void setSelectedKey(String selectedKey) {
144         if (this.getRuleEditor() != null){
145             this.getRuleEditor().setSelectedKey(selectedKey);
146         }
147     }
148 
149     public String getCutKey() {
150         if(this.getRuleEditor() == null) {
151             return StringUtils.EMPTY;
152         }
153         return this.getRuleEditor().getCutKey();
154     }
155 
156     public void setCutKey(String cutKey) {
157         if (this.getRuleEditor() != null){
158             this.getRuleEditor().setCutKey(cutKey);
159         }
160     }
161 
162     public String getCopyKey() {
163         if(this.getRuleEditor() == null) {
164             return StringUtils.EMPTY;
165         }
166         return this.getRuleEditor().getCopyKey();
167     }
168 
169     public void setCopyKey(String copyKey) {
170         if (this.getRuleEditor() != null){
171             this.getRuleEditor().setCopyKey(copyKey);
172         }
173     }
174 
175     public String getLogicArea() {
176         if(this.getRuleEditor() == null) {
177             return StringUtils.EMPTY;
178         }
179         return this.getRuleEditor().getLogicArea();
180     }
181 
182     public void setLogicArea(String logicArea) {
183         if (this.getRuleEditor() != null){
184              this.getRuleEditor().setLogicArea(logicArea);
185         }
186     }
187 
188     public String getNamespace() {
189         return namespace;
190     }
191 
192     public void setNamespace(String namespace) {
193         this.namespace = namespace;
194     }
195 
196     public String getRefDiscriminatorType() {
197         return refDiscriminatorType;
198     }
199 
200     public void setRefDiscriminatorType(String refDiscriminatorType) {
201         this.refDiscriminatorType = refDiscriminatorType;
202     }
203 
204     public String getCompareLightBoxHeader(){
205         return compareLightBoxHeader;
206     }
207 
208     public void setCompareLightBoxHeader( String compareLightBoxHeader){
209         this.compareLightBoxHeader = compareLightBoxHeader;
210     }
211 
212     public boolean hasOptimisticLockingError() {
213         return hasOptimisticLockingError;
214     }
215 
216     public void setHasOptimisticLockingError(boolean hasOptimisticLockingError) {
217         this.hasOptimisticLockingError = hasOptimisticLockingError;
218     }
219 }