Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CampusCalendarInfo |
|
| 1.1428571428571428;1.143 | ||||
CampusCalendarInfo$Builder |
|
| 1.1428571428571428;1.143 |
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.common.dto.KeyEntityInfo; | |
33 | import org.kuali.student.core.academiccalendar.infc.CampusCalendarInfc; | |
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", "metaInfo", "attributes", "_futureElements"}) | |
44 | public class CampusCalendarInfo extends KeyEntityInfo implements CampusCalendarInfc, 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 | @XmlAnyElement | |
58 | private final List<Element> _futureElements; | |
59 | ||
60 | 0 | private CampusCalendarInfo() { |
61 | 0 | startDate = null; |
62 | 0 | endDate = null; |
63 | 0 | location = null; |
64 | 0 | _futureElements = null; |
65 | 0 | } |
66 | ||
67 | /** | |
68 | * Constructs a new CampusCalendarInfo from another | |
69 | * CampusCalendar. | |
70 | * | |
71 | * @param campusCalendar the Campus Calendar to copy | |
72 | */ | |
73 | public CampusCalendarInfo(CampusCalendarInfc campusCalendar) { | |
74 | 0 | super(campusCalendar); |
75 | 0 | this.startDate = null != campusCalendar.getStartDate() ? new Date(campusCalendar.getStartDate().getTime()) : null; |
76 | 0 | this.endDate = null != campusCalendar.getEndDate() ? new Date(campusCalendar.getEndDate().getTime()) : null; |
77 | 0 | this.location = campusCalendar.getLocation(); |
78 | 0 | _futureElements = null; |
79 | 0 | } |
80 | ||
81 | /** | |
82 | * Name: StartDate | |
83 | * Date and time the campus time period becomes effective. This | |
84 | * does not provide a bound on date ranges or milestones | |
85 | * associated with this time period, but instead indicates the | |
86 | * time period proper. This is a similar concept to the effective | |
87 | * date on enumerated values. When an end date has been specified, | |
88 | * this field must be less than or equal to the end date. | |
89 | * | |
90 | * @return the Campus Calendar start date | |
91 | */ | |
92 | @Override | |
93 | public Date getStartDate() { | |
94 | 0 | return startDate; |
95 | } | |
96 | ||
97 | /** | |
98 | * Name: EndDate | |
99 | * Date and time the campus time period becomes | |
100 | * ineffective. This does not provide a bound on date ranges or | |
101 | * milestones associated with this time period, but instead | |
102 | * indicates the time period proper. If specified, this must be | |
103 | * greater than or equal to the start date. If this field is not | |
104 | * specified, then no end date has been currently defined | |
105 | * and should automatically be considered greater than the | |
106 | * effective date. | |
107 | * | |
108 | * @return the Campus Calendar end date | |
109 | */ | |
110 | @Override | |
111 | public Date getEndDate() { | |
112 | 0 | return endDate; |
113 | } | |
114 | ||
115 | /** | |
116 | * Name: Location | |
117 | * The campus or location to which this calendar pertains. | |
118 | */ | |
119 | @Override | |
120 | public String getLocation() { | |
121 | 0 | return location; |
122 | } | |
123 | ||
124 | /** | |
125 | * The builder class for this CampusCalendarInfo. | |
126 | */ | |
127 | 0 | public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<CampusCalendarInfo>, CampusCalendarInfc { |
128 | ||
129 | private Date startDate; | |
130 | private Date endDate; | |
131 | private String location; | |
132 | ||
133 | /** | |
134 | * Constructs a new builder. | |
135 | */ | |
136 | 0 | public Builder() {} |
137 | ||
138 | /** | |
139 | * Constructs a new builder initialized from another CampusCalendar | |
140 | */ | |
141 | public Builder(CampusCalendarInfc campusCalendar) { | |
142 | 0 | super(campusCalendar); |
143 | 0 | this.startDate = campusCalendar.getStartDate(); |
144 | 0 | this.endDate = campusCalendar.getEndDate(); |
145 | 0 | this.location = campusCalendar.getLocation(); |
146 | 0 | } |
147 | ||
148 | /** | |
149 | * Builds the CampusCalendar. | |
150 | * | |
151 | * @return a new CampusCalendar | |
152 | */ | |
153 | public CampusCalendarInfo build() { | |
154 | 0 | return new CampusCalendarInfo(this); |
155 | } | |
156 | ||
157 | /** | |
158 | * Gets the start date. | |
159 | * | |
160 | * @return the Campus Calendar start date | |
161 | */ | |
162 | @Override | |
163 | public Date getStartDate() { | |
164 | 0 | return startDate; |
165 | } | |
166 | ||
167 | /** | |
168 | * Sets the Campus Calendar start date. | |
169 | * | |
170 | * @param startDate the start date for the Campus Calendar | |
171 | */ | |
172 | public void setStartDate(Date startDate) { | |
173 | 0 | this.startDate = startDate; |
174 | 0 | } |
175 | ||
176 | /** | |
177 | * Gets the start date. | |
178 | * | |
179 | * @return the Campus Calendar end date | |
180 | */ | |
181 | @Override | |
182 | public Date getEndDate() { | |
183 | 0 | return endDate; |
184 | } | |
185 | ||
186 | /** | |
187 | * Sets the Campus Calendar end date. | |
188 | * | |
189 | * @param endDate the end date for the Campus Calendar | |
190 | */ | |
191 | ||
192 | public void setEndDate(Date endDate) { | |
193 | 0 | this.endDate = endDate; |
194 | 0 | } |
195 | ||
196 | /** | |
197 | * The campus or location to which this calendar pertains. | |
198 | */ | |
199 | @Override | |
200 | public String getLocation() { | |
201 | 0 | return location; |
202 | } | |
203 | ||
204 | public void setLocation(String location) { | |
205 | 0 | this.location = location; |
206 | 0 | } |
207 | } | |
208 | } |