View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation Licensed under the Educational
3    * Community License, Version 2.0 (the "License"); you may not use
4    * this file except in compliance with the License. You may obtain a
5    * 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, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12   * 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.ArrayList;
20  import java.util.List;
21  
22  import javax.xml.bind.annotation.XmlAccessType;
23  import javax.xml.bind.annotation.XmlAccessorType;
24  import javax.xml.bind.annotation.XmlAnyElement;
25  import javax.xml.bind.annotation.XmlElement;
26  import javax.xml.bind.annotation.XmlType;
27  
28  import org.kuali.student.enrollment.acal.infc.HolidayCalendar;
29  import org.kuali.student.r2.common.dto.IdEntityInfo;
30  import org.w3c.dom.Element;
31  
32  @XmlAccessorType(XmlAccessType.FIELD)
33  @XmlType(name = "HolidayCalendarInfo", propOrder = { 
34                  "id", "typeKey", "stateKey", "name", "descr", 
35                  "campusKeys", "adminOrgId", "startDate", "endDate", 
36                  "meta", "attributes", "_futureElements" })
37  
38  public class HolidayCalendarInfo 
39      extends IdEntityInfo 
40      implements HolidayCalendar, Serializable {
41      
42      private static final long serialVersionUID = 1L;
43  
44      @XmlElement
45      private List<String> campusKeys;
46  
47      @XmlElement
48      private String adminOrgId;
49  
50      @XmlElement
51      private Date startDate;
52  	
53      @XmlElement
54      private Date endDate;
55  	
56      @XmlAnyElement
57      private List<Element> _futureElements;
58  
59  
60      /**
61       * Constructs a new HolidayCalendarInfo.
62       */
63      public HolidayCalendarInfo() {
64      }
65      
66      /**
67       * Constructs a new HolidayCalendarInfo from another
68       * HolidayCalendar.
69       * 
70       * @param holidayCalendar the Holiday Calendar to copy
71       */
72      public HolidayCalendarInfo(HolidayCalendar holidayCalendar) {
73          super(holidayCalendar);
74          if (holidayCalendar != null) {
75              if (holidayCalendar.getCampusKeys() != null) {
76                  campusKeys = new ArrayList<String>(holidayCalendar.getCampusKeys());
77              }
78              
79              this.adminOrgId = holidayCalendar.getAdminOrgId();
80              if (holidayCalendar.getStartDate() != null) {
81                  this.startDate = new Date (holidayCalendar.getStartDate().getTime());
82              }
83  
84              if (holidayCalendar.getEndDate() != null) {
85                  this.endDate = new Date(holidayCalendar.getEndDate().getTime());
86              }
87          }
88      }
89  
90      @Override
91      public List<String> getCampusKeys() {
92          if (campusKeys == null) {
93              campusKeys = new ArrayList<String>();
94          }
95  
96          return campusKeys;
97      }
98  
99      public void setCampusKeys(List<String> campusKeys) {
100         this.campusKeys = campusKeys;
101     }
102 
103     @Override
104     public String getAdminOrgId() {
105         return adminOrgId;
106     }
107 
108     public void setAdminOrgId(String adminOrgId) {
109         this.adminOrgId = adminOrgId;
110     }
111 
112     @Override
113     public Date getStartDate() {
114         return startDate;
115     }
116     
117     public void setStartDate(Date startDate) {
118         this.startDate = startDate;
119     }
120     
121     @Override
122     public Date getEndDate() {
123         return endDate;
124     }
125     
126     public void setEndDate(Date endDate) {
127         this.endDate = endDate;
128     }
129 }