1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.service.impl;
17
18 import java.util.Arrays;
19
20 import org.kuali.ole.coa.service.BalanceTypeService;
21 import org.kuali.ole.gl.ObjectHelper;
22 import org.kuali.ole.gl.businessobject.OriginEntryFull;
23 import org.kuali.ole.sys.context.SpringContext;
24
25
26
27
28 public class OriginEntryKey {
29 static BalanceTypeService balanceTypService = SpringContext.getBean(BalanceTypeService.class);
30
31
32
33
34
35
36 public boolean equals(Object obj) {
37 if (!(obj instanceof OriginEntryKey) || null == obj) {
38 return false;
39 }
40
41 OriginEntryKey key = (OriginEntryKey) obj;
42 return ObjectHelper.isEqual(getAccountNumber(), key.getAccountNumber()) && ObjectHelper.isEqual(getBalanceTypeCode(), key.getBalanceTypeCode()) && ObjectHelper.isEqual(getChartCode(), key.getChartCode()) && ObjectHelper.isEqual(getFinancialSystemDocumentTypeCodeCode(), key.getFinancialSystemDocumentTypeCodeCode()) && ObjectHelper.isEqual(getEntrySequenceNumber(), key.getEntrySequenceNumber()) && ObjectHelper.isEqual(getDocumentNumber(), key.getDocumentNumber()) && ObjectHelper.isEqual(getFinancialObjectCode(), key.getFinancialObjectCode()) && ObjectHelper.isEqual(getFiscalPeriodCode(), key.getFiscalPeriodCode()) && ObjectHelper.isEqual(getFiscalYear(), key.getFiscalYear()) && ObjectHelper.isEqual(getObjectTypeCode(), key.getObjectTypeCode()) && ObjectHelper.isEqual(getSubAccountNumber(), key.getSubAccountNumber()) && ObjectHelper.isEqual(getSubObjectCode(), key.getSubObjectCode()) && ObjectHelper.isEqual(getSystemOriginationCode(), key.getSystemOriginationCode());
43 }
44
45
46
47
48
49 static public OriginEntryKey buildFromOriginEntry(OriginEntryFull entry) {
50 if (null == entry) {
51 return null;
52 }
53
54 OriginEntryKey key = new OriginEntryKey();
55 key.setAccountNumber(entry.getAccountNumber());
56 key.setBalanceTypeCode(entry.getFinancialBalanceTypeCode());
57 key.setChartCode(entry.getChartOfAccountsCode());
58 key.setFinancialSystemDocumentTypeCodeCode(entry.getFinancialDocumentTypeCode());
59 key.setEntrySequenceNumber(entry.getTransactionLedgerEntrySequenceNumber().toString());
60 key.setDocumentNumber(entry.getDocumentNumber());
61 key.setFinancialObjectCode(entry.getFinancialObjectCode());
62 key.setFiscalPeriodCode(entry.getUniversityFiscalPeriodCode());
63 key.setFiscalYear(entry.getUniversityFiscalYear().toString());
64 key.setObjectTypeCode(entry.getFinancialObjectTypeCode());
65 key.setSubAccountNumber(entry.getSubAccountNumber());
66 key.setSubObjectCode(entry.getFinancialSubObjectCode());
67 key.setSystemOriginationCode(entry.getFinancialSystemOriginationCode());
68 return key;
69 }
70
71
72
73
74 public void setIntoOriginEntry(OriginEntryFull entry) {
75 entry.setAccountNumber(getAccountNumber());
76 entry.setBalanceType(balanceTypService.getBalanceTypeByCode(getBalanceTypeCode()));
77 entry.setChartOfAccountsCode(getChartCode());
78 entry.setTransactionLedgerEntrySequenceNumber(new Integer(getEntrySequenceNumber()));
79 entry.setDocumentNumber(getDocumentNumber());
80 entry.setFinancialObjectCode(getFinancialObjectCode());
81 entry.setUniversityFiscalPeriodCode(getFiscalPeriodCode());
82 entry.setUniversityFiscalYear(new Integer(getFiscalYear()));
83 entry.setFinancialObjectTypeCode(getObjectTypeCode());
84 entry.setSubAccountNumber(getSubAccountNumber());
85 entry.setFinancialSubObjectCode(getSubObjectCode());
86 entry.setFinancialSystemOriginationCode(getSystemOriginationCode());
87 entry.setFinancialDocumentTypeCode(getFinancialSystemDocumentTypeCodeCode());
88 }
89
90
91
92
93 public String getAccountNumber() {
94 return new String(accountNumber);
95 }
96
97
98
99
100 public void setAccountNumber(String accountNumber) {
101 if (null != accountNumber) {
102 System.arraycopy(accountNumber.toCharArray(), 0, this.accountNumber, 0, this.accountNumber.length);
103 }
104 else {
105 Arrays.fill(this.accountNumber, (char) 0);
106 }
107 }
108
109
110
111
112 public String getBalanceTypeCode() {
113 return new String(balanceTypeCode);
114 }
115
116
117
118
119 public void setBalanceTypeCode(String balanceTypeCode) {
120 if (null != balanceTypeCode) {
121 System.arraycopy(balanceTypeCode.toCharArray(), 0, this.balanceTypeCode, 0, this.balanceTypeCode.length);
122 }
123 else {
124 Arrays.fill(this.balanceTypeCode, (char) 0);
125 }
126 }
127
128
129
130
131 public String getChartCode() {
132 return new String(chartCode);
133 }
134
135
136
137
138 public void setChartCode(String chartCode) {
139 if (null != chartCode) {
140 System.arraycopy(chartCode, 0, this.chartCode, 0, this.chartCode.length);
141 }
142 else {
143 Arrays.fill(this.chartCode, (char) 0);
144 }
145 }
146
147
148
149
150 public String getFinancialSystemDocumentTypeCodeCode() {
151 return new String(financialSystemDocumentTypeCodeCode);
152 }
153
154
155
156
157 public void setFinancialSystemDocumentTypeCodeCode(String financialSystemDocumentTypeCodeCode) {
158 if (null != financialSystemDocumentTypeCodeCode) {
159 System.arraycopy(financialSystemDocumentTypeCodeCode.toCharArray(), 0, this.financialSystemDocumentTypeCodeCode, 0, this.financialSystemDocumentTypeCodeCode.length);
160 }
161 else {
162 Arrays.fill(this.financialSystemDocumentTypeCodeCode, (char) 0);
163 }
164 }
165
166
167
168
169 public String getEntrySequenceNumber() {
170 return new String(entrySequenceNumber);
171 }
172
173
174
175
176 public void setEntrySequenceNumber(String entrySequenceNumber) {
177 if (null != entrySequenceNumber) {
178 System.arraycopy(entrySequenceNumber, 0, this.entrySequenceNumber, 0, this.entrySequenceNumber.length);
179 }
180 else {
181 Arrays.fill(this.entrySequenceNumber, (char) 0);
182 }
183 }
184
185
186
187
188 public String getDocumentNumber() {
189 return new String(documentNumber);
190 }
191
192
193
194
195 public void setDocumentNumber(String documentNumber) {
196 if (null != documentNumber) {
197 System.arraycopy(documentNumber, 0, this.documentNumber, 0, this.documentNumber.length);
198 }
199 else {
200 Arrays.fill(this.documentNumber, (char) 0);
201 }
202 }
203
204
205
206
207 public String getFinancialObjectCode() {
208 return new String(financialObjectCode);
209 }
210
211
212
213
214 public void setFinancialObjectCode(String financialObjectCode) {
215 if (null != financialObjectCode) {
216 System.arraycopy(financialObjectCode, 0, this.financialObjectCode, 0, this.financialObjectCode.length);
217 }
218 else {
219 Arrays.fill(this.financialObjectCode, (char) 0);
220 }
221 }
222
223
224
225
226 public String getFiscalPeriodCode() {
227 return new String(fiscalPeriodCode);
228 }
229
230
231
232
233 public void setFiscalPeriodCode(String fiscalPeriodCode) {
234 if (null != fiscalPeriodCode) {
235 System.arraycopy(fiscalPeriodCode, 0, this.fiscalPeriodCode, 0, this.fiscalPeriodCode.length);
236 }
237 else {
238 Arrays.fill(this.fiscalPeriodCode, (char) 0);
239 }
240 }
241
242
243
244
245 public String getFiscalYear() {
246 return new String(fiscalYear);
247 }
248
249
250
251
252 public void setFiscalYear(String fiscalYear) {
253 if (null != fiscalYear) {
254 System.arraycopy(fiscalYear, 0, this.fiscalYear, 0, this.fiscalYear.length);
255 }
256 else {
257 Arrays.fill(this.fiscalYear, (char) 0);
258 }
259 }
260
261
262
263
264 public String getObjectTypeCode() {
265 return new String(objectTypeCode);
266 }
267
268
269
270
271 public void setObjectTypeCode(String objectTypeCode) {
272 if (null != objectTypeCode) {
273 System.arraycopy(objectTypeCode, 0, this.objectTypeCode, 0, this.objectTypeCode.length);
274 }
275 else {
276 Arrays.fill(this.objectTypeCode, (char) 0);
277 }
278 }
279
280
281
282
283 public String getSubAccountNumber() {
284 return new String(subAccountNumber);
285 }
286
287
288
289
290 public void setSubAccountNumber(String subAccountNumber) {
291 if (null != subAccountNumber) {
292 System.arraycopy(subAccountNumber, 0, this.subAccountNumber, 0, this.subAccountNumber.length);
293 }
294 else {
295 Arrays.fill(this.subAccountNumber, (char) 0);
296 }
297 }
298
299
300
301
302 public String getSubObjectCode() {
303 return new String(subObjectCode);
304 }
305
306
307
308
309 public void setSubObjectCode(String subObjectCode) {
310 if (null != subObjectCode) {
311 System.arraycopy(subObjectCode, 0, this.subObjectCode, 0, this.subObjectCode.length);
312 }
313 else {
314 Arrays.fill(this.subObjectCode, (char) 0);
315 }
316 }
317
318
319
320
321 public String getSystemOriginationCode() {
322 return new String(systemOriginationCode);
323 }
324
325
326
327
328 public void setSystemOriginationCode(String systemOriginationCode) {
329 if (null != systemOriginationCode) {
330 System.arraycopy(systemOriginationCode.toCharArray(), 0, this.systemOriginationCode, 0, this.systemOriginationCode.length);
331 }
332 else {
333 Arrays.fill(this.systemOriginationCode, (char) 0);
334 }
335 }
336
337 public OriginEntryKey() {
338 super();
339 }
340
341 final private char[] fiscalYear = new char[4];
342
343 final private char[] chartCode = new char[2];
344
345 final private char[] accountNumber = new char[7];
346
347 final private char[] subAccountNumber = new char[5];
348
349 final private char[] financialObjectCode = new char[4];
350
351 final private char[] subObjectCode = new char[3];
352
353 final private char[] balanceTypeCode = new char[2];
354
355 final private char[] objectTypeCode = new char[2];
356
357 final private char[] fiscalPeriodCode = new char[2];
358
359 final private char[] financialSystemDocumentTypeCodeCode = new char[4];
360
361 final private char[] systemOriginationCode = new char[2];
362
363 final private char[] documentNumber = new char[9];
364
365 final private char[] entrySequenceNumber = new char[5];
366 }