View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.lm.timeoff;
17  
18  import java.math.BigDecimal;
19  import java.sql.Date;
20  
21  import org.apache.commons.lang.StringUtils;
22  import org.kuali.hr.core.KPMEConstants;
23  import org.kuali.hr.lm.accrual.AccrualCategory;
24  import org.kuali.hr.lm.leaveplan.LeavePlan;
25  import org.kuali.hr.location.Location;
26  import org.kuali.hr.time.HrBusinessObject;
27  import org.kuali.hr.time.earncode.EarnCode;
28  import org.kuali.hr.time.service.base.TkServiceLocator;
29  
30  public class SystemScheduledTimeOff extends HrBusinessObject {
31  
32  	private static final long serialVersionUID = 6660625335629574993L;
33  
34  	public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "SystemScheduledTimeOff";
35  
36  	private String lmSystemScheduledTimeOffId;
37  	private String leavePlan;
38  	private String accrualCategory;
39  	private String earnCode;
40  	private Date accruedDate;
41  	private Date scheduledTimeOffDate;
42  	private String location;
43  	private String descr;
44  	private BigDecimal amountofTime;
45  	private String unusedTime;
46  	private BigDecimal transferConversionFactor;
47  	private String transfertoEarnCode;
48  	private String premiumHoliday;
49  	private Boolean history;
50  
51  	private LeavePlan leavePlanObj;
52  	private AccrualCategory accrualCategoryObj;
53  	private EarnCode earnCodeObj;
54  	private Location locationObj;
55  	
56  	public String getLmSystemScheduledTimeOffId() {
57  		return lmSystemScheduledTimeOffId;
58  	}
59  
60  	public void setLmSystemScheduledTimeOffId(String lmSystemScheduledTimeOffId) {
61  		this.lmSystemScheduledTimeOffId = lmSystemScheduledTimeOffId;
62  	}
63  
64  	public String getLeavePlan() {
65  		if(StringUtils.isNotEmpty(leavePlan)) {
66  			return leavePlan;
67  		}
68  		if (this.earnCodeObj == null && 
69  				(!StringUtils.isEmpty(this.earnCode) && getEffectiveDate() != null)) {		
70  			earnCodeObj =  TkServiceLocator.getEarnCodeService().getEarnCode(earnCode, getEffectiveDate());
71  		}
72  		leavePlan = (earnCodeObj != null) ? earnCodeObj.getLeavePlan() : "";
73  		return leavePlan;
74  	}
75  
76  	public void setLeavePlan(String leavePlan) {
77  		this.leavePlan = leavePlan;
78  	}
79  
80  	public String getAccrualCategory() {
81          if(StringUtils.isNotEmpty(accrualCategory)) {
82              return accrualCategory;
83          }
84  		if (this.earnCodeObj == null &&
85  				(!StringUtils.isEmpty(this.earnCode) && getEffectiveDate() != null)) {
86  			earnCodeObj =  TkServiceLocator.getEarnCodeService().getEarnCode(earnCode, getEffectiveDate());
87  		}
88  		accrualCategory = (earnCodeObj != null) ? earnCodeObj.getAccrualCategory() : "";
89  		return accrualCategory;
90  	}
91  
92  	public void setAccrualCategory(String accrualCategory) {
93  		this.accrualCategory = accrualCategory;
94  	}
95  
96  	public Date getAccruedDate() {
97  		return accruedDate;
98  	}
99  
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 }