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.kuali.student.common.uif.form.KSUifForm;
19 import org.kuali.student.enrollment.class2.acal.dto.HolidayWrapper;
20 import org.kuali.student.r2.common.util.date.DateFormatters;
21 import org.kuali.student.r2.core.acal.dto.HolidayCalendarInfo;
22 import org.kuali.student.r2.core.constants.AcademicCalendarServiceConstants;
23
24 import java.util.ArrayList;
25 import java.util.Date;
26 import java.util.List;
27
28
29
30
31
32
33
34 public class HolidayCalendarForm extends KSUifForm {
35 private static final long serialVersionUID = 7526472595622776147L;
36
37 private HolidayCalendarInfo holidayCalendarInfo;
38 private List<HolidayWrapper> holidays;
39 private String stateName;
40 private String adminOrgName;
41 private String newCalendarName;
42 private Date newCalendarStartDate;
43 private Date newCalendarEndDate;
44 private String hcId;
45 private String orgHcId;
46 private boolean newCalendar;
47 private boolean officialCalendar;
48
49
50 private boolean officialUI;
51
52 public HolidayCalendarForm() {
53 super();
54 holidayCalendarInfo = new HolidayCalendarInfo();
55 holidays = new ArrayList<HolidayWrapper>();
56 newCalendar = true;
57 officialCalendar = false;
58 }
59
60
61
62
63 public HolidayCalendarInfo getHolidayCalendarInfo() {
64 return holidayCalendarInfo;
65 }
66
67
68
69
70
71
72 public void setHolidayCalendarInfo(HolidayCalendarInfo holidayCalendarInfo) {
73 this.holidayCalendarInfo = holidayCalendarInfo;
74 }
75
76
77
78
79 public List<HolidayWrapper> getHolidays() {
80
81
82
83 return holidays;
84 }
85
86
87
88
89
90
91 public void setHolidays(List<HolidayWrapper> holidays) {
92 this.holidays = holidays;
93 }
94
95
96
97
98
99
100 public String getStateName() {
101 return stateName;
102 }
103
104
105
106
107
108
109 public void setStateName(String stateName) {
110 this.stateName = stateName;
111 }
112
113
114
115
116
117
118 public String getAdminOrgName() {
119 return adminOrgName;
120 }
121
122
123
124
125
126
127 public void setAdminOrgName(String adminOrgName) {
128 this.adminOrgName = adminOrgName;
129 }
130
131
132
133
134
135
136 public String getNewCalendarName() {
137 return newCalendarName;
138 }
139
140
141
142
143
144
145 public void setNewCalendarName(String newCalendarName) {
146 this.newCalendarName = newCalendarName;
147 }
148
149
150
151
152
153
154 public Date getNewCalendarStartDate() {
155 return newCalendarStartDate;
156 }
157
158
159
160
161
162
163 public void setNewCalendarStartDate(Date newCalendarStartDate) {
164 this.newCalendarStartDate = newCalendarStartDate;
165 }
166
167
168
169
170
171
172 public Date getNewCalendarEndDate() {
173 return newCalendarEndDate;
174 }
175
176
177
178
179
180
181 public void setNewCalendarEndDate(Date newCalendarEndDate) {
182 this.newCalendarEndDate = newCalendarEndDate;
183 }
184
185
186
187
188
189
190 public String getHcId() {
191 return hcId;
192 }
193
194
195
196
197
198
199 public void setHcId(String hcId) {
200 this.hcId = hcId;
201 }
202
203
204
205
206
207
208 public String getOrgHcId() {
209 return orgHcId;
210 }
211
212
213
214
215
216
217 public void setOrgHcId(String orgHcId) {
218 this.orgHcId = orgHcId;
219 }
220
221
222
223
224
225
226 public boolean isNewCalendar() {
227 return newCalendar;
228 }
229
230
231
232
233
234
235 public void setNewCalendar(boolean newCalendar) {
236 this.newCalendar = newCalendar;
237 }
238
239
240
241
242
243
244 public boolean isOfficialCalendar() {
245 return officialCalendar;
246 }
247
248
249
250
251
252
253 public void setOfficialCalendar(boolean officialCalendar) {
254 this.officialCalendar = officialCalendar;
255 }
256
257
258
259
260
261
262 public String getUpdateTimeString() {
263 if (getHolidayCalendarInfo() != null &&
264 getHolidayCalendarInfo().getMeta() != null &&
265 getHolidayCalendarInfo().getMeta().getUpdateTime() != null) {
266 Date updateTime = getHolidayCalendarInfo().getMeta().getUpdateTime();
267
268 return "Last saved at " + DateFormatters.SIMPLE_TIMESTAMP_FORMATTER.format(updateTime);
269 } else {
270 return StringUtils.EMPTY;
271 }
272 }
273
274
275
276
277
278
279 public boolean isOfficialUI() {
280 if (holidayCalendarInfo != null) {
281 return StringUtils.equals(AcademicCalendarServiceConstants.ACADEMIC_CALENDAR_OFFICIAL_STATE_KEY, holidayCalendarInfo.getStateKey());
282 }
283 return false;
284 }
285 }