1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.leavecode;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.hr.core.KPMEConstants;
20 import org.kuali.hr.lm.accrual.AccrualCategory;
21 import org.kuali.hr.lm.leaveplan.LeavePlan;
22 import org.kuali.hr.time.HrBusinessObject;
23 import org.kuali.hr.time.earncode.EarnCode;
24 import org.kuali.hr.time.service.base.TkServiceLocator;
25
26 public class LeaveCode extends HrBusinessObject {
27
28 private static final long serialVersionUID = -759700327943760962L;
29
30 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "LeaveCode";
31
32 private String lmLeaveCodeId;
33 private String leavePlan;
34 private String eligibleForAccrual;
35 private String affectPay;
36 private String accrualCategory;
37 private String earnCode;
38 private String leaveCode;
39 private String displayName;
40 private String unitOfTime;
41 private String fractionalTimeAllowed;
42 private String roundingOption;
43 private String allowScheduledLeave;
44 private String fmla;
45 private String workmansComp;
46 private Long defaultAmountofTime;
47 private Boolean employee;
48 private Boolean approver;
49 private Boolean departmentAdmin;
50 private String allowNegativeAccrualBalance;
51 private Boolean history;
52
53 private LeavePlan leavePlanObj;
54 private EarnCode earnCodeObj;
55 private AccrualCategory accrualCategoryObj;
56
57 public String getAffectPay() {
58 return affectPay;
59 }
60
61 public void setAffectPay(String affectPay) {
62 this.affectPay = affectPay;
63 }
64
65 public EarnCode getEarnCodeObj() {
66 return earnCodeObj;
67 }
68
69 public void setEarnCodeObj(EarnCode earnCodeObj) {
70 this.earnCodeObj = earnCodeObj;
71 }
72
73 public AccrualCategory getAccrualCategoryObj() {
74 return accrualCategoryObj;
75 }
76
77 public void setAccrualCategoryObj(AccrualCategory accrualCategoryObj) {
78 this.accrualCategoryObj = accrualCategoryObj;
79 }
80
81 public LeavePlan getLeavePlanObj() {
82 return leavePlanObj;
83 }
84
85 public void setLeavePlanObj(LeavePlan leavePlanObj) {
86 this.leavePlanObj = leavePlanObj;
87 }
88
89 public String getLmLeaveCodeId() {
90 return lmLeaveCodeId;
91 }
92
93 public void setLmLeaveCodeId(String lmLeaveCodeId) {
94 this.lmLeaveCodeId = lmLeaveCodeId;
95 }
96
97
98 public String getLeavePlan() {
99 if (StringUtils.isNotEmpty(this.leavePlan)) {
100 return leavePlan;
101 }else{
102 AccrualCategory myAccrualCategoryObj = new AccrualCategory();
103 if (!StringUtils.isEmpty(this.accrualCategory) && getEffectiveDate() != null) {
104
105 myAccrualCategoryObj = TkServiceLocator.getAccrualCategoryService().getAccrualCategory(accrualCategory, getEffectiveDate());
106
107 }
108 return (myAccrualCategoryObj != null) ? myAccrualCategoryObj.getLeavePlan() : "";
109 }
110 }
111
112 public void setLeavePlan(String leavePlan) {
113 this.leavePlan = leavePlan;
114 }
115
116 public String getEligibleForAccrual() {
117 return eligibleForAccrual;
118 }
119
120 public void setEligibleForAccrual(String eligibleForAccrual) {
121 this.eligibleForAccrual = eligibleForAccrual;
122 }
123
124 public String getAccrualCategory() {
125 return accrualCategory;
126 }
127
128 public void setAccrualCategory(String accrualCategory) {
129 this.accrualCategory = accrualCategory;
130 }
131
132 public String getEarnCode() {
133 return earnCode;
134 }
135
136 public void setEarnCode(String earnCode) {
137 this.earnCode = earnCode;
138 }
139
140 public String getLeaveCode() {
141 return leaveCode;
142 }
143
144 public void setLeaveCode(String leaveCode) {
145 this.leaveCode = leaveCode;
146 }
147
148 public String getDisplayName() {
149 return displayName;
150 }
151
152 public void setDisplayName(String displayName) {
153 this.displayName = displayName;
154 }
155
156 public String getUnitOfTime() {
157 return unitOfTime;
158 }
159
160 public void setUnitOfTime(String unitOfTime) {
161 this.unitOfTime = unitOfTime;
162 }
163
164 public String getFractionalTimeAllowed() {
165 return fractionalTimeAllowed;
166 }
167
168 public void setFractionalTimeAllowed(String fractionalTimeAllowed) {
169 this.fractionalTimeAllowed = fractionalTimeAllowed;
170 }
171
172 public String getRoundingOption() {
173 return roundingOption;
174 }
175
176 public void setRoundingOption(String roundingOption) {
177 this.roundingOption = roundingOption;
178 }
179
180 public String getAllowScheduledLeave() {
181 return allowScheduledLeave;
182 }
183
184 public void setAllowScheduledLeave(String allowScheduledLeave) {
185 this.allowScheduledLeave = allowScheduledLeave;
186 }
187
188 public String getFmla() {
189 return fmla;
190 }
191
192 public void setFmla(String fmla) {
193 this.fmla = fmla;
194 }
195
196 public String getWorkmansComp() {
197 return workmansComp;
198 }
199
200 public void setWorkmansComp(String workmansComp) {
201 this.workmansComp = workmansComp;
202 }
203
204 public Long getDefaultAmountofTime() {
205 return defaultAmountofTime;
206 }
207
208 public void setDefaultAmountofTime(Long defaultAmountofTime) {
209 this.defaultAmountofTime = defaultAmountofTime;
210 }
211
212 public Boolean getEmployee() {
213 return employee;
214 }
215
216 public void setEmployee(Boolean employee) {
217 this.employee = employee;
218 }
219
220 public Boolean getApprover() {
221 return approver;
222 }
223
224 public void setApprover(Boolean approver) {
225 this.approver = approver;
226 }
227
228 public Boolean getDepartmentAdmin() {
229 return departmentAdmin;
230 }
231
232 public void setDepartmentAdmin(Boolean departmentAdmin) {
233 this.departmentAdmin = departmentAdmin;
234 }
235
236 public Boolean getHistory() {
237 return history;
238 }
239
240 public void setHistory(Boolean history) {
241 this.history = history;
242 }
243
244 @Override
245 protected String getUniqueKey() {
246 String leaveCodeKey = getLeaveCode() +"_"+ getLeavePlan() +"_"+ getAccrualCategory() +"_"+ getEarnCode();
247 return leaveCodeKey;
248 }
249
250 @Override
251 public String getId() {
252 return getLmLeaveCodeId();
253 }
254
255 public String getLeaveCodeKeyForDisplay() {
256
257
258
259
260
261
262
263 return lmLeaveCodeId;
264 }
265
266 public String getLeaveCodeValueForDisplay() {
267 return leaveCode + " : " + displayName;
268 }
269
270 @Override
271 public void setId(String id) {
272 setLmLeaveCodeId(id);
273 }
274
275 public String getAllowNegativeAccrualBalance() {
276 return allowNegativeAccrualBalance;
277 }
278
279 public void setAllowNegativeAccrualBalance(String allowNegativeAccrualBalance) {
280 this.allowNegativeAccrualBalance = allowNegativeAccrualBalance;
281 }
282 }