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  package org.kuali.student.enrollment.acal.dto;
16  
17  import java.io.Serializable;
18  import java.util.Date;
19  import java.util.List;
20  
21  import javax.xml.bind.annotation.XmlAccessType;
22  import javax.xml.bind.annotation.XmlAccessorType;
23  import javax.xml.bind.annotation.XmlAnyElement;
24  import javax.xml.bind.annotation.XmlElement;
25  import javax.xml.bind.annotation.XmlType;
26  
27  import org.kuali.student.enrollment.acal.infc.Term;
28  import org.kuali.student.r2.common.dto.IdEntityInfo;
29  
30  import org.w3c.dom.Element;
31  
32  @XmlAccessorType(XmlAccessType.FIELD)
33  @XmlType(name = "TermInfo", propOrder = {
34                  "id", "typeKey", "stateKey", "name", "descr", 
35                  "code", "startDate", "endDate", 
36                  "meta", "attributes", "_futureElements"})
37  
38  public class TermInfo 
39      extends IdEntityInfo 
40      implements Term, Serializable {
41  
42      private static final long serialVersionUID = 1L;
43      
44      @XmlElement
45      private String code;
46      
47      @XmlElement
48      private Date startDate;
49      
50      @XmlElement
51      private Date endDate;
52      
53      @XmlAnyElement
54      private List<Element> _futureElements;
55  
56      /**
57       * Constructs a new TermInfo.
58       */
59      public TermInfo() {
60      }
61  
62      /**
63       * Constructs a new TermInfo from another Term.
64       *
65       * @param term the Term to copy
66       */
67      public TermInfo(Term term) {
68          super(term);
69  
70          if (term != null) {
71              this.code = term.getCode();
72              if (term.getStartDate() != null) {
73                  this.startDate = new Date(term.getStartDate().getTime());
74              }
75  
76              if (term.getEndDate() != null) {
77                  this.endDate = new Date(term.getEndDate().getTime());
78              }
79          }
80      }
81  
82      @Override
83      public String getCode() {
84          return code;
85      }
86      
87      public void setCode(String code) {
88          this.code = code;
89      }
90      
91      @Override
92      public Date getStartDate() {
93          return startDate;
94      }
95  
96      public void setStartDate(Date startDate) {
97          this.startDate = startDate;
98      }
99  
100     @Override
101     public Date getEndDate() {
102         return endDate;
103     }
104     
105     public void setEndDate(Date endDate) {
106         this.endDate = endDate;
107     }
108 }