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" }) TODO KSCM-372: Non-GWT translatable code
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  //    TODO KSCM-372: Non-GWT translatable code
57  //    @XmlAnyElement
58  //    private List<Element> _futureElements;
59  
60      public CluResultInfo() {
61  
62      }
63  
64      public CluResultInfo(CluResult cluResult) {
65          super(cluResult);
66          if (null != cluResult) {
67              this.cluId = cluResult.getCluId();
68              this.resultOptions = new ArrayList<ResultOptionInfo>();
69              for (ResultOption resultOption : cluResult.getResultOptions()) {
70                  this.resultOptions.add(new ResultOptionInfo(resultOption));
71              }
72              this.effectiveDate = (null != cluResult.getEffectiveDate()) ? new Date(cluResult.getEffectiveDate().getTime()) : null;
73              this.expirationDate = (null != cluResult.getExpirationDate()) ? new Date(cluResult.getExpirationDate().getTime()) : null;
74          }
75      }
76  
77      @Override
78      public String getCluId() {
79          return cluId;
80      }
81  
82      public void setCluId(String cluId) {
83          this.cluId = cluId;
84      }
85  
86      @Override
87      public RichTextInfo getDescr() {
88          return descr;
89      }
90  
91      public void setDescr(RichTextInfo descr) {
92          this.descr = descr;
93      }
94  
95      @Override
96      public List<ResultOptionInfo> getResultOptions() {
97          if (resultOptions == null) {
98              resultOptions = new ArrayList<ResultOptionInfo>(0);
99          }
100         return resultOptions;
101     }
102 
103     public void setResultOptions(List<ResultOptionInfo> resultOptions) {
104         this.resultOptions = resultOptions;
105     }
106 
107     @Override
108     public Date getEffectiveDate() {
109         return effectiveDate;
110     }
111 
112     public void setEffectiveDate(Date effectiveDate) {
113         this.effectiveDate = effectiveDate;
114     }
115 
116     @Override
117     public Date getExpirationDate() {
118         return expirationDate;
119     }
120 
121     public void setExpirationDate(Date expirationDate) {
122         this.expirationDate = expirationDate;
123     }
124 
125     @Override
126     public String toString() {
127         return "CluResultInfo[id=" + this.getId() + ", cluId=" + this.getCluId() + ", type=" + this.getTypeKey() + "]";
128     }
129 }