1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
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 java.util.ArrayList; |
22 | |
import org.w3c.dom.Element; |
23 | |
|
24 | |
import javax.xml.bind.annotation.XmlAccessType; |
25 | |
import javax.xml.bind.annotation.XmlAccessorType; |
26 | |
import javax.xml.bind.annotation.XmlAnyElement; |
27 | |
import javax.xml.bind.annotation.XmlAttribute; |
28 | |
import javax.xml.bind.annotation.XmlElement; |
29 | |
import javax.xml.bind.annotation.XmlType; |
30 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
31 | |
|
32 | |
import org.kuali.student.common.infc.ModelBuilder; |
33 | |
import org.kuali.student.common.dto.KeyEntityInfo; |
34 | |
import org.kuali.student.common.dto.TypeInfo; |
35 | |
import org.kuali.student.core.academiccalendar.infc.AcademicCalendarInfc; |
36 | |
import org.kuali.student.core.academiccalendar.infc.TermInfc; |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | 0 | @XmlAccessorType(XmlAccessType.FIELD) |
47 | |
@XmlType(name = "AcademicCalendarInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "campusCalendar", "startDate", "endDate", "terms", "credentialProgramType", "metaInfo", "attributes", "_futureElements"}) |
48 | |
|
49 | |
public class AcademicCalendarInfo extends KeyEntityInfo implements AcademicCalendarInfc, Serializable { |
50 | |
|
51 | |
private static final long serialVersionUID = 1L; |
52 | |
|
53 | |
@XmlElement |
54 | |
private final CampusCalendarInfo campusCalendar; |
55 | |
|
56 | |
@XmlElement |
57 | |
private final Date startDate; |
58 | |
|
59 | |
@XmlElement |
60 | |
private final Date endDate; |
61 | |
|
62 | |
@XmlElement |
63 | |
private final List<TermInfo> terms; |
64 | |
|
65 | |
@XmlElement |
66 | |
private final TypeInfo credentialProgramType; |
67 | |
|
68 | |
@XmlAnyElement |
69 | |
private final List<Element> _futureElements; |
70 | |
|
71 | 0 | private AcademicCalendarInfo() { |
72 | 0 | campusCalendar = null; |
73 | 0 | startDate = null; |
74 | 0 | endDate = null; |
75 | 0 | terms = null; |
76 | 0 | credentialProgramType = null; |
77 | 0 | _futureElements = null; |
78 | 0 | } |
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
public AcademicCalendarInfo(AcademicCalendarInfc academicCalendar) { |
87 | 0 | super(academicCalendar); |
88 | 0 | this.campusCalendar = null !=academicCalendar.getCampusCalendar() ? new CampusCalendarInfo(academicCalendar.getCampusCalendar()) : null; |
89 | 0 | this.startDate = null != academicCalendar.getStartDate() ? new Date(academicCalendar.getStartDate().getTime()) : null; |
90 | 0 | this.endDate = null != academicCalendar.getEndDate() ? new Date(academicCalendar.getEndDate().getTime()) : null; |
91 | 0 | if (academicCalendar.getTerms() != null) { |
92 | 0 | this.terms = new ArrayList<TermInfo>(academicCalendar.getTerms().size()); |
93 | 0 | for (TermInfc t : academicCalendar.getTerms()) { |
94 | 0 | this.terms.add(new TermInfo(t)); |
95 | |
} |
96 | |
} else { |
97 | 0 | this.terms = new ArrayList<TermInfo>(); |
98 | |
} |
99 | |
|
100 | 0 | this.credentialProgramType = new TypeInfo(academicCalendar.getCredentialProgramType()); |
101 | 0 | _futureElements = null; |
102 | 0 | } |
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
@Override |
110 | |
public CampusCalendarInfo getCampusCalendar() { |
111 | 0 | return campusCalendar; |
112 | |
} |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
@Override |
126 | |
public Date getStartDate() { |
127 | 0 | return startDate; |
128 | |
} |
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
@Override |
144 | |
public Date getEndDate() { |
145 | 0 | return endDate; |
146 | |
} |
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
public List<TermInfo> getTerms() { |
154 | 0 | return terms; |
155 | |
} |
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
public TypeInfo getCredentialProgramType() { |
163 | 0 | return credentialProgramType; |
164 | |
} |
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | 0 | public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<AcademicCalendarInfo>, AcademicCalendarInfc { |
170 | |
|
171 | |
private CampusCalendarInfo campusCalendar; |
172 | |
private Date startDate; |
173 | |
private Date endDate; |
174 | |
private List<TermInfo> terms; |
175 | |
private TypeInfo credentialProgramType; |
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | 0 | public Builder() {} |
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
public Builder(AcademicCalendarInfc academicCalendar) { |
187 | 0 | super(academicCalendar); |
188 | 0 | this.startDate = academicCalendar.getStartDate(); |
189 | 0 | this.endDate = academicCalendar.getEndDate(); |
190 | 0 | if (academicCalendar.getTerms() != null) { |
191 | 0 | this.terms = new ArrayList(academicCalendar.getTerms().size()); |
192 | 0 | for (TermInfc t : academicCalendar.getTerms()) { |
193 | 0 | this.terms.add(new TermInfo(t)); |
194 | |
} |
195 | |
} |
196 | 0 | this.credentialProgramType = new TypeInfo(academicCalendar.getCredentialProgramType()); |
197 | 0 | } |
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | |
public AcademicCalendarInfo build() { |
205 | 0 | return new AcademicCalendarInfo(this); |
206 | |
} |
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
public CampusCalendarInfo getCampusCalendar() { |
214 | 0 | return campusCalendar; |
215 | |
} |
216 | |
|
217 | |
public void setCampusCalendar(CampusCalendarInfo campusCalendar) { |
218 | 0 | this.campusCalendar = campusCalendar; |
219 | 0 | } |
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
|
225 | |
|
226 | |
@Override |
227 | |
public Date getStartDate() { |
228 | 0 | return startDate; |
229 | |
} |
230 | |
|
231 | |
|
232 | |
|
233 | |
|
234 | |
|
235 | |
|
236 | |
public void setStartDate(Date startDate) { |
237 | 0 | this.startDate = startDate; |
238 | 0 | } |
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
|
245 | |
@Override |
246 | |
public Date getEndDate() { |
247 | 0 | return endDate; |
248 | |
} |
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
|
254 | |
|
255 | |
|
256 | |
public void setEndDate(Date endDate) { |
257 | 0 | this.endDate = endDate; |
258 | 0 | } |
259 | |
|
260 | |
|
261 | |
|
262 | |
|
263 | |
|
264 | |
public List<TermInfo> getTerms() { |
265 | 0 | return terms; |
266 | |
} |
267 | |
|
268 | |
public void setTerms(List<TermInfo> terms) { |
269 | 0 | this.terms = terms; |
270 | 0 | } |
271 | |
|
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
public TypeInfo getCredentialProgramType() { |
277 | 0 | return credentialProgramType; |
278 | |
} |
279 | |
|
280 | |
public void setCredentialProgramType(TypeInfo credentialProgramType) { |
281 | 0 | this.credentialProgramType = credentialProgramType; |
282 | 0 | } |
283 | |
} |
284 | |
} |