001 /**
002 * Copyright 2004-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.hr.lm.timeoff;
017
018 import java.math.BigDecimal;
019 import java.sql.Date;
020
021 import org.apache.commons.lang.StringUtils;
022 import org.kuali.hr.core.KPMEConstants;
023 import org.kuali.hr.lm.accrual.AccrualCategory;
024 import org.kuali.hr.lm.leaveplan.LeavePlan;
025 import org.kuali.hr.location.Location;
026 import org.kuali.hr.time.HrBusinessObject;
027 import org.kuali.hr.time.earncode.EarnCode;
028 import org.kuali.hr.time.service.base.TkServiceLocator;
029
030 public class SystemScheduledTimeOff extends HrBusinessObject {
031
032 private static final long serialVersionUID = 6660625335629574993L;
033
034 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "SystemScheduledTimeOff";
035
036 private String lmSystemScheduledTimeOffId;
037 private String leavePlan;
038 private String accrualCategory;
039 private String earnCode;
040 private Date accruedDate;
041 private Date scheduledTimeOffDate;
042 private String location;
043 private String descr;
044 private BigDecimal amountofTime;
045 private String unusedTime;
046 private BigDecimal transferConversionFactor;
047 private String transfertoEarnCode;
048 private String premiumHoliday;
049 private Boolean history;
050
051 private LeavePlan leavePlanObj;
052 private AccrualCategory accrualCategoryObj;
053 private EarnCode earnCodeObj;
054 private Location locationObj;
055
056 public String getLmSystemScheduledTimeOffId() {
057 return lmSystemScheduledTimeOffId;
058 }
059
060 public void setLmSystemScheduledTimeOffId(String lmSystemScheduledTimeOffId) {
061 this.lmSystemScheduledTimeOffId = lmSystemScheduledTimeOffId;
062 }
063
064 public String getLeavePlan() {
065 if(StringUtils.isNotEmpty(leavePlan)) {
066 return leavePlan;
067 }
068 if (this.earnCodeObj == null &&
069 (!StringUtils.isEmpty(this.earnCode) && getEffectiveDate() != null)) {
070 earnCodeObj = TkServiceLocator.getEarnCodeService().getEarnCode(earnCode, getEffectiveDate());
071 }
072 leavePlan = (earnCodeObj != null) ? earnCodeObj.getLeavePlan() : "";
073 return leavePlan;
074 }
075
076 public void setLeavePlan(String leavePlan) {
077 this.leavePlan = leavePlan;
078 }
079
080 public String getAccrualCategory() {
081 if(StringUtils.isNotEmpty(accrualCategory)) {
082 return accrualCategory;
083 }
084 if (this.earnCodeObj == null &&
085 (!StringUtils.isEmpty(this.earnCode) && getEffectiveDate() != null)) {
086 earnCodeObj = TkServiceLocator.getEarnCodeService().getEarnCode(earnCode, getEffectiveDate());
087 }
088 accrualCategory = (earnCodeObj != null) ? earnCodeObj.getAccrualCategory() : "";
089 return accrualCategory;
090 }
091
092 public void setAccrualCategory(String accrualCategory) {
093 this.accrualCategory = accrualCategory;
094 }
095
096 public Date getAccruedDate() {
097 return accruedDate;
098 }
099
100 public void setAccruedDate(Date accruedDate) {
101 this.accruedDate = accruedDate;
102 }
103
104 public Date getScheduledTimeOffDate() {
105 return scheduledTimeOffDate;
106 }
107
108 public void setScheduledTimeOffDate(Date scheduledTimeOffDate) {
109 this.scheduledTimeOffDate = scheduledTimeOffDate;
110 }
111
112 public String getLocation() {
113 return location;
114 }
115
116 public void setLocation(String location) {
117 this.location = location;
118 }
119
120 public String getDescr() {
121 return descr;
122 }
123
124 public void setDescr(String descr) {
125 this.descr = descr;
126 }
127
128 public BigDecimal getAmountofTime() {
129 return amountofTime;
130 }
131
132 public void setAmountofTime(BigDecimal amountofTime) {
133 this.amountofTime = amountofTime;
134 }
135
136 public String getUnusedTime() {
137 return unusedTime;
138 }
139
140 public void setUnusedTime(String unusedTime) {
141 this.unusedTime = unusedTime;
142 }
143
144 public BigDecimal getTransferConversionFactor() {
145 return transferConversionFactor;
146 }
147
148 public void setTransferConversionFactor(BigDecimal transferConversionFactor) {
149 this.transferConversionFactor = transferConversionFactor;
150 }
151
152 public String getPremiumHoliday() {
153 return premiumHoliday;
154 }
155
156 public void setPremiumHoliday(String premiumHoliday) {
157 this.premiumHoliday = premiumHoliday;
158 }
159
160 public LeavePlan getLeavePlanObj() {
161 return leavePlanObj;
162 }
163
164 public void setLeavePlanObj(LeavePlan leavePlanObj) {
165 this.leavePlanObj = leavePlanObj;
166 }
167
168 public AccrualCategory getAccrualCategoryObj() {
169 return accrualCategoryObj;
170 }
171
172 public void setAccrualCategoryObj(AccrualCategory accrualCategoryObj) {
173 this.accrualCategoryObj = accrualCategoryObj;
174 }
175
176 public String getEarnCode() {
177 return earnCode;
178 }
179
180 public void setEarnCode(String earnCode) {
181 this.earnCode = earnCode;
182 }
183
184 public String getTransfertoEarnCode() {
185 return transfertoEarnCode;
186 }
187
188 public void setTransfertoEarnCode(String transfertoEarnCode) {
189 this.transfertoEarnCode = transfertoEarnCode;
190 }
191
192 public EarnCode getEarnCodeObj() {
193 return earnCodeObj;
194 }
195
196 public void setEarnCodeObj(EarnCode earnCodeObj) {
197 this.earnCodeObj = earnCodeObj;
198 }
199
200 public Location getLocationObj() {
201 return locationObj;
202 }
203
204 public void setLocationObj(Location locationObj) {
205 this.locationObj = locationObj;
206 }
207
208 @Override
209 protected String getUniqueKey() {
210 String lmSystemScheduledTimeOffKey = getEarnCode() +"_"+ getLeavePlan() +"_"+ getAccrualCategory();
211 return lmSystemScheduledTimeOffKey;
212 }
213
214 @Override
215 public String getId() {
216 return getLmSystemScheduledTimeOffId();
217 }
218
219 public Boolean getHistory() {
220 return history;
221 }
222
223 public void setHistory(Boolean history) {
224 this.history = history;
225 }
226
227 @Override
228 public void setId(String id) {
229 setLmSystemScheduledTimeOffId(id);
230 }
231
232 }