View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.lum.common.client.widgets;
17  
18  import java.util.Collections;
19  import java.util.Date;
20  import java.util.HashSet;
21  import java.util.Set;
22  
23  import org.kuali.student.r1.common.assembly.data.Data;
24  import org.kuali.student.r1.common.assembly.helper.PropertyEnum;
25  import org.kuali.student.lum.common.client.lo.MetaInfoHelper;
26  
27  public class CluSetHelper {
28  
29  private final static Set<String> properties = new HashSet<String>();
30      
31      public static Set<String> getProperties(){
32          return Collections.unmodifiableSet(properties);
33      }
34  
35      public enum Properties implements PropertyEnum
36      {
37          ID ("id"),
38          ORGANIZATION ("organization"),
39          DESCRIPTION ("description"),
40          EFFECTIVE_DATE ("effectiveDate"),
41          EXPIRATION_DATE ("expirationDate"),
42          APPROVED_CLUS ("approvedClus"),
43          PROPOSED_CLUS ("proposedClus"),
44          // This is the union of APPROVED_CLUS, and PROPOSED_CLUS
45          ALL_CLUS ("allClus"),
46          CLUSETS ("clusets"),
47          CLU_SET_RANGE ("clusetRange"),
48          CLU_SET_RANGE_VIEW_DETAILS ("cluSetRangeViewDetails"),
49          META_INFO ("meta"),
50          NAME ("name"),
51          STATE ("state"),
52          TYPE ("type"),
53          REUSABLE ("reusable"),
54          REFERENCEABLE ("referenceable");
55  
56          private final String key;
57  
58          private Properties (final String key) {
59              this.key = key;
60              properties.add(key);
61          }
62  
63          @Override
64          public String getKey() {
65              return this.key;
66          }
67      }
68      private Data data;
69  
70      public CluSetHelper(Data data) {
71          this.data = data;
72      }
73  
74      public static CluSetHelper wrap(Data data) {
75          if (data == null) {
76              return null;
77          }
78          return new CluSetHelper(data);
79      }
80  
81      public Data getData() {
82          return this.data;
83      }
84  
85      public void setId(String value) {
86          data.set(Properties.ID.getKey(), value);
87      }
88  
89      public String getId() {
90          return (String) data.get(Properties.ID.getKey());
91      }
92  
93      public void setOrganization(String value) {
94          data.set(Properties.ORGANIZATION.getKey(), value);
95      }
96      public String getOrganization() {
97          return (String) data.get(Properties.ORGANIZATION.getKey());
98      }
99  
100     public void setDescription(String value) {
101         data.set(Properties.DESCRIPTION.getKey(), value);
102     }
103     public String getDescription() {
104         return (String) data.get (Properties.DESCRIPTION.getKey ());
105     }
106 
107     public void setEffectiveDate(Date value) {
108         data.set(Properties.EFFECTIVE_DATE.getKey(), value);
109     }
110     public Date getEffectiveDate() {
111         return (Date) data.get(Properties.EFFECTIVE_DATE.getKey());
112     }
113 
114     public void setExpirationDate(Date value) {
115         data.set(Properties.EXPIRATION_DATE.getKey(), value);
116     }
117     public Date getExpirationDate() {
118         return (Date) data.get(Properties.EXPIRATION_DATE.getKey());
119     }
120 
121     public void setMetaInfo (MetaInfoHelper value) {
122         data.set (Properties.META_INFO.getKey (), (value == null) ? null : value.getData ());
123     }
124     public MetaInfoHelper getMetaInfo () {
125         return MetaInfoHelper.wrap ((Data) data.get (Properties.META_INFO.getKey ()));
126     }
127 
128     public void setName(String name) {
129         data.set(Properties.NAME.getKey(), name);
130     }
131     public String getName() {
132         return (String) data.get(Properties.NAME.getKey());
133     }
134 
135     public void setState(String state) {
136         data.set(Properties.STATE.getKey(), state);
137     }
138     public String getState() {
139         return (String) data.get(Properties.STATE.getKey());
140     }
141 
142     public void setType(String type) {
143         data.set(Properties.TYPE.getKey(), type);
144     }
145     public String getType() {
146         return (String) data.get(Properties.TYPE.getKey());
147     }
148 
149     public void setReusable(Boolean reusable) {
150         Boolean newValue = reusable;
151         if (reusable == null) {
152             newValue = new Boolean(false);
153         }
154         data.set(Properties.REUSABLE.getKey(), newValue);
155     }
156     public Boolean getReusable() {
157         Boolean reUsable = (Boolean) data.get(Properties.REUSABLE.getKey());
158         if (reUsable == null) {
159             reUsable = new Boolean(false);
160         }
161         return reUsable;
162     }
163 
164     public void setReferenceable(Boolean referenceable) {
165         Boolean newValue = referenceable;
166         if (referenceable == null) {
167             newValue = new Boolean(false);
168         }
169         data.set(Properties.REFERENCEABLE.getKey(), newValue);
170     }
171     public Boolean getReferenceable() {
172         Boolean referenceable = (Boolean) data.get(Properties.REFERENCEABLE.getKey());
173         if (referenceable == null) {
174             referenceable = new Boolean(false);
175         }
176         return referenceable;
177     }
178 
179     public void setApprovedClus(Data value) {
180         data.set(Properties.APPROVED_CLUS.getKey(), value);
181     }
182     public Data getApprovedClus() {
183         Data approvedClusData = data.get(Properties.APPROVED_CLUS.getKey());
184         if (approvedClusData == null) {
185             approvedClusData = new Data();
186             setApprovedClus(approvedClusData);
187         }
188         return approvedClusData;
189     }
190     public void setProposedClus(Data value) {
191         data.set(Properties.PROPOSED_CLUS.getKey(), value);
192     }
193     public Data getProposedClus() {
194         Data proposedClusData = data.get(Properties.PROPOSED_CLUS.getKey());
195         if (proposedClusData == null) {
196             proposedClusData = new Data();
197             setProposedClus(proposedClusData);
198         }
199         return proposedClusData;
200     }
201     public void setAllClus(Data value) {
202         data.set(Properties.ALL_CLUS.getKey(), value);
203     }
204     public Data getAllClus() {
205         Data allClusData = data.get(Properties.ALL_CLUS.getKey());
206         if (allClusData == null) {
207             allClusData = new Data();
208             setAllClus(allClusData);
209         }
210         return allClusData;
211     }
212     public void setCluSets(Data value) {
213         data.set(Properties.CLUSETS.getKey(), value);
214     }
215     public Data getCluSets() {
216         Data cluSetData = data.get(Properties.CLUSETS.getKey());
217         if (cluSetData == null) {
218             cluSetData = new Data();
219             setCluSets(cluSetData);
220         }
221         return cluSetData;
222     }
223     public void setCluRangeParams(Data value) {
224         data.set(Properties.CLU_SET_RANGE.getKey(), value);
225     }
226     public CluSetRangeHelper getCluRangeParams() {
227         Data cluRangeParamsData = data.get(Properties.CLU_SET_RANGE.getKey());
228         if (cluRangeParamsData == null) {
229             cluRangeParamsData = new Data();
230             setCluRangeParams(cluRangeParamsData);
231         }
232         return new CluSetRangeHelper(cluRangeParamsData);
233     }
234     public void setCluRangeViewDetails(Data value) {
235         data.set(Properties.CLU_SET_RANGE_VIEW_DETAILS.getKey(), value);
236     }
237     public Data getCluRangeViewDetails() {
238         Data cluSetRangeViewDetailsData = data.get(Properties.CLU_SET_RANGE_VIEW_DETAILS.getKey());
239         if (cluSetRangeViewDetailsData == null) {
240             cluSetRangeViewDetailsData = new Data();
241             setCluRangeViewDetails(cluSetRangeViewDetailsData);
242         }
243         return cluSetRangeViewDetailsData;
244     }
245 
246 }