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.r2.lum.clu.dto;
17  
18  import org.kuali.student.r2.common.dto.IdNamelessEntityInfo;
19  import org.kuali.student.r2.common.dto.RichTextInfo;
20  import org.kuali.student.r2.lum.clu.infc.CluResult;
21  import org.kuali.student.r2.lum.clu.infc.ResultOption;
22  
23  //import javax.xml.bind.Element;
24  import javax.xml.bind.annotation.XmlAccessType;
25  import javax.xml.bind.annotation.XmlAccessorType;
26  import javax.xml.bind.annotation.XmlAnyElement;
27  import javax.xml.bind.annotation.XmlElement;
28  import javax.xml.bind.annotation.XmlType;
29  import java.io.Serializable;
30  import java.util.ArrayList;
31  import java.util.Date;
32  import java.util.List;
33  
34  @XmlAccessorType(XmlAccessType.FIELD)
35  @XmlType(name = "CluResultInfo", propOrder = {"id", "descr", "typeKey", "stateKey", "cluId", "resultOptions", "effectiveDate",
36          "expirationDate", "meta", "attributes", "_futureElements" }) 
37  public class CluResultInfo extends IdNamelessEntityInfo implements Serializable, CluResult {
38  
39      private static final long serialVersionUID = 1L;
40  
41      @XmlElement
42      private String cluId;
43  
44      @XmlElement
45      private RichTextInfo descr;
46  
47      @XmlElement
48      private List<ResultOptionInfo> resultOptions;
49  
50      @XmlElement
51      private Date effectiveDate;
52  
53      @XmlElement
54      private Date expirationDate;
55  
56      @XmlAnyElement
57      private List<Object> _futureElements;  
58  
59      public CluResultInfo() {
60  
61      }
62  
63      public CluResultInfo(CluResult cluResult) {
64          super(cluResult);
65          if (null != cluResult) {
66              this.cluId = cluResult.getCluId();
67              this.resultOptions = new ArrayList<ResultOptionInfo>();
68              for (ResultOption resultOption : cluResult.getResultOptions()) {
69                  this.resultOptions.add(new ResultOptionInfo(resultOption));
70              }
71              this.effectiveDate = (null != cluResult.getEffectiveDate()) ? new Date(cluResult.getEffectiveDate().getTime()) : null;
72              this.expirationDate = (null != cluResult.getExpirationDate()) ? new Date(cluResult.getExpirationDate().getTime()) : null;
73          }
74      }
75  
76      @Override
77      public String getCluId() {
78          return cluId;
79      }
80  
81      public void setCluId(String cluId) {
82          this.cluId = cluId;
83      }
84  
85      @Override
86      public RichTextInfo getDescr() {
87          return descr;
88      }
89  
90      public void setDescr(RichTextInfo descr) {
91          this.descr = descr;
92      }
93  
94      @Override
95      public List<ResultOptionInfo> getResultOptions() {
96          if (resultOptions == null) {
97              resultOptions = new ArrayList<ResultOptionInfo>(0);
98          }
99          return resultOptions;
100     }
101 
102     public void setResultOptions(List<ResultOptionInfo> resultOptions) {
103         this.resultOptions = resultOptions;
104     }
105 
106     @Override
107     public Date getEffectiveDate() {
108         return effectiveDate;
109     }
110 
111     public void setEffectiveDate(Date effectiveDate) {
112         this.effectiveDate = effectiveDate;
113     }
114 
115     @Override
116     public Date getExpirationDate() {
117         return expirationDate;
118     }
119 
120     public void setExpirationDate(Date expirationDate) {
121         this.expirationDate = expirationDate;
122     }
123 
124     @Override
125     public String toString() {
126         return "CluResultInfo[id=" + this.getId() + ", cluId=" + this.getCluId() + ", type=" + this.getTypeKey() + "]";
127     }
128 }