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.KeyDate;
28  import org.kuali.student.r2.common.dto.IdEntityInfo;
29  
30  import org.w3c.dom.Element;
31  
32  @XmlAccessorType(XmlAccessType.FIELD)
33  @XmlType(name = "KeyDateInfo", propOrder = { 
34                  "id", "typeKey", "stateKey", "name", "descr", 
35                  "isAllDay", "isRelativeToKeyDate", "relativeAnchorKeyDateId", 
36                  "isDateRange", "startDate", "endDate",
37  		"meta", "attributes", "_futureElements" })
38  
39  public class KeyDateInfo 
40      extends IdEntityInfo 
41      implements KeyDate, Serializable {
42  
43      private static final long serialVersionUID = 1L;
44  	
45      @XmlElement
46      private Boolean isAllDay;
47  
48      @XmlElement
49      private Boolean isRelativeToKeyDate;
50  	
51      @XmlElement
52      private String relativeAnchorKeyDateId;
53  
54      @XmlElement
55      private Boolean isDateRange;
56  	
57      @XmlElement
58      private Date startDate;
59  	
60      @XmlElement
61      private Date endDate;
62  	
63      @XmlAnyElement
64      private List<Element> _futureElements;
65  
66      /**
67       * Constructs a new KeyDateInfo.
68       */
69      public KeyDateInfo() {
70      }
71      
72      /**
73       * Constructs a new KeyDateInfo from another KeyDate.
74       * 
75       * @param keyDate the KeyDate to copy
76       */
77      public KeyDateInfo(KeyDate keyDate) {
78          super(keyDate);
79          if (keyDate != null) {
80              this.isAllDay = keyDate.getIsAllDay();
81              this.isRelativeToKeyDate = keyDate.getIsRelativeToKeyDate();
82              this.relativeAnchorKeyDateId = keyDate.getRelativeAnchorKeyDateId();
83  
84              this.isDateRange = keyDate.getIsDateRange();
85  
86              if (keyDate.getStartDate() != null) {
87                  this.startDate = new Date(keyDate.getStartDate().getTime());
88              }
89  
90              if (keyDate.getEndDate() != null) {
91                  this.endDate = new Date(keyDate.getEndDate().getTime());
92              }
93          }
94      }
95  
96      @Override
97      public Boolean getIsAllDay() {
98          return isAllDay;
99      }
100     
101     public void setIsAllDay(Boolean isAllDay) {
102         this.isAllDay = isAllDay;
103     }
104 
105     @Override
106     public Boolean getIsRelativeToKeyDate() {
107         return isRelativeToKeyDate;
108     }
109     
110     public void setIsRelativeToKeyDate(Boolean isRelativeToKeyDate) {
111         this.isRelativeToKeyDate = isRelativeToKeyDate;
112     }
113 
114     @Override
115     public String getRelativeAnchorKeyDateId() {
116         return relativeAnchorKeyDateId;
117     }
118     
119     public void setRelativeAnchorKeyDateId(String relativeAnchorKeyDateId) {
120         this.relativeAnchorKeyDateId = relativeAnchorKeyDateId;
121     }
122     
123     @Override
124     public Boolean getIsDateRange() {
125         return isDateRange;
126     }
127     
128     public void setIsDateRange(Boolean isDateRange) {
129         this.isDateRange = isDateRange;
130     }
131     
132     @Override
133     public Date getStartDate() {
134         return startDate;
135     }
136     
137     public void setStartDate(Date startDate) {
138         this.startDate = startDate;
139     }
140     
141     @Override
142     public Date getEndDate() {
143         return endDate;
144     }
145     
146     public void setEndDate(Date endDate) {
147         this.endDate = endDate;
148     }
149 }