1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.calendar;
17
18 import java.sql.Time;
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.joda.time.DateTimeConstants;
24 import org.kuali.hr.core.KPMEConstants;
25 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
26
27 public class Calendar extends PersistableBusinessObjectBase {
28 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Calendar";
29
30
31
32 private static final long serialVersionUID = 1L;
33
34 private String hrCalendarId;
35 private String calendarName;
36 private String calendarDescriptions;
37
38 private String flsaBeginDay;
39 private Time flsaBeginTime;
40 private String calendarTypes = "Pay";
41 private int flsaBeginDayConstant = -1;
42
43 private List<CalendarEntries> calendarEntries = new ArrayList<CalendarEntries>();
44
45 public Calendar() {
46
47 }
48
49 public String getHrCalendarId() {
50 return hrCalendarId;
51 }
52
53
54
55 public void setHrCalendarId(String hrCalendarId) {
56 this.hrCalendarId = hrCalendarId;
57 }
58
59
60
61 public String getCalendarName() {
62 return calendarName;
63 }
64
65
66
67 public void setCalendarName(String calendarName) {
68 this.calendarName = calendarName;
69 }
70
71
72
73 public String getCalendarTypes() {
74 return calendarTypes;
75 }
76
77
78
79 public void setCalendarTypes(String calendarTypes) {
80 this.calendarTypes = calendarTypes;
81 }
82
83
84
85 public List<CalendarEntries> getCalendarEntries() {
86 return calendarEntries;
87 }
88
89
90
91 public void setCalendarEntries(List<CalendarEntries> calendarEntries) {
92 this.calendarEntries = calendarEntries;
93 }
94
95
96
97 public void setFlsaBeginDayConstant(int flsaBeginDayConstant) {
98 this.flsaBeginDayConstant = flsaBeginDayConstant;
99 }
100
101 public String getCalendarDescriptions() {
102 return calendarDescriptions;
103 }
104
105 public void setCalendarDescriptions(String calendarDescriptions) {
106 this.calendarDescriptions = calendarDescriptions;
107 }
108
109 public String getFlsaBeginDay() {
110 return flsaBeginDay;
111 }
112
113 public void setFlsaBeginDay(String flsaBeginDay) {
114 this.flsaBeginDay = flsaBeginDay;
115 this.setFlsaBeinDayConstant(flsaBeginDay);
116 }
117
118 public Time getFlsaBeginTime() {
119 return flsaBeginTime;
120 }
121
122 public void setFlsaBeginTime(Time flsaBeginTime) {
123 this.flsaBeginTime = flsaBeginTime;
124 }
125
126
127
128
129
130
131
132
133
134
135
136 private void setFlsaBeinDayConstant(String day) {
137 if (!StringUtils.isEmpty(day)) {
138 day = day.toLowerCase().trim();
139
140 if (day.startsWith("m")) {
141 this.flsaBeginDayConstant = DateTimeConstants.MONDAY;
142 } else if (day.startsWith("tu")) {
143 this.flsaBeginDayConstant = DateTimeConstants.TUESDAY;
144 } else if (day.startsWith("w")) {
145 this.flsaBeginDayConstant = DateTimeConstants.WEDNESDAY;
146 } else if (day.startsWith("th")) {
147 this.flsaBeginDayConstant = DateTimeConstants.THURSDAY;
148 } else if (day.startsWith("f")) {
149 this.flsaBeginDayConstant = DateTimeConstants.FRIDAY;
150 } else if (day.startsWith("sa")) {
151 this.flsaBeginDayConstant = DateTimeConstants.SATURDAY;
152 } else if (day.startsWith("su")) {
153 this.flsaBeginDayConstant = DateTimeConstants.SUNDAY;
154 }
155 }
156 }
157
158
159
160
161
162
163
164
165
166 public int getFlsaBeginDayConstant() {
167 if (flsaBeginDayConstant < 0) {
168 this.setFlsaBeinDayConstant(this.getFlsaBeginDay());
169 }
170 return flsaBeginDayConstant;
171 }
172
173 @Override
174 public boolean equals(Object o) {
175 if (o instanceof Calendar) {
176 Calendar pc = (Calendar)o;
177 return this.getHrCalendarId().compareTo(pc.getHrCalendarId()) == 0;
178 } else {
179 return false;
180 }
181 }
182 }