Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CampusCalendarInfo |
|
| 1.1176470588235294;1.118 | ||||
CampusCalendarInfo$Builder |
|
| 1.1176470588235294;1.118 |
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.core.academiccalendar.dto; | |
17 | ||
18 | import java.io.Serializable; | |
19 | import java.util.Date; | |
20 | import java.util.List; | |
21 | import org.w3c.dom.Element; | |
22 | ||
23 | import javax.xml.bind.annotation.XmlAccessType; | |
24 | import javax.xml.bind.annotation.XmlAccessorType; | |
25 | import javax.xml.bind.annotation.XmlAnyElement; | |
26 | import javax.xml.bind.annotation.XmlAttribute; | |
27 | import javax.xml.bind.annotation.XmlElement; | |
28 | import javax.xml.bind.annotation.XmlType; | |
29 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |
30 | ||
31 | import org.kuali.student.common.infc.ModelBuilder; | |
32 | import org.kuali.student.r2.common.dto.KeyEntityInfo; | |
33 | import org.kuali.student.core.academiccalendar.infc.CampusCalendar; | |
34 | ||
35 | ||
36 | /** | |
37 | * Information about an campus calendar. | |
38 | * | |
39 | * @Author tom | |
40 | * @Since Tue Apr 05 14:22:34 EDT 2011 | |
41 | */ | |
42 | @XmlAccessorType(XmlAccessType.FIELD) | |
43 | @XmlType(name = "CampusCalendarInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "startDate", "endDate", "location", "holidayKeys", "metaInfo", "attributes", "_futureElements"}) | |
44 | public class CampusCalendarInfo extends KeyEntityInfo implements CampusCalendar, Serializable { | |
45 | ||
46 | private static final long serialVersionUID = 1L; | |
47 | ||
48 | @XmlElement | |
49 | private final Date startDate; | |
50 | ||
51 | @XmlElement | |
52 | private final Date endDate; | |
53 | ||
54 | @XmlElement | |
55 | private final String location; | |
56 | ||
57 | @XmlElement | |
58 | private final List<String> holidayKeys; | |
59 | ||
60 | @XmlAnyElement | |
61 | private final List<Element> _futureElements; | |
62 | ||
63 | 0 | private CampusCalendarInfo() { |
64 | 0 | startDate = null; |
65 | 0 | endDate = null; |
66 | 0 | location = null; |
67 | 0 | holidayKeys = null; |
68 | 0 | _futureElements = null; |
69 | 0 | } |
70 | ||
71 | /** | |
72 | * Constructs a new CampusCalendarInfo from another | |
73 | * CampusCalendar. | |
74 | * | |
75 | * @param campusCalendar the Campus Calendar to copy | |
76 | */ | |
77 | public CampusCalendarInfo(CampusCalendar campusCalendar) { | |
78 | 0 | super(campusCalendar); |
79 | 0 | this.startDate = null != campusCalendar.getStartDate() ? new Date(campusCalendar.getStartDate().getTime()) : null; |
80 | 0 | this.endDate = null != campusCalendar.getEndDate() ? new Date(campusCalendar.getEndDate().getTime()) : null; |
81 | 0 | this.location = campusCalendar.getLocation(); |
82 | 0 | this.holidayKeys = campusCalendar.getHolidayKeys(); |
83 | 0 | _futureElements = null; |
84 | 0 | } |
85 | ||
86 | /** | |
87 | * Date and time the campus time period becomes effective. This | |
88 | * does not provide a bound on date ranges or milestones | |
89 | * associated with this time period, but instead indicates the | |
90 | * time period proper. This is a similar concept to the effective | |
91 | * date on enumerated values. When an end date has been specified, | |
92 | * this field must be less than or equal to the end date. | |
93 | * | |
94 | * @return the Campus Calendar start date | |
95 | */ | |
96 | @Override | |
97 | public Date getStartDate() { | |
98 | 0 | return startDate; |
99 | } | |
100 | ||
101 | /** | |
102 | * Date and time the campus time period becomes | |
103 | * ineffective. This does not provide a bound on date ranges or | |
104 | * milestones associated with this time period, but instead | |
105 | * indicates the time period proper. If specified, this must be | |
106 | * greater than or equal to the start date. If this field is not | |
107 | * specified, then no end date has been currently defined | |
108 | * and should automatically be considered greater than the | |
109 | * effective date. | |
110 | * | |
111 | * @return the Campus Calendar end date | |
112 | */ | |
113 | @Override | |
114 | public Date getEndDate() { | |
115 | 0 | return endDate; |
116 | } | |
117 | ||
118 | /** | |
119 | * The campus or location to which this calendar pertains. | |
120 | */ | |
121 | @Override | |
122 | public String getLocation() { | |
123 | 0 | return location; |
124 | } | |
125 | ||
126 | /** | |
127 | * The list of holidays (identifiers) for a campus calendar | |
128 | */ | |
129 | @Override | |
130 | public List<String> getHolidayKeys() { | |
131 | 0 | return holidayKeys; |
132 | } | |
133 | /** | |
134 | * The builder class for this CampusCalendarInfo. | |
135 | */ | |
136 | 0 | public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<CampusCalendarInfo>, CampusCalendar { |
137 | ||
138 | private Date startDate; | |
139 | private Date endDate; | |
140 | private String location; | |
141 | private List<String> holidayKeys; | |
142 | ||
143 | /** | |
144 | * Constructs a new builder. | |
145 | */ | |
146 | 0 | public Builder() {} |
147 | ||
148 | /** | |
149 | * Constructs a new builder initialized from another CampusCalendar | |
150 | */ | |
151 | public Builder(CampusCalendar campusCalendar) { | |
152 | 0 | super(campusCalendar); |
153 | 0 | this.startDate = campusCalendar.getStartDate(); |
154 | 0 | this.endDate = campusCalendar.getEndDate(); |
155 | 0 | this.location = campusCalendar.getLocation(); |
156 | 0 | this.holidayKeys=campusCalendar.getHolidayKeys(); |
157 | 0 | } |
158 | ||
159 | /** | |
160 | * Builds the CampusCalendar. | |
161 | * | |
162 | * @return a new CampusCalendar | |
163 | */ | |
164 | public CampusCalendarInfo build() { | |
165 | 0 | return new CampusCalendarInfo(this); |
166 | } | |
167 | ||
168 | /** | |
169 | * Gets the start date. | |
170 | * | |
171 | * @return the Campus Calendar start date | |
172 | */ | |
173 | @Override | |
174 | public Date getStartDate() { | |
175 | 0 | return startDate; |
176 | } | |
177 | ||
178 | /** | |
179 | * Sets the Campus Calendar start date. | |
180 | * | |
181 | * @param startDate the start date for the Campus Calendar | |
182 | */ | |
183 | public void setStartDate(Date startDate) { | |
184 | 0 | this.startDate = startDate; |
185 | 0 | } |
186 | ||
187 | /** | |
188 | * Gets the start date. | |
189 | * | |
190 | * @return the Campus Calendar end date | |
191 | */ | |
192 | @Override | |
193 | public Date getEndDate() { | |
194 | 0 | return endDate; |
195 | } | |
196 | ||
197 | /** | |
198 | * Sets the Campus Calendar end date. | |
199 | * | |
200 | * @param endDate the end date for the Campus Calendar | |
201 | */ | |
202 | ||
203 | public void setEndDate(Date endDate) { | |
204 | 0 | this.endDate = endDate; |
205 | 0 | } |
206 | ||
207 | /** | |
208 | * The campus or location to which this calendar pertains. | |
209 | */ | |
210 | @Override | |
211 | public String getLocation() { | |
212 | 0 | return location; |
213 | } | |
214 | ||
215 | public void setLocation(String location) { | |
216 | 0 | this.location = location; |
217 | 0 | } |
218 | ||
219 | /** | |
220 | * List of holidays for the campus calendar | |
221 | */ | |
222 | @Override | |
223 | public List<String> getHolidayKeys() { | |
224 | 0 | return holidayKeys; |
225 | } | |
226 | ||
227 | public void setHolidayKeys(List<String> holidayKeys) { | |
228 | 0 | this.holidayKeys = holidayKeys; |
229 | 0 | } |
230 | ||
231 | } | |
232 | } |