View Javadoc
1   /**
2    * Copyright 2004-2015 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.kpme.tklm.leave.donation;
17  
18  import java.math.BigDecimal;
19  
20  import org.kuali.kpme.core.accrualcategory.AccrualCategoryBo;
21  import org.kuali.kpme.core.bo.HrBusinessObject;
22  import org.kuali.kpme.core.earncode.EarnCodeBo;
23  import org.kuali.kpme.tklm.api.leave.donation.LeaveDonationContract;
24  import org.kuali.kpme.tklm.api.common.TkConstants;
25  import org.kuali.rice.kim.api.identity.Person;
26  
27  import com.google.common.collect.ImmutableList;
28  import com.google.common.collect.ImmutableMap;
29  
30  public class LeaveDonation extends HrBusinessObject implements LeaveDonationContract {
31  	
32      private static final String AMOUNT_RECEIVED = "amountReceived";
33  	private static final String RECIPIENTS_ACCRUAL_CATEGORY = "recipientsAccrualCategory";
34  	private static final String RECIPIENTS_PRINCIPAL_ID = "recipientsPrincipalID";
35  	private static final String AMOUNT_DONATED = "amountDonated";
36  	private static final String DONATED_ACCRUAL_CATEGORY = "donatedAccrualCategory";
37  	private static final String DONORS_PRINCIPAL_ID = "donorsPrincipalID";
38      
39  	public static final String CACHE_NAME = TkConstants.Namespace.NAMESPACE_PREFIX + "LeaveDonation";
40      private static final long serialVersionUID = 1L;
41      //KPME-2273/1965 Primary Business Keys List.	
42      public static final ImmutableList<String> BUSINESS_KEYS = new ImmutableList.Builder<String>()
43              .add(DONORS_PRINCIPAL_ID)
44              .add(DONATED_ACCRUAL_CATEGORY)
45              .add(AMOUNT_DONATED)
46              .add(RECIPIENTS_PRINCIPAL_ID)
47              .add(RECIPIENTS_ACCRUAL_CATEGORY)
48              .add(AMOUNT_RECEIVED)
49              .build();    
50      
51      private String lmLeaveDonationId;
52  	private String donatedAccrualCategory;
53  	private String recipientsAccrualCategory;
54  	private BigDecimal amountDonated = new BigDecimal("0.0");
55  	private BigDecimal amountReceived = new BigDecimal("0.0");
56  	private String donorsPrincipalID;
57  	private String recipientsPrincipalID;
58  	private String description;
59  	
60  	private transient AccrualCategoryBo accrualCategoryObj;
61  	private transient Person personObj;
62  	private transient EarnCodeBo earnCodeObj;
63  	
64  	private String donatedEarnCode;
65  	private String recipientsEarnCode;
66  
67  	@Override
68  	public ImmutableMap<String, Object> getBusinessKeyValuesMap() {
69      	return  new ImmutableMap.Builder<String, Object>()
70  			.put(DONORS_PRINCIPAL_ID, this.getDonorsPrincipalID())
71  			.put(DONATED_ACCRUAL_CATEGORY, this.getDonatedAccrualCategory())
72  			.put(AMOUNT_DONATED, this.getAmountDonated())
73  			.put(RECIPIENTS_PRINCIPAL_ID, this.getRecipientsPrincipalID())
74  			.put(RECIPIENTS_ACCRUAL_CATEGORY, this.getRecipientsAccrualCategory())
75  			.put(AMOUNT_RECEIVED, this.getAmountReceived())
76  			.build();
77  	}
78  	
79  	public EarnCodeBo getEarnCodeObj() {
80  		return earnCodeObj;
81  	}
82  
83  	public void setEarnCodeObj(EarnCodeBo earnCodeObj) {
84  		this.earnCodeObj = earnCodeObj;
85  	}
86  
87  	public String getDonatedEarnCode() {
88  		return donatedEarnCode;
89  	}
90  
91  	public void setDonatedEarnCode(String donatedEarnCode) {
92  		this.donatedEarnCode = donatedEarnCode;
93  	}
94  
95  	public String getRecipientsEarnCode() {
96  		return recipientsEarnCode;
97  	}
98  
99  	public void setRecipientsEarnCode(String recipientsEarnCode) {
100 		this.recipientsEarnCode = recipientsEarnCode;
101 	}
102 
103 	public String getLmLeaveDonationId() {
104 		return lmLeaveDonationId;
105 	}
106 
107 	public void setLmLeaveDonationId(String lmLeaveDonationId) {
108 		this.lmLeaveDonationId = lmLeaveDonationId;
109 	}
110 
111 	public String getDonatedAccrualCategory() {
112 		return donatedAccrualCategory;
113 	}
114 
115 	public void setDonatedAccrualCategory(String donatedAccrualCategory) {
116 		this.donatedAccrualCategory = donatedAccrualCategory;
117 	}
118 
119 	public String getRecipientsAccrualCategory() {
120 		return recipientsAccrualCategory;
121 	}
122 
123 	public void setRecipientsAccrualCategory(String recipientsAccrualCategory) {
124 		this.recipientsAccrualCategory = recipientsAccrualCategory;
125 	}
126 
127 	public BigDecimal getAmountDonated() {
128 		return amountDonated;
129 	}
130 
131 	public void setAmountDonated(BigDecimal amountDonated) {
132 		this.amountDonated = amountDonated;
133 	}
134 
135 	public BigDecimal getAmountReceived() {
136 		return amountReceived;
137 	}
138 
139 	public void setAmountReceived(BigDecimal amountReceived) {
140 		this.amountReceived = amountReceived;
141 	}
142 
143 	public String getDonorsPrincipalID() {
144 		return donorsPrincipalID;
145 	}
146 
147 	public void setDonorsPrincipalID(String donorsPrincipalID) {
148 		this.donorsPrincipalID = donorsPrincipalID;
149 	}
150 
151 	public String getRecipientsPrincipalID() {
152 		return recipientsPrincipalID;
153 	}
154 
155 	public void setRecipientsPrincipalID(String recipientsPrincipalID) {
156 		this.recipientsPrincipalID = recipientsPrincipalID;
157 	}
158 
159 	public String getDescription() {
160 		return description;
161 	}
162 
163 	public void setDescription(String description) {
164 		this.description = description;
165 	}
166 
167 	public Person getPersonObj() {
168 		return personObj;
169 	}
170 
171 	public void setPersonObj(Person personObj) {
172 		this.personObj = personObj;
173 	}
174 
175 	public AccrualCategoryBo getAccrualCategoryObj() {
176 		return accrualCategoryObj;
177 	}
178 
179 	public void setAccrualCategoryObj(AccrualCategoryBo accrualCategoryObj) {
180 		this.accrualCategoryObj = accrualCategoryObj;
181 	}
182 
183 	@Override
184 	protected String getUniqueKey() {
185 		return getDonorsPrincipalID() +"_"+ getRecipientsPrincipalID() +"_"+ getDonatedAccrualCategory() +"_"+ getRecipientsAccrualCategory();
186 	}
187 
188 	@Override
189 	public String getId() {
190 		return getLmLeaveDonationId();
191 	}
192 
193 	@Override
194 	public void setId(String id) {
195 		setLmLeaveDonationId(id);
196 	}
197 
198 }