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.job;
17  
18  import java.math.BigDecimal;
19  
20  import org.kuali.hr.core.KPMEConstants;
21  import org.kuali.hr.location.Location;
22  import org.kuali.hr.paygrade.PayGrade;
23  import org.kuali.hr.time.HrBusinessObject;
24  import org.kuali.hr.time.department.Department;
25  import org.kuali.hr.time.paytype.PayType;
26  import org.kuali.hr.time.position.Position;
27  import org.kuali.hr.time.salgroup.SalGroup;
28  import org.kuali.hr.time.util.TkConstants;
29  import org.kuali.rice.kim.api.identity.Person;
30  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
31  
32  public class Job extends HrBusinessObject {
33  
34  	private static final long serialVersionUID = 1369595897637935064L;
35  
36  	public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Job";
37  	
38  	private String location;
39  	private String hrPayType;
40  	private String payGrade;
41  	private BigDecimal standardHours;
42  	private String hrJobId;
43  	private String principalId;
44  	private String firstName;
45  	private String lastName;
46  	private String principalName;
47  	private Long jobNumber;
48  	private String dept;
49  	private String hrSalGroup;
50  	private Boolean primaryIndicator;
51  	private Boolean history;
52  	private BigDecimal compRate = new BigDecimal(0);
53  	private String positionNumber;
54  	
55  	private String hrDeptId;
56  	private String hrPayTypeId;
57  	private boolean eligibleForLeave;
58  	
59  	private Person principal;
60  	private Department deptObj;
61  	private PayType payTypeObj;
62  	private Location locationObj;
63      private PayGrade payGradeObj;
64      private SalGroup salGroupObj;
65      private Position positionObj;
66      
67      private BigDecimal fte = new BigDecimal(0); //kpme1465, chen
68      private String flsaStatus;
69      
70  	public String getFlsaStatus() {
71  		return flsaStatus;
72  	}
73  
74  	public void setFlsaStatus(String flsaStatus) {
75  		this.flsaStatus = flsaStatus;
76  	}
77  
78  	public BigDecimal getFte() {
79  		if ( this.standardHours != null ) {
80  			return this.standardHours.divide(new BigDecimal(40)).setScale(2);
81  		} else {
82  			return fte;
83  		}
84  	}
85  
86  	public void setFte() {
87  		if ( this.standardHours != null ) {
88  			this.fte = this.standardHours.divide(new BigDecimal(40)).setScale(2);
89  		} else {
90  			this.fte = new BigDecimal(0).setScale(2);
91  		}
92  	}
93  	
94  	public String getPayGrade() {
95  		return payGrade;
96  	}
97  
98  	public void setPayGrade(String payGrade) {
99  		this.payGrade = payGrade;
100 	}
101 
102 	public BigDecimal getStandardHours() {
103 		return standardHours;
104 	}
105 
106 	public void setStandardHours(BigDecimal standardHours) {
107 		this.standardHours = standardHours;
108 	}
109 
110 	public String getPrincipalId() {
111 		return principalId;
112 	}
113 
114 	public void setPrincipalId(String principalId) {
115 		this.principalId = principalId;
116 	}
117 	
118 	public String getFirstName() {
119 		return firstName;
120 	}
121 
122 	public void setFirstName(String firstName) {
123 		this.firstName = firstName;
124 	}
125 
126 	public String getLastName() {
127 		return lastName;
128 	}
129 
130 	public void setLastName(String lastName) {
131 		this.lastName = lastName;
132 	}
133 
134 	public String getName() {
135 		if (principal == null) {
136             principal = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
137 	    }
138 	    return (principal != null) ? principal.getName() : "";
139 	}
140 
141 	public String getPrincipalName() {
142 		if(principalName == null && !this.getPrincipalId().isEmpty()) {
143 			Person aPerson = KimApiServiceLocator.getPersonService().getPerson(getPrincipalId());
144 			setPrincipalName(aPerson.getName());
145 		}
146 		return principalName;
147 	}
148 
149 	public void setPrincipalName(String principalName) {
150 		this.principalName = principalName;
151 	}
152 
153 	public Long getJobNumber() {
154 		return jobNumber;
155 	}
156 
157 	public void setJobNumber(Long jobNumber) {
158 		this.jobNumber = jobNumber;
159 	}
160 
161 	public Boolean getHistory() {
162 		return history;
163 	}
164 
165 	public void setHistory(Boolean history) {
166 		this.history = history;
167 	}
168 	
169 	public void setLocation(String location) {
170 		this.location = location;
171 	}
172 
173 	public String getLocation() {
174 		return location;
175 	}
176 	
177 	public String getHrPayType() {
178 		return hrPayType;
179 	}
180 
181 	public void setHrPayType(String hrPayType) {
182 		this.hrPayType = hrPayType;
183 	}
184 
185 	public String getHrJobId() {
186 		return hrJobId;
187 	}
188 
189 	public void setHrJobId(String hrJobId) {
190 		this.hrJobId = hrJobId;
191 	}
192 
193 	public String getDept() {
194 		return dept;
195 	}
196 
197 	public void setDept(String dept) {
198 		this.dept = dept;
199 	}
200 
201 	public String getHrSalGroup() {
202 		return hrSalGroup;
203 	}
204 
205 	public void setHrSalGroup(String hrSalGroup) {
206 		this.hrSalGroup = hrSalGroup;
207 	}
208 
209 
210 	public BigDecimal getCompRate() {
211 		return compRate;
212 	}
213 
214 
215 	public void setCompRate(BigDecimal compRate) {
216 		if(compRate != null){
217 			this.compRate = compRate.setScale(TkConstants.BIG_DECIMAL_SCALE);
218 		} else {
219 			this.compRate = compRate;
220 		}
221 	}
222 
223 	public Department getDeptObj() {
224 		return deptObj;
225 	}
226 
227 
228 	public void setDeptObj(Department deptObj) {
229 		this.deptObj = deptObj;
230 	}
231 
232 
233 	public PayType getPayTypeObj() {
234 		return payTypeObj;
235 	}
236 
237 
238 	public void setPayTypeObj(PayType payTypeObj) {
239 		this.payTypeObj = payTypeObj;
240 	}
241 
242 
243 	public Person getPrincipal() {
244 		return principal;
245 	}
246 
247 
248 	public void setPrincipal(Person principal) {
249 		this.principal = principal;
250 	}
251 
252 
253 	public void setPrimaryIndicator(Boolean primaryIndicator) {
254 		this.primaryIndicator = primaryIndicator;
255 	}
256 
257 
258 	public Boolean getPrimaryIndicator() {
259 		return primaryIndicator;
260 	}
261 
262 	public Location getLocationObj() {
263 		return locationObj;
264 	}
265 
266 	public void setLocationObj(Location locationObj) {
267 		this.locationObj = locationObj;
268 	}
269 
270 	public PayGrade getPayGradeObj() {
271 		return payGradeObj;
272 	}
273 
274 	public void setPayGradeObj(PayGrade payGradeObj) {
275 		this.payGradeObj = payGradeObj;
276 	}
277 
278 	public SalGroup getSalGroupObj() {
279 		return salGroupObj;
280 	}
281 
282 	public void setSalGroupObj(SalGroup salGroupObj) {
283 		this.salGroupObj = salGroupObj;
284 	}
285 
286 	public void setPositionNumber(String positionNumber) {
287 		this.positionNumber = positionNumber;
288 	}
289 
290 	public String getPositionNumber() {
291 		return positionNumber;
292 	}
293 
294 	public void setPositionObj(Position positionObj) {
295 		this.positionObj = positionObj;
296 	}
297 
298 	public Position getPositionObj() {
299 		return positionObj;
300 	}
301 
302 	public String getHrDeptId() {
303 		return hrDeptId;
304 	}
305 
306 	public void setHrDeptId(String hrDeptId) {
307 		this.hrDeptId = hrDeptId;
308 	}
309 
310 	public String getHrPayTypeId() {
311 		return hrPayTypeId;
312 	}
313 
314 	public void setHrPayTypeId(String hrPayTypeId) {
315 		this.hrPayTypeId = hrPayTypeId;
316 	}
317 
318 	@Override
319 	public String getUniqueKey() {
320 		return getPrincipalId() + "_" + getJobNumber();
321 	}
322 
323 	@Override
324 	public String getId() {
325 		return getHrJobId();
326 	}
327 
328 	@Override
329 	public void setId(String id) {
330 		setHrJobId(id);
331 	}
332 	public boolean isEligibleForLeave() {
333 		return eligibleForLeave;
334 	}
335 
336 	public void setEligibleForLeave(boolean eligibleForLeave) {
337 		this.eligibleForLeave = eligibleForLeave;
338 	}
339 	
340 }