001/**
002 * Copyright 2005-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krms.dto;
017
018import org.apache.commons.lang.StringUtils;
019import org.kuali.rice.core.api.util.tree.Tree;
020import org.kuali.rice.krad.web.form.UifFormBase;
021import org.kuali.rice.krms.dto.AgendaEditor;
022import org.kuali.rice.krms.dto.RuleEditor;
023import org.kuali.rice.krms.tree.node.CompareTreeNode;
024import org.kuali.rice.krms.tree.node.RuleEditorTreeNode;
025import org.kuali.rice.krms.tree.node.TreeNode;
026import org.kuali.student.common.util.DTOWrapperBase;
027
028import java.io.Serializable;
029import java.util.ArrayList;
030import java.util.List;
031
032/**
033 * @author Kuali Student Team
034 */
035public class RuleManagementWrapper extends DTOWrapperBase implements Serializable, RuleManager {
036
037    private String refObjectId;
038    private String viewId;
039    private String namespace;
040    private String refDiscriminatorType;
041
042    private List<AgendaEditor> agendas;
043    private RuleEditor ruleEditor;
044    private AgendaEditor agendaEditor;
045    private boolean hasOptimisticLockingError;
046
047    private Tree<CompareTreeNode, String> compareTree;
048
049    private String compareLightBoxHeader;
050
051    public String getRefObjectId() {
052        return refObjectId;
053    }
054
055    public void setRefObjectId(String refObjectId) {
056        this.refObjectId = refObjectId;
057    }
058
059    public String getViewId() {
060        return viewId;
061    }
062
063    public void setViewId(String viewId) {
064        this.viewId = viewId;
065    }
066
067    public List<AgendaEditor> getAgendas() {
068        if(agendas==null){
069            agendas = new ArrayList<AgendaEditor>();
070        }
071        return agendas;
072    }
073
074    public void setAgendas(List<AgendaEditor> agendas) {
075        this.agendas = agendas;
076    }
077
078    public Tree<CompareTreeNode, String> getCompareTree() {
079        return compareTree;
080    }
081
082    public void setCompareTree(Tree<CompareTreeNode, String> compareTree) {
083        this.compareTree = compareTree;
084    }
085
086    public RuleEditor getRuleEditor() {
087        return ruleEditor;
088    }
089
090    public void setRuleEditor(RuleEditor ruleEditor) {
091        this.ruleEditor = ruleEditor;
092    }
093
094    public AgendaEditor getAgendaEditor() {
095        return agendaEditor;
096    }
097
098    public void setAgendaEditor(AgendaEditor agendaEditor) {
099        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}