1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.leave.transfer.web;
17
18 import java.math.BigDecimal;
19 import java.util.Date;
20
21 import javax.servlet.http.HttpServletRequest;
22
23 import org.apache.commons.lang.StringUtils;
24 import org.joda.time.LocalDate;
25 import org.kuali.kpme.core.accrualcategory.AccrualCategoryBo;
26 import org.kuali.kpme.core.api.accrualcategory.AccrualCategory;
27 import org.kuali.kpme.core.service.HrServiceLocator;
28 import org.kuali.kpme.core.util.HrConstants;
29 import org.kuali.kpme.tklm.leave.transfer.BalanceTransfer;
30 import org.kuali.rice.kns.util.ActionFormUtilMap;
31 import org.kuali.rice.kns.util.WebUtils;
32 import org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase;
33
34 public class BalanceTransferForm extends KualiTransactionalDocumentFormBase {
35
36
37
38
39 private static final long serialVersionUID = 1L;
40 private BalanceTransfer balanceTransfer;
41 private String balanceTransferId;
42 private String accrualCategoryRule;
43 private String principalId;
44 private String toAccrualCategory;
45 private String fromAccrualCategory;
46 private BigDecimal transferAmount;
47 private BigDecimal forfeitedAmount;
48 private Date effectiveDate;
49 private String leaveCalendarDocumentId;
50 private String type;
51 private boolean onLeaveApproval;
52 private boolean timesheet;
53
54 public Date getEffectiveDate() {
55 return effectiveDate;
56 }
57
58 public void setEffectiveDate(Date effectiveDate) {
59 this.effectiveDate = effectiveDate;
60 }
61
62 public String getPrincipalId() {
63 return principalId;
64 }
65
66 public void setPrincipalId(String principalId) {
67 this.principalId = principalId;
68 }
69
70 public String getToAccrualCategory() {
71 return toAccrualCategory;
72 }
73
74 public void setToAccrualCategory(String toAccrualCategory) {
75 this.toAccrualCategory = toAccrualCategory;
76 }
77
78 public String getFromAccrualCategory() {
79 return fromAccrualCategory;
80 }
81
82 public void setFromAccrualCategory(String fromAccrualCategory) {
83 this.fromAccrualCategory = fromAccrualCategory;
84 }
85
86 public BigDecimal getTransferAmount() {
87 return transferAmount;
88 }
89
90 public void setTransferAmount(BigDecimal transferAmount) {
91 this.transferAmount = transferAmount;
92 }
93
94 public BigDecimal getForfeitedAmount() {
95 return forfeitedAmount;
96 }
97
98 public void setForfeitedAmount(BigDecimal forfeitedAmount) {
99 this.forfeitedAmount = forfeitedAmount;
100 }
101
102 public String getBalanceTransferId() {
103 return balanceTransferId;
104 }
105
106 public void setBalanceTransferId(String balanceTransferId) {
107 this.balanceTransferId = balanceTransferId;
108 }
109
110 public String getAccrualCategoryRule() {
111 return accrualCategoryRule;
112 }
113
114 public void setAccrualCategoryRule(String accrualCategoryRule) {
115 this.accrualCategoryRule = accrualCategoryRule;
116 }
117
118 public AccrualCategory getCreditedAccrualCategory() {
119 return HrServiceLocator.getAccrualCategoryService().getAccrualCategory(toAccrualCategory, LocalDate.fromDateFields(effectiveDate));
120 }
121
122 public AccrualCategory getDebitedAccrualCategory() {
123 return HrServiceLocator.getAccrualCategoryService().getAccrualCategory(fromAccrualCategory, LocalDate.fromDateFields(effectiveDate));
124 }
125
126 @Override
127 public String getBackLocation() {
128 return "LeaveCalendarSubmit.do?methodToCall=approveLeaveCalendar";
129 }
130
131 @Override
132 public void populate(HttpServletRequest request) {
133 super.populate(request);
134 ((ActionFormUtilMap) getActionFormUtilMap()).setCacheValueFinderResults(false);
135
136 if (this.getMethodToCall() == null || StringUtils.isEmpty(this.getMethodToCall())) {
137 setMethodToCall(WebUtils.parseMethodToCall(this, request));
138 }
139 }
140
141 @Override
142 public void addRequiredNonEditableProperties() {
143 super.addRequiredNonEditableProperties();
144 }
145
146 public BalanceTransfer getBalanceTransfer() {
147 return balanceTransfer;
148 }
149
150 public void setBalanceTransfer(BalanceTransfer balanceTransfer) {
151 this.balanceTransfer = balanceTransfer;
152 }
153
154 public String getLeaveCalendarDocumentId() {
155 return leaveCalendarDocumentId;
156 }
157
158 public void setLeaveCalendarDocumentId(String leaveCalendarDocId) {
159 this.leaveCalendarDocumentId = leaveCalendarDocId;
160 }
161
162 public String getType() {
163 return type;
164 }
165
166 public void setType(String type) {
167 this.type = type;
168 }
169
170 public boolean isOnLeaveApproval() {
171 if(StringUtils.equals(type, HrConstants.MAX_BAL_ACTION_FREQ.LEAVE_APPROVE))
172 return true;
173 else
174 return false;
175
176
177 }
178
179 public void setOnLeaveApproval(boolean onLeaveApproval) {
180 this.onLeaveApproval = onLeaveApproval;
181 }
182
183 public void isTimesheet(boolean b) {
184 timesheet = true;
185 }
186
187 public boolean isSstoTransfer() {
188 if(this.getBalanceTransfer() != null) {
189 if(StringUtils.isNotEmpty(this.getBalanceTransfer().getSstoId()))
190 return true;
191 else
192 return false;
193 }
194 else
195 return false;
196 }
197
198 }