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