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.leaveadjustment;
17  
18  import java.math.BigDecimal;
19  import java.util.LinkedHashMap;
20  
21  import org.apache.commons.lang.StringUtils;
22  import org.kuali.hr.lm.accrual.AccrualCategory;
23  import org.kuali.hr.time.HrBusinessObject;
24  import org.kuali.hr.time.earncode.EarnCode;
25  import org.kuali.hr.time.principal.PrincipalHRAttributes;
26  import org.kuali.hr.time.service.base.TkServiceLocator;
27  import org.kuali.rice.kim.api.identity.Person;
28  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
29  
30  public class LeaveAdjustment extends HrBusinessObject {
31  	private static final long serialVersionUID = 1L;
32  	private String lmLeaveAdjustmentId;
33  	private String principalId;
34  	private String leavePlan;
35  	private String accrualCategory;
36  	private String earnCode;
37  	private String description;
38  	private BigDecimal adjustmentAmount = new BigDecimal("0.0");
39      private Person principal;
40  	private AccrualCategory accrualCategoryObj;
41  	private EarnCode earnCodeObj;
42  	private PrincipalHRAttributes principalHRAttrObj;
43  	
44  	public String getEarnCode() {
45  		return earnCode;
46  	}
47  	public void setEarnCode(String earnCode) {
48  		this.earnCode = earnCode;
49  	}
50  	public EarnCode getEarnCodeObj() {
51  		return earnCodeObj;
52  	}
53  	public void setEarnCodeObj(EarnCode earnCodeObj) {
54  		this.earnCodeObj = earnCodeObj;
55  	}
56  	public String getPrincipalId() {
57  		return principalId;
58  	}
59  	public void setPrincipalId(String principalId) {
60  		this.principalId = principalId;
61  	}
62      public Person getPrincipal() {
63          return principal;
64      }
65      public void setPrincipal(Person principal) {
66          this.principal = principal;
67      }
68      public String getName() {
69  		if (principal == null) {
70          principal = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
71  		}
72  		return (principal != null) ? principal.getName() : "";
73  	}
74  	
75  	public String getLeavePlan() {
76  		if (!StringUtils.isEmpty(this.principalId)) {
77  			principalHRAttrObj = TkServiceLocator.getPrincipalHRAttributeService().getPrincipalCalendar(principalId, this.getEffectiveDate());
78  		}
79  		return (principalHRAttrObj != null) ? principalHRAttrObj.getLeavePlan() : "";
80  	}
81  
82  	public void setLeavePlan(String leavePlan) {
83  		this.leavePlan = leavePlan;
84  	}
85  	public String getAccrualCategory() {
86  		return accrualCategory;
87  	}
88  	public void setAccrualCategory(String accrualCategory) {
89  		this.accrualCategory = accrualCategory;
90  	}
91  	
92  	public String getDescription() {
93  		return description;
94  	}
95  	public void setDescription(String description) {
96  		this.description = description;
97  	}
98  	public BigDecimal getAdjustmentAmount() {
99  		return adjustmentAmount;
100 	}
101 	public void setAdjustmentAmount(BigDecimal adjustmentAmount) {
102 		this.adjustmentAmount = adjustmentAmount;
103 	}
104 	public AccrualCategory getAccrualCategoryObj() {
105 		return accrualCategoryObj;
106 	}
107 	public void setAccrualCategoryObj(AccrualCategory accrualCategoryObj) {
108 		this.accrualCategoryObj = accrualCategoryObj;
109 	}
110 	public static long getSerialversionuid() {
111 		return serialVersionUID;
112 	}
113 	public String getLmLeaveAdjustmentId() {
114 		return lmLeaveAdjustmentId;
115 	}
116 	public void setLmLeaveAdjustmentId(String lmLeaveAdjustmentId) {
117 		this.lmLeaveAdjustmentId = lmLeaveAdjustmentId;
118 	}
119 	
120 	@Override
121 	protected String getUniqueKey() {
122 		return getLmLeaveAdjustmentId();
123 	}
124 	
125 	@Override
126 	public String getId() {
127 		return getLmLeaveAdjustmentId();
128 	}
129 
130 	@Override
131 	public void setId(String id) {
132 		setLmLeaveAdjustmentId(id);
133 	}
134 
135 	public PrincipalHRAttributes getPrincipalHRAttrObj() {
136 		return principalHRAttrObj;
137 	}
138 	public void setPrincipalHRAttrObj(PrincipalHRAttributes principalHRAttrObj) {
139 		this.principalHRAttrObj = principalHRAttrObj;
140 	}
141 }