View Javadoc

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