1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.student.enrollment.class2.acal.form;
16
17 import org.apache.commons.lang.StringUtils;
18 import org.apache.commons.lang.time.DateFormatUtils;
19 import org.kuali.student.common.uif.form.KSUifForm;
20 import org.kuali.student.enrollment.class2.acal.dto.AcademicTermWrapper;
21 import org.kuali.student.enrollment.class2.acal.dto.AcalEventWrapper;
22 import org.kuali.student.enrollment.class2.acal.dto.HolidayCalendarWrapper;
23 import org.kuali.student.enrollment.class2.acal.util.CalendarConstants;
24 import org.kuali.student.r2.core.acal.dto.AcademicCalendarInfo;
25 import org.kuali.student.r2.core.constants.AcademicCalendarServiceConstants;
26
27 import java.util.ArrayList;
28 import java.util.Date;
29 import java.util.List;
30
31
32
33
34
35
36 public class AcademicCalendarForm extends KSUifForm {
37
38 private AcademicCalendarInfo academicCalendarInfo;
39 private AcademicCalendarInfo copyFromAcal;
40 private String adminOrgName;
41 private String updateTimeString;
42
43 private List<AcalEventWrapper> events;
44 private List<HolidayCalendarWrapper> holidayCalendarList;
45 private List<AcademicTermWrapper> termWrapperList;
46
47
48 private boolean newCalendar;
49 private boolean officialCalendar;
50 private boolean officialParentTerm;
51
52 private String defaultTabToShow;
53
54 private List<AcalEventWrapper> eventsToDeleteOnSave;
55 private List<AcademicTermWrapper> termsToDeleteOnSave;
56
57 private boolean reload;
58
59
60 private String selectedCollectionPath;
61 private String selectedLineIndex;
62
63
64 private boolean addLineValid;
65 private String validationJSONString;
66
67 private boolean makeOfficial;
68 private boolean makeOfficialIsSubterm;
69 private String makeOfficialParentTermName;
70 private String makeOfficialName;
71 private String messageForDeleteTermOrSubterm;
72
73 private String dirtyFields;
74 private List<String> fieldsToSave;
75
76 public String getValidationJSONString() {
77 return validationJSONString;
78 }
79
80 public void setValidationJSONString(String validationJSONString) {
81 this.validationJSONString = validationJSONString;
82 }
83
84 public boolean isAddLineValid() {
85 return addLineValid;
86 }
87
88 public void setAddLineValid(boolean addLineValid) {
89 this.addLineValid = addLineValid;
90 }
91
92 public AcademicCalendarForm() {
93 super();
94 academicCalendarInfo = new AcademicCalendarInfo();
95 termWrapperList = new ArrayList<AcademicTermWrapper>();
96 events = new ArrayList<AcalEventWrapper>();
97 holidayCalendarList = new ArrayList<HolidayCalendarWrapper>();
98 newCalendar = true;
99 officialCalendar = false;
100 defaultTabToShow = CalendarConstants.ACAL_INFO_TAB;
101 eventsToDeleteOnSave = new ArrayList<AcalEventWrapper>();
102 termsToDeleteOnSave = new ArrayList<AcademicTermWrapper>();
103 addLineValid = true;
104 validationJSONString = new String();
105 fieldsToSave= new ArrayList<String>();
106 }
107
108
109
110
111
112
113 public AcademicCalendarInfo getAcademicCalendarInfo() {
114 return academicCalendarInfo;
115 }
116
117
118
119
120
121
122 public void setAcademicCalendarInfo(AcademicCalendarInfo academicCalendarInfo) {
123 this.academicCalendarInfo = academicCalendarInfo;
124 }
125
126
127
128
129
130
131 public AcademicCalendarInfo getCopyFromAcal() {
132 return copyFromAcal;
133 }
134
135
136
137
138
139
140 public void setCopyFromAcal(AcademicCalendarInfo copyFromAcal) {
141 this.copyFromAcal = copyFromAcal;
142 }
143
144
145
146
147
148
149 public String getAdminOrgName() {
150 return adminOrgName;
151 }
152
153
154
155
156
157
158 public void setAdminOrgName(String adminOrgName) {
159 this.adminOrgName = adminOrgName;
160 }
161
162
163
164
165
166
167 public void setHolidayCalendarList(List<HolidayCalendarWrapper> holidayCalendarList) {
168 this.holidayCalendarList = holidayCalendarList;
169 }
170
171
172
173
174
175
176 public List<HolidayCalendarWrapper> getHolidayCalendarList() {
177 return holidayCalendarList;
178 }
179
180
181
182
183
184
185 public void setTermWrapperList(List<AcademicTermWrapper> termWrapperList) {
186 this.termWrapperList = termWrapperList;
187 }
188
189
190
191
192
193
194 public List<AcademicTermWrapper> getTermWrapperList() {
195 return termWrapperList;
196 }
197
198
199
200
201
202
203
204 @SuppressWarnings("unused")
205 public String getLastUpdatedTime(){
206 updateTimeString = StringUtils.EMPTY;
207 if (StringUtils.isNotBlank(getAcademicCalendarInfo().getId())){
208 Date updateTime = academicCalendarInfo.getMeta().getUpdateTime();
209 if (updateTime != null){
210 updateTimeString = DateFormatUtils.format(updateTime,CalendarConstants.DATE_FORMAT);
211 }
212 }
213 return updateTimeString;
214 }
215
216
217
218
219
220
221 public List<AcalEventWrapper> getEvents() {
222 return events;
223 }
224
225
226
227
228
229
230 public void setEvents(List<AcalEventWrapper> events) {
231 this.events = events;
232 }
233
234
235
236
237
238
239 @SuppressWarnings("unused")
240 public boolean isNewCalendar() {
241 return newCalendar;
242 }
243
244 public void setNewCalendar(boolean newCalendar) {
245 this.newCalendar = newCalendar;
246 }
247
248
249
250
251
252
253 @SuppressWarnings("unused")
254 public boolean isOfficialCalendar() {
255 return officialCalendar;
256 }
257
258
259
260
261
262
263 public void setOfficialCalendar(boolean officialCalendar) {
264 this.officialCalendar = officialCalendar;
265 }
266
267
268
269
270
271
272 public List<AcademicTermWrapper> getTermsToDeleteOnSave() {
273 return termsToDeleteOnSave;
274 }
275
276
277
278
279
280
281
282 public void setTermsToDeleteOnSave(List<AcademicTermWrapper> termsToDeleteOnSave) {
283 this.termsToDeleteOnSave = termsToDeleteOnSave;
284 }
285
286
287
288
289
290
291 @SuppressWarnings("unused")
292 public String getDefaultTabToShow() {
293 return defaultTabToShow;
294 }
295
296
297
298
299
300
301
302
303
304 public void setDefaultTabToShow(String defaultTabToShow) {
305 this.defaultTabToShow = defaultTabToShow;
306 }
307
308
309
310
311
312
313
314 @SuppressWarnings("unused")
315 public int getDefaultSelectedTabIndex() {
316 if (StringUtils.equals(defaultTabToShow,CalendarConstants.ACAL_TERM_TAB)){
317 return 1;
318 }
319 return 0;
320 }
321
322
323
324
325
326
327
328 @SuppressWarnings("unused")
329 public boolean isOfficialUI(){
330 if (academicCalendarInfo != null){
331 return StringUtils.equals(AcademicCalendarServiceConstants.ACADEMIC_CALENDAR_OFFICIAL_STATE_KEY,academicCalendarInfo.getStateKey());
332 }
333 return false;
334 }
335
336
337
338
339
340 @SuppressWarnings("unused")
341 public boolean isReload() {
342 return reload;
343 }
344
345 public void setReload(boolean reload) {
346 this.reload = reload;
347 }
348
349
350
351
352
353 public void reset(){
354 setAcademicCalendarInfo(new AcademicCalendarInfo());
355 setOfficialCalendar(false);
356 getView().setReadOnly(false);
357 setEvents(new ArrayList<AcalEventWrapper>());
358 setHolidayCalendarList(new ArrayList<HolidayCalendarWrapper>());
359 setTermsToDeleteOnSave(new ArrayList<AcademicTermWrapper>());
360 setTermWrapperList(new ArrayList<AcademicTermWrapper>());
361 setNewCalendar(false);
362 }
363
364 public String getSelectedLineIndex() {
365 return selectedLineIndex;
366 }
367
368 public void setSelectedLineIndex(String selectedLineIndex) {
369 this.selectedLineIndex = selectedLineIndex;
370 }
371
372 public String getSelectedCollectionPath() {
373 return selectedCollectionPath;
374 }
375
376 public void setSelectedCollectionPath(String selectedCollectionPath) {
377 this.selectedCollectionPath = selectedCollectionPath;
378 }
379
380
381
382
383
384 public boolean isMakeOfficial() {
385 return makeOfficial;
386 }
387
388 public void setMakeOfficial(boolean makeOfficial) {
389 this.makeOfficial = makeOfficial;
390 }
391
392
393
394
395
396 public String getMakeOfficialName() {
397 return makeOfficialName;
398 }
399
400 public void setMakeOfficialName(String makeOfficialName) {
401 this.makeOfficialName = makeOfficialName;
402 }
403
404 public String getMessageForDeleteTermOrSubterm() {
405 return messageForDeleteTermOrSubterm;
406 }
407
408 public void setMessageForDeleteTermOrSubterm(String messageForDeleteTermOrSubterm) {
409 this.messageForDeleteTermOrSubterm = messageForDeleteTermOrSubterm;
410 }
411
412 public boolean isMakeOfficialIsSubterm() {
413 return makeOfficialIsSubterm;
414 }
415
416 public void setMakeOfficialIsSubterm(boolean makeOfficialIsSubterm) {
417 this.makeOfficialIsSubterm = makeOfficialIsSubterm;
418 }
419
420 public String getMakeOfficialParentTermName() {
421 return makeOfficialParentTermName;
422 }
423
424 public void setMakeOfficialParentTermName(String makeOfficialParentTermName) {
425 this.makeOfficialParentTermName = makeOfficialParentTermName;
426 }
427
428
429
430
431
432
433
434 public String getDirtyFields() {
435 return dirtyFields;
436 }
437
438 public void setDirtyFields(String dirtyFields) {
439 this.dirtyFields = dirtyFields;
440 }
441
442
443
444
445
446
447 public List<AcalEventWrapper> getEventsToDeleteOnSave() {
448 return eventsToDeleteOnSave;
449 }
450
451 public void setEventsToDeleteOnSave(List<AcalEventWrapper> eventsToDeleteOnSave) {
452 this.eventsToDeleteOnSave = eventsToDeleteOnSave;
453 }
454
455 public List<String> getFieldsToSave() {
456 return fieldsToSave;
457 }
458
459 public void setFieldsToSave(List<String> fieldsToSave) {
460 this.fieldsToSave = fieldsToSave;
461 }
462
463 public boolean isOfficialParentTerm() {
464 return officialParentTerm;
465 }
466
467 public void setOfficialParentTerm(boolean officialParentTerm) {
468 this.officialParentTerm = officialParentTerm;
469 }
470 }