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.kuali.rice.krad.web.form.UifFormBase;
19  import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition;
20  import org.kuali.rice.krms.api.repository.agenda.AgendaDefinitionContract;
21  
22  import java.io.Serializable;
23  import java.util.ArrayList;
24  import java.util.List;
25  import java.util.Map;
26  
27  /**
28   * @author Kuali Student Team
29   */
30  public class AgendaEditor extends UifFormBase implements AgendaDefinitionContract, Serializable {
31  
32      private String id;
33      private String name;
34      private String typeId;
35      private String contextId;
36      private boolean active = true;
37      private String firstItemId;
38      private Map<String, String> attributes;
39      private Long versionNumber;
40      private String courseName;
41  
42      private AgendaTypeInfo agendaTypeInfo;
43      private Map<String, RuleEditor> ruleEditors;
44      private List<RuleEditor> deletedRules;
45  
46      private AgendaEditor parent;
47  
48      public AgendaEditor() {
49          super();
50      }
51  
52      public AgendaEditor(AgendaDefinition definition) {
53          this.id = definition.getId();
54          this.name = definition.getName();
55          this.typeId = definition.getTypeId();
56          this.contextId = definition.getContextId();
57          this.active = definition.isActive();
58          this.firstItemId = definition.getFirstItemId();
59          this.attributes = definition.getAttributes();
60          this.versionNumber = definition.getVersionNumber();
61      }
62  
63      public String getId() {
64          return id;
65      }
66  
67      public void setId(String id) {
68          this.id = id;
69      }
70  
71      public String getName() {
72          return name;
73      }
74  
75      public void setName(String name) {
76          this.name = name;
77      }
78  
79      public String getTypeId() {
80          return typeId;
81      }
82  
83      public void setTypeId(String typeId) {
84          this.typeId = typeId;
85      }
86  
87      public String getContextId() {
88          return contextId;
89      }
90  
91      public void setContextId(String contextId) {
92          this.contextId = contextId;
93      }
94  
95      public boolean isActive() {
96          return active;
97      }
98  
99      public void setActive(boolean active) {
100         this.active = active;
101     }
102 
103     public String getFirstItemId() {
104         return firstItemId;
105     }
106 
107     public void setFirstItemId(String firstItemId) {
108         this.firstItemId = firstItemId;
109     }
110 
111     public Map<String, String> getAttributes() {
112         return attributes;
113     }
114 
115     public void setAttributes(Map<String, String> attributes) {
116         this.attributes = attributes;
117     }
118 
119     public Long getVersionNumber() {
120         return versionNumber;
121     }
122 
123     public void setVersionNumber(Long versionNumber) {
124         this.versionNumber = versionNumber;
125     }
126 
127     public Map<String, RuleEditor> getRuleEditors() {
128         return ruleEditors;
129     }
130 
131     public void setRuleEditors(Map<String, RuleEditor> ruleEditors) {
132         this.ruleEditors = ruleEditors;
133     }
134 
135     public List<RuleEditor> getDeletedRules() {
136         if(this.deletedRules == null) {
137             return deletedRules = new ArrayList<RuleEditor>();
138         }
139         return deletedRules;
140     }
141 
142     public void setDeletedRules(List<RuleEditor> deletedRules) {
143         this.deletedRules = deletedRules;
144     }
145 
146     public String getCourseName() {
147         return courseName;
148     }
149 
150     public void setCourseName(String courseName) {
151         this.courseName = courseName;
152     }
153 
154     public AgendaTypeInfo getAgendaTypeInfo() {
155         return agendaTypeInfo;
156     }
157 
158     public void setAgendaTypeInfo(AgendaTypeInfo agendaTypeInfo) {
159         this.agendaTypeInfo = agendaTypeInfo;
160     }
161 
162     public AgendaEditor getParent() {
163         return parent;
164     }
165 
166     public void setParent(AgendaEditor parent) {
167         this.parent = parent;
168     }
169 
170     public boolean isDummyAgenda(){
171         if(this.getId()==null){
172             for(RuleEditor rule : this.getRuleEditors().values()){
173                 if(rule.isDummy()==false){
174                     return false;
175                 }
176             }
177             return true;
178         }
179         return false;
180     }
181 
182 }