View Javadoc
1   /*
2    * Copyright 2013 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  package org.kuali.student.core.ges.dto;
16  
17  import org.kuali.rice.core.api.util.type.KualiDecimal;
18  import org.kuali.student.r2.common.dto.IdNamelessEntityInfo;
19  import org.kuali.student.r2.common.exceptions.OperationFailedException;
20  import org.kuali.student.r2.common.infc.Amount;
21  import org.kuali.student.r2.common.infc.CurrencyAmount;
22  import org.kuali.student.r2.common.infc.HasEffectiveDates;
23  import org.kuali.student.r2.common.infc.TimeAmount;
24  import org.kuali.student.r2.common.infc.TimeOfDay;
25  import org.kuali.student.core.ges.infc.Value;
26  
27  
28  import javax.xml.bind.annotation.XmlAccessType;
29  import javax.xml.bind.annotation.XmlAccessorType;
30  import javax.xml.bind.annotation.XmlAnyElement;
31  import javax.xml.bind.annotation.XmlElement;
32  import javax.xml.bind.annotation.XmlType;
33  import java.util.ArrayList;
34  import java.util.Date;
35  import java.util.List;
36  
37  @XmlAccessorType(XmlAccessType.FIELD)
38  @XmlType(name = "ValueInfo", propOrder = {"id", "typeKey", "stateKey", "effectiveDate", "expirationDate",
39          "parameterKey","priority","atpId", "atpTypeKey","ruleId","orgId",
40          "populationId",
41          "cluId","socId","subjectCode",
42          "stringValue","numericValue","dateValue","booleanValue",
43          "decimalValue","amountValue","currencyAmountValue","timeAmountValue","timeOfDayValue","customValue",
44          "meta", "attributes", "_futureElements" })
45  public class ValueInfo extends IdNamelessEntityInfo implements Value, HasEffectiveDates {
46  
47      //////////////////////////////////
48      // Data Variables
49      //////////////////////////////////
50  
51      @XmlElement
52      private Date effectiveDate;
53      @XmlElement
54      private Date expirationDate;
55      @XmlElement
56      private String parameterKey;
57      @XmlElement
58      private Integer priority;
59      @XmlElement
60      private String atpId;
61      @XmlElement
62      private String atpTypeKey;
63      // private List<String> atpTypeKeys;
64      @XmlElement
65      private String ruleId;
66      @XmlElement
67      private String orgId;
68  
69      // Person Quantifiers
70      // -----------------------
71  
72      @XmlElement
73      private String populationId;
74  
75      // Course Quantifiers
76      // -----------------------
77  
78      @XmlElement
79      private String cluId;
80      @XmlElement
81      private String socId;
82      @XmlElement
83      private String subjectCode;
84  
85      // Value Variables
86      // -----------------------
87      @XmlElement
88      private String stringValue;
89      @XmlElement
90      private Long numericValue;
91      @XmlElement
92      private Date dateValue;
93      @XmlElement
94      private boolean booleanValue;
95      @XmlElement
96      private KualiDecimal decimalValue;
97      @XmlElement
98      private Amount amountValue;
99      @XmlElement
100     private CurrencyAmount currencyAmountValue;
101     @XmlElement
102     private TimeAmount timeAmountValue;
103     @XmlElement
104     private TimeOfDay timeOfDayValue;
105     @XmlElement
106     private GesCustomValueInfo customValue;
107     @XmlAnyElement
108     private List<Object> _futureElements;
109 
110     //////////////////////////////////
111     // Constructors
112     //////////////////////////////////
113 
114     public ValueInfo(){
115 
116     }
117 
118     public ValueInfo(Value value) throws OperationFailedException {
119         super(value);
120         if(value != null) {
121             parameterKey = value.getParameterKey();
122             priority = value.getPriority();
123             atpId = value.getAtpId();
124             atpTypeKey = value.getAtpTypeKey();
125             /*
126             if (value.getAtpTypeKeys().size() > 0){
127                 atpTypeKeys = new ArrayList<String>(value.getAtpTypeKeys());
128             }
129             */
130             ruleId = value.getRuleId();
131             orgId = value.getOrgId();
132 
133             if(value.getEffectiveDate() != null) {
134                 effectiveDate = new Date(value.getEffectiveDate().getTime());
135             }
136             if(value.getExpirationDate() != null) {
137                 expirationDate = new Date(value.getExpirationDate().getTime());
138             }
139 
140             populationId = value.getPopulationId();
141 
142             cluId = value.getCluId();
143             socId = value.getSocId();
144             subjectCode = value.getSubjectCode();
145 
146             stringValue = value.getStringValue();
147             numericValue = value.getNumericValue();
148             dateValue = value.getDateValue();
149             booleanValue = value.getBooleanValue();
150             decimalValue = value.getDecimalValue();
151             amountValue = value.getAmountValue();
152             currencyAmountValue = value.getCurrencyAmountValue();
153             timeAmountValue = value.getTimeAmountValue();
154             timeOfDayValue = value.getTimeOfDayValue();
155 
156             if(value.getCustomValue() != null) {
157                 customValue = new GesCustomValueInfo(value.getCustomValue());
158             }
159 
160         }
161     }
162 
163     //////////////////////////////////
164     // Getters and Setters
165     //////////////////////////////////
166 
167     @Override
168     public Date getEffectiveDate() {
169         return effectiveDate;
170     }
171 
172     public void setEffectiveDate(Date effectiveDate) {
173         this.effectiveDate = effectiveDate;
174     }
175 
176     @Override
177     public Date getExpirationDate() {
178         return expirationDate;
179     }
180 
181     public void setExpirationDate(Date expirationDate) {
182         this.expirationDate = expirationDate;
183     }
184 
185     @Override
186     public String getParameterKey() {
187         return parameterKey;
188     }
189 
190     public void setParameterKey(String parameterKey) {
191         this.parameterKey = parameterKey;
192     }
193     @Override
194     public Integer getPriority() {
195         return priority;
196     }
197 
198     public void setPriority(Integer priority) {
199         this.priority = priority;
200     }
201 
202     @Override
203     public String getAtpId() {
204         return atpId;
205     }
206 
207     public void setAtpId(String atpId) {
208         this.atpId = atpId;
209     }
210 
211     /*
212     public List<String> getAtpTypeKeys() {
213         if (atpTypeKeys == null){
214             atpTypeKeys = new ArrayList<String>();
215         }
216         return atpTypeKeys;
217     }
218 
219     public void setAtpTypeKeys(List<String> atpTypeKey) {
220         this.atpTypeKeys = atpTypeKey;
221     }
222     */
223 
224     @Override
225     public String getAtpTypeKey() {
226         return atpTypeKey;
227     }
228 
229     public void setAtpTypeKey(String atpTypeKey) {
230         this.atpTypeKey = atpTypeKey;
231     }
232 
233     @Override
234     public String getRuleId() {
235         return ruleId;
236     }
237 
238     public void setRuleId(String ruleId) {
239         this.ruleId = ruleId;
240     }
241 
242     @Override
243     public String getOrgId() {
244         return orgId;
245     }
246 
247     public void setOrgId(String orgId) {
248         this.orgId = orgId;
249     }
250 
251     @Override
252     public String getPopulationId() {
253         return populationId;
254     }
255 
256     public void setPopulationId(String populationId) {
257         this.populationId = populationId;
258     }
259 
260     public String getCluId() {
261         return cluId;
262     }
263 
264     public void setCluId(String cluId) {
265         this.cluId = cluId;
266     }
267 
268     public String getSocId() {
269         return socId;
270     }
271 
272     public void setSocId(String socId) {
273         this.socId = socId;
274     }
275 
276     public String getSubjectCode() {
277         return subjectCode;
278     }
279 
280     public void setSubjectCode(String subjectCode) {
281         this.subjectCode = subjectCode;
282     }
283 
284     @Override
285     public Boolean getBooleanValue() {
286         return booleanValue;
287     }
288 
289     public void setBooleanValue(Boolean booleanValue) {
290         this.booleanValue = booleanValue;
291     }
292 
293     @Override
294     public GesCustomValueInfo getCustomValue() {
295         return customValue;
296     }
297 
298     public void setCustomValue(GesCustomValueInfo customValue) {
299         this.customValue = customValue;
300     }
301 
302     @Override
303     public Date getDateValue() {
304         return dateValue;
305     }
306 
307     public void setDateValue(Date dateValue) {
308         this.dateValue = dateValue;
309     }
310 
311     @Override
312     public Long getNumericValue() {
313         return numericValue;
314     }
315 
316     public void setNumericValue(Long numericValue) {
317         this.numericValue = numericValue;
318     }
319 
320     @Override
321     public KualiDecimal getDecimalValue() {
322         return decimalValue;
323     }
324 
325     public void setDecimalValue(KualiDecimal decimalValue) {
326         this.decimalValue = decimalValue;
327     }
328 
329     @Override
330     public String getStringValue() {
331         return stringValue;
332     }
333 
334     public void setStringValue(String stringValue) {
335         this.stringValue = stringValue;
336     }
337 
338     @Override
339     public Amount getAmountValue() {
340         return amountValue;
341     }
342 
343     public void setAmountValue(Amount amountValue) {
344         this.amountValue = amountValue;
345     }
346 
347     @Override
348     public CurrencyAmount getCurrencyAmountValue() {
349         return currencyAmountValue;
350     }
351 
352     public void setCurrencyAmountValue(CurrencyAmount currencyAmountValue) {
353         this.currencyAmountValue = currencyAmountValue;
354     }
355 
356     @Override
357     public TimeAmount getTimeAmountValue() {
358         return timeAmountValue;
359     }
360 
361     public void setTimeAmountValue(TimeAmount timeAmountValue) {
362         this.timeAmountValue = timeAmountValue;
363     }
364 
365     @Override
366     public TimeOfDay getTimeOfDayValue() {
367         return timeOfDayValue;
368     }
369 
370     public void setTimeOfDayValue(TimeOfDay timeOfDayValue) {
371         this.timeOfDayValue = timeOfDayValue;
372     }
373 
374     public List<Object> get_futureElements() {
375         return _futureElements;
376     }
377 
378     public void set_futureElements(List<Object> _futureElements) {
379         this._futureElements = _futureElements;
380     }
381 
382 
383 }