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.rice.krad.web.form.UifFormBase;
19 import org.kuali.student.r2.common.util.constants.AcademicCalendarServiceConstants;
20 import org.kuali.student.enrollment.acal.dto.HolidayCalendarInfo;
21 import org.kuali.student.enrollment.class2.acal.dto.HolidayWrapper;
22
23 import java.text.SimpleDateFormat;
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 UifFormBase {
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 public HolidayCalendarInfo getHolidayCalendarInfo() {
61 return holidayCalendarInfo;
62 }
63 public void setHolidayCalendarInfo(HolidayCalendarInfo holidayCalendarInfo) {
64 this.holidayCalendarInfo = holidayCalendarInfo;
65 }
66
67 public List<HolidayWrapper> getHolidays() {
68
69
70
71 return holidays;
72 }
73
74 public void setHolidays(List<HolidayWrapper> holidays) {
75 this.holidays = holidays;
76 }
77
78 public String getStateName() {
79 return stateName;
80 }
81
82 public void setStateName(String stateName) {
83 this.stateName = stateName;
84 }
85
86 public String getAdminOrgName() {
87 return adminOrgName;
88 }
89 public void setAdminOrgName(String adminOrgName) {
90 this.adminOrgName = adminOrgName;
91 }
92
93 public String getNewCalendarName() {
94 return newCalendarName;
95 }
96 public void setNewCalendarName(String newCalendarName) {
97 this.newCalendarName = newCalendarName;
98 }
99
100 public Date getNewCalendarStartDate() {
101 return newCalendarStartDate;
102 }
103 public void setNewCalendarStartDate(Date newCalendarStartDate) {
104 this.newCalendarStartDate = newCalendarStartDate;
105 }
106
107 public Date getNewCalendarEndDate() {
108 return newCalendarEndDate;
109 }
110 public void setNewCalendarEndDate(Date newCalendarEndDate) {
111 this.newCalendarEndDate = newCalendarEndDate;
112 }
113
114 public String getHcId() {
115 return hcId;
116 }
117
118 public void setHcId(String hcId) {
119 this.hcId = hcId;
120 }
121
122 public String getOrgHcId() {
123 return orgHcId;
124 }
125
126 public void setOrgHcId(String orgHcId) {
127 this.orgHcId = orgHcId;
128 }
129
130 public boolean isNewCalendar() {
131 return newCalendar;
132 }
133
134 public void setNewCalendar(boolean newCalendar) {
135 this.newCalendar = newCalendar;
136 }
137
138 public boolean isOfficialCalendar() {
139 return officialCalendar;
140 }
141
142 public void setOfficialCalendar(boolean officialCalendar) {
143 this.officialCalendar = officialCalendar;
144 }
145
146 public String getUpdateTimeString(){
147 if (getHolidayCalendarInfo() != null &&
148 getHolidayCalendarInfo().getMeta() != null &&
149 getHolidayCalendarInfo().getMeta().getUpdateTime() != null){
150 Date updateTime = getHolidayCalendarInfo().getMeta().getUpdateTime();
151 return "Last saved at "+new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(updateTime);
152 } else {
153 return StringUtils.EMPTY;
154 }
155 }
156
157 public boolean isOfficialUI(){
158 if (holidayCalendarInfo != null){
159 return StringUtils.equals(AcademicCalendarServiceConstants.ACADEMIC_CALENDAR_OFFICIAL_STATE_KEY, holidayCalendarInfo.getStateKey());
160 }
161 return false;
162 }
163 }