1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.kuali.ole.pdp.businessobject;
21
22 import java.util.LinkedHashMap;
23
24 import org.apache.commons.lang.builder.EqualsBuilder;
25 import org.apache.commons.lang.builder.HashCodeBuilder;
26 import org.apache.commons.lang.builder.ToStringBuilder;
27 import org.kuali.ole.pdp.PdpConstants;
28 import org.kuali.ole.pdp.PdpPropertyConstants;
29 import org.kuali.ole.pdp.service.PaymentGroupService;
30 import org.kuali.ole.sys.context.SpringContext;
31 import org.kuali.rice.core.api.util.type.KualiDecimal;
32 import org.kuali.rice.core.api.util.type.KualiInteger;
33 import org.kuali.rice.krad.bo.TransientBusinessObjectBase;
34
35
36
37
38
39 public class FormatResult extends TransientBusinessObjectBase implements Comparable {
40 private Integer procId;
41 private boolean pymtAttachment;
42 private boolean pymtSpecialHandling;
43 private boolean processImmediate;
44 private CustomerProfile cust;
45 private int payments;
46 private KualiDecimal amount;
47 private DisbursementType disbursementType;
48 private int beginDisbursementNbr;
49 private int endDisbursementNbr;
50 private KualiInteger sortGroup;
51
52
53 public FormatResult() {
54 super();
55 amount = KualiDecimal.ZERO;
56 payments = 0;
57 }
58
59 public FormatResult(Integer p, CustomerProfile c) {
60 procId = p;
61 cust = c;
62 amount = KualiDecimal.ZERO;
63 payments = 0;
64 }
65
66 public KualiInteger getSortGroupId() {
67
68 return sortGroup;
69 }
70
71 public KualiInteger getSortGroupOverride() {
72 return sortGroup;
73 }
74
75 public void setSortGroupOverride(KualiInteger sortGroup) {
76 this.sortGroup = sortGroup;
77 }
78
79 public boolean isProcessImmediate() {
80 return processImmediate;
81 }
82
83 public void setProcessImmediate(boolean processImmediate) {
84 this.processImmediate = processImmediate;
85 }
86
87 public boolean isPymtAttachment() {
88 return pymtAttachment;
89 }
90
91 public void setPymtAttachment(boolean pymtAttachment) {
92 this.pymtAttachment = pymtAttachment;
93 }
94
95 public boolean isPymtSpecialHandling() {
96 return pymtSpecialHandling;
97 }
98
99 public void setPymtSpecialHandling(boolean pymtSpecialHandling) {
100 this.pymtSpecialHandling = pymtSpecialHandling;
101 }
102
103 public int getBeginDisbursementNbr() {
104 return beginDisbursementNbr;
105 }
106
107 public void setBeginDisbursementNbr(int beginDisbursementNbr) {
108 this.beginDisbursementNbr = beginDisbursementNbr;
109 }
110
111 public DisbursementType getDisbursementType() {
112 return disbursementType;
113 }
114
115 public void setDisbursementType(DisbursementType disbursementType) {
116 this.disbursementType = disbursementType;
117 }
118
119 public int getEndDisbursementNbr() {
120 return endDisbursementNbr;
121 }
122
123 public void setEndDisbursementNbr(int endDisbursementNbr) {
124 this.endDisbursementNbr = endDisbursementNbr;
125 }
126
127 public KualiDecimal getAmount() {
128 return amount;
129 }
130
131 public void setAmount(KualiDecimal amount) {
132 this.amount = amount;
133 }
134
135 public CustomerProfile getCust() {
136 return cust;
137 }
138
139 public void setCust(CustomerProfile cust) {
140 this.cust = cust;
141 }
142
143 public int getPayments() {
144 return payments;
145 }
146
147 public void setPayments(int payments) {
148 this.payments = payments;
149 }
150
151 public Integer getProcId() {
152 return procId;
153 }
154
155 public void setProcId(Integer procId) {
156 this.procId = procId;
157 }
158
159 public String getSortString() {
160 StringBuffer sb = new StringBuffer();
161 if (getDisbursementType() != null) {
162 if (PdpConstants.DisbursementTypeCodes.CHECK.equals(getDisbursementType().getCode())) {
163 sb.append("B");
164 }
165 else {
166 sb.append("A");
167 }
168 }
169 else {
170 sb.append("A");
171 }
172 sb.append(getSortGroupId());
173 sb.append(cust.getChartCode());
174 sb.append(cust.getUnitCode());
175 sb.append(cust.getSubUnitCode());
176 return sb.toString();
177 }
178
179 public int compareTo(Object a) {
180 FormatResult f = (FormatResult) a;
181
182 return this.getSortString().compareTo(f.getSortString());
183 }
184
185 public boolean equals(Object obj) {
186 if (!(obj instanceof FormatResult)) {
187 return false;
188 }
189 FormatResult o = (FormatResult) obj;
190 return new EqualsBuilder().append(procId, o.getProcId()).append(getSortGroupId(), o.getSortGroupId()).append(cust, o.getCust()).isEquals();
191 }
192
193 public int hashCode() {
194 return new HashCodeBuilder(7, 3).append(procId).append(getSortGroupId()).append(cust).toHashCode();
195 }
196
197 public String toString() {
198 return new ToStringBuilder(this).append("procId", procId).append("sortGroupId", getSortGroupId()).append("cust", cust).toString();
199 }
200
201
202 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
203 LinkedHashMap m = new LinkedHashMap();
204
205 m.put(PdpPropertyConstants.FormatResult.PROC_ID, this.procId);
206
207 return m;
208 }
209
210 public String getSortGroupName(){
211 PaymentGroupService paymentGroupService = SpringContext.getBean(PaymentGroupService.class);
212 String sortGroupName = paymentGroupService.getSortGroupName(sortGroup.intValue());
213 return sortGroupName;
214 }
215
216 public void setSortGroupName(){
217
218 }
219 }