1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.businessobject;
17
18 import java.sql.Date;
19 import java.text.ParseException;
20 import java.text.SimpleDateFormat;
21 import java.util.ArrayList;
22 import java.util.LinkedHashMap;
23 import java.util.List;
24 import java.util.Map;
25 import java.util.regex.Matcher;
26 import java.util.regex.Pattern;
27
28 import org.apache.commons.lang.StringUtils;
29 import org.kuali.ole.coa.businessobject.A21SubAccount;
30 import org.kuali.ole.coa.businessobject.Account;
31 import org.kuali.ole.coa.businessobject.AccountingPeriod;
32 import org.kuali.ole.coa.businessobject.BalanceType;
33 import org.kuali.ole.coa.businessobject.Chart;
34 import org.kuali.ole.coa.businessobject.ObjectCode;
35 import org.kuali.ole.coa.businessobject.ObjectType;
36 import org.kuali.ole.coa.businessobject.ProjectCode;
37 import org.kuali.ole.coa.businessobject.SubAccount;
38 import org.kuali.ole.coa.businessobject.SubObjectCode;
39 import org.kuali.ole.coa.service.AccountService;
40 import org.kuali.ole.gl.GeneralLedgerConstants;
41 import org.kuali.ole.gl.exception.LoadException;
42 import org.kuali.ole.sys.OLEConstants;
43 import org.kuali.ole.sys.OLEPropertyConstants;
44 import org.kuali.ole.sys.Message;
45 import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry;
46 import org.kuali.ole.sys.businessobject.OriginationCode;
47 import org.kuali.ole.sys.businessobject.SystemOptions;
48 import org.kuali.ole.sys.businessobject.UniversityDate;
49 import org.kuali.ole.sys.context.SpringContext;
50 import org.kuali.rice.core.api.datetime.DateTimeService;
51 import org.kuali.rice.core.api.util.type.KualiDecimal;
52 import org.kuali.rice.kew.api.doctype.DocumentTypeService;
53 import org.kuali.rice.kew.doctype.bo.DocumentType;
54 import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
55 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
56
57
58
59
60 public class OriginEntryFull extends PersistableBusinessObjectBase implements Transaction, OriginEntryInformation, FlexibleAccountUpdateable {
61 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OriginEntryFull.class);
62 private static OriginEntryFieldUtil originEntryFieldUtil;
63
64 public static final Pattern MATCH_CONTROL_CHARACTERS = Pattern.compile("\\p{Cntrl}");
65 public static final String REPLACE_MATCHED_CONTROL_CHARACTERS = " ";
66
67
68
69
70
71 private Integer entryId;
72 private Integer entryGroupId;
73 protected String accountNumber;
74 protected String documentNumber;
75 protected String referenceFinancialDocumentNumber;
76 protected String referenceFinancialDocumentTypeCode;
77 protected Date financialDocumentReversalDate;
78 protected String financialDocumentTypeCode;
79 protected String financialBalanceTypeCode;
80 protected String chartOfAccountsCode;
81 protected String financialObjectTypeCode;
82 protected String financialObjectCode;
83 protected String financialSubObjectCode;
84 protected String financialSystemOriginationCode;
85 protected String referenceFinancialSystemOriginationCode;
86 protected String organizationDocumentNumber;
87 protected String organizationReferenceId;
88 protected String projectCode;
89 protected String subAccountNumber;
90 protected Date transactionDate;
91 protected String transactionDebitCreditCode;
92 protected String transactionEncumbranceUpdateCode;
93 protected Integer transactionLedgerEntrySequenceNumber;
94 protected KualiDecimal transactionLedgerEntryAmount;
95 protected String transactionLedgerEntryDescription;
96 protected String universityFiscalPeriodCode;
97 protected Integer universityFiscalYear;
98 private boolean transactionScrubberOffsetGenerationIndicator;
99
100
101 private OriginEntryGroup group;
102 private Account account;
103 private SubAccount subAccount;
104 private A21SubAccount a21SubAccount;
105 private BalanceType balanceType;
106 private Chart chart;
107 private ObjectCode financialObject;
108 private SubObjectCode financialSubObject;
109 private ObjectType objectType;
110 private ProjectCode project;
111 private DocumentTypeEBO financialSystemDocumentTypeCode;
112 private UniversityDate universityDate;
113 private SystemOptions option;
114 private AccountingPeriod accountingPeriod;
115 private UniversityDate reversalDate;
116 private OriginationCode origination;
117 private DocumentTypeEBO referenceFinancialSystemDocumentTypeCode;
118
119 private static final String DATE_FORMAT = "yyyy-MM-dd";
120
121 public void copyFieldsFromTransaction(Transaction t) {
122 setAccountNumber(t.getAccountNumber());
123 setDocumentNumber(t.getDocumentNumber());
124 setReferenceFinancialDocumentNumber(t.getReferenceFinancialDocumentNumber());
125 setReferenceFinancialDocumentTypeCode(t.getReferenceFinancialDocumentTypeCode());
126 setFinancialDocumentReversalDate(t.getFinancialDocumentReversalDate());
127 setFinancialDocumentTypeCode(t.getFinancialDocumentTypeCode());
128 setFinancialBalanceTypeCode(t.getFinancialBalanceTypeCode());
129 setChartOfAccountsCode(t.getChartOfAccountsCode());
130 setFinancialObjectTypeCode(t.getFinancialObjectTypeCode());
131 setFinancialObjectCode(t.getFinancialObjectCode());
132 setFinancialSubObjectCode(t.getFinancialSubObjectCode());
133 setFinancialSystemOriginationCode(t.getFinancialSystemOriginationCode());
134 setReferenceFinancialSystemOriginationCode(t.getReferenceFinancialSystemOriginationCode());
135 setOrganizationDocumentNumber(t.getOrganizationDocumentNumber());
136 setOrganizationReferenceId(t.getOrganizationReferenceId());
137 setProjectCode(t.getProjectCode());
138 setSubAccountNumber(t.getSubAccountNumber());
139 setTransactionDate(t.getTransactionDate());
140 setTransactionDebitCreditCode(t.getTransactionDebitCreditCode());
141 setTransactionEncumbranceUpdateCode(t.getTransactionEncumbranceUpdateCode());
142 setTransactionLedgerEntrySequenceNumber(t.getTransactionLedgerEntrySequenceNumber());
143 setTransactionLedgerEntryAmount(t.getTransactionLedgerEntryAmount());
144 setTransactionLedgerEntryDescription(t.getTransactionLedgerEntryDescription());
145 setUniversityFiscalPeriodCode(t.getUniversityFiscalPeriodCode());
146 setUniversityFiscalYear(t.getUniversityFiscalYear());
147 }
148
149 protected java.sql.Date parseDate(String sdate, boolean beLenientWithDates) throws ParseException {
150 if ((sdate == null) || (sdate.trim().length() == 0)) {
151 return null;
152 }
153 else {
154
155 SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
156 sdf.setLenient(beLenientWithDates);
157
158 java.util.Date d = sdf.parse(sdate);
159 return new Date(d.getTime());
160 }
161 }
162
163 protected String formatDate(Date date) {
164 if (date == null) {
165 return GeneralLedgerConstants.getSpaceTransactionDate();
166 }
167 else {
168 SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
169 return sdf.format(date);
170 }
171 }
172
173 protected String getValue(String line, int s, int e) {
174
175 return org.springframework.util.StringUtils.trimTrailingWhitespace(StringUtils.substring(line, s, e));
176 }
177
178
179
180
181
182
183
184
185
186
187 public List<Message> setFromTextFileForBatch(String line, int lineNumber) throws LoadException {
188 List<Message> returnList = new ArrayList<Message>();
189 final Map<String, Integer> pMap = getOriginEntryFieldUtil().getFieldBeginningPositionMap();
190
191
192 Matcher controlCharacterMatcher = MATCH_CONTROL_CHARACTERS.matcher(line);
193 line = controlCharacterMatcher.replaceAll(REPLACE_MATCHED_CONTROL_CHARACTERS);
194
195
196 line = org.apache.commons.lang.StringUtils.rightPad(line, GeneralLedgerConstants.getSpaceAllOriginEntryFields().length(), ' ');
197
198 if (!GeneralLedgerConstants.getSpaceUniversityFiscalYear().equals(line.substring(pMap.get(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR), pMap.get(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE)))) {
199 try {
200 setUniversityFiscalYear(new Integer(getValue(line, pMap.get(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR), pMap.get(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE))));
201 }
202 catch (NumberFormatException e) {
203 returnList.add(new Message("Fiscal year '" + line.substring(pMap.get(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR), pMap.get(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE)) + "' contains an invalid value." , Message.TYPE_FATAL));
204 setUniversityFiscalYear(null);
205 }
206 }
207 else {
208 setUniversityFiscalYear(null);
209 }
210
211 setChartOfAccountsCode(getValue(line, pMap.get(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE), pMap.get(OLEPropertyConstants.ACCOUNT_NUMBER)));
212 setAccountNumber(getValue(line, pMap.get(OLEPropertyConstants.ACCOUNT_NUMBER), pMap.get(OLEPropertyConstants.SUB_ACCOUNT_NUMBER)));
213
214
215 AccountService acctserv = SpringContext.getBean(AccountService.class);
216 if (StringUtils.isEmpty(getChartOfAccountsCode()) && StringUtils.isNotEmpty(getAccountNumber()) && !acctserv.accountsCanCrossCharts()) {
217 Account account = acctserv.getUniqueAccountForAccountNumber(getAccountNumber());
218 if (account != null) {
219 setChartOfAccountsCode(account.getChartOfAccountsCode());
220 }
221 }
222
223 setSubAccountNumber(getValue(line, pMap.get(OLEPropertyConstants.SUB_ACCOUNT_NUMBER), pMap.get(OLEPropertyConstants.FINANCIAL_OBJECT_CODE)));
224 setFinancialObjectCode(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_OBJECT_CODE), pMap.get(OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE)));
225 setFinancialSubObjectCode(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE), pMap.get(OLEPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE)));
226 setFinancialBalanceTypeCode(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE), pMap.get(OLEPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE)));
227 setFinancialObjectTypeCode(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE), pMap.get(OLEPropertyConstants.UNIVERSITY_FISCAL_PERIOD_CODE)));
228 setUniversityFiscalPeriodCode(getValue(line, pMap.get(OLEPropertyConstants.UNIVERSITY_FISCAL_PERIOD_CODE), pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE)));
229 setFinancialDocumentTypeCode(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE), pMap.get(OLEPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE)));
230 setFinancialSystemOriginationCode(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE), pMap.get(OLEPropertyConstants.DOCUMENT_NUMBER)));
231 setDocumentNumber(getValue(line, pMap.get(OLEPropertyConstants.DOCUMENT_NUMBER), pMap.get(OLEPropertyConstants.TRANSACTION_ENTRY_SEQUENCE_NUMBER)));
232
233
234 if (!GeneralLedgerConstants.getSpaceTransactionEntrySequenceNumber().equals(line.substring(pMap.get(OLEPropertyConstants.TRANSACTION_ENTRY_SEQUENCE_NUMBER), pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC))) && !GeneralLedgerConstants.getZeroTransactionEntrySequenceNumber().equals(getValue(line, pMap.get(OLEPropertyConstants.TRANSACTION_ENTRY_SEQUENCE_NUMBER), pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC)))) {
235 try {
236 setTransactionLedgerEntrySequenceNumber(new Integer(getValue(line, pMap.get(OLEPropertyConstants.TRANSACTION_ENTRY_SEQUENCE_NUMBER), pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC))));
237 }
238 catch (NumberFormatException e) {
239 returnList.add(new Message("Transaction Sequence Number '" + line.substring(pMap.get(OLEPropertyConstants.TRANSACTION_ENTRY_SEQUENCE_NUMBER), pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC)) + "' contains an invalid value." , Message.TYPE_FATAL));
240 setTransactionLedgerEntrySequenceNumber(null);
241 }
242 }
243 else {
244 setTransactionLedgerEntrySequenceNumber(null);
245 }
246
247 setTransactionLedgerEntryDescription(getValue(line, pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC), pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT)));
248
249 if (!getValue(line, pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT), pMap.get(OLEPropertyConstants.TRANSACTION_DEBIT_CREDIT_CODE)).equals(GeneralLedgerConstants.EMPTY_CODE)){
250 try {
251 setTransactionLedgerEntryAmount(new KualiDecimal(getValue(line, pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT), pMap.get(OLEPropertyConstants.TRANSACTION_DEBIT_CREDIT_CODE)).trim()));
252 }
253 catch (NumberFormatException e) {
254 returnList.add(new Message("Transaction Amount '" + line.substring(pMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT), pMap.get(OLEPropertyConstants.TRANSACTION_DEBIT_CREDIT_CODE)) + "' contains an invalid value." , Message.TYPE_FATAL));
255 setTransactionLedgerEntryAmount(KualiDecimal.ZERO);
256 }
257 } else {
258 returnList.add(new Message("Transaction Amount cannot be blank." , Message.TYPE_FATAL));
259 setTransactionLedgerEntryAmount(KualiDecimal.ZERO);
260 }
261
262 setTransactionDebitCreditCode(line.substring(pMap.get(OLEPropertyConstants.TRANSACTION_DEBIT_CREDIT_CODE), pMap.get(OLEPropertyConstants.TRANSACTION_DATE)));
263
264 if (!getValue(line, pMap.get(OLEPropertyConstants.TRANSACTION_DATE), pMap.get(OLEPropertyConstants.ORGANIZATION_DOCUMENT_NUMBER)).equals(GeneralLedgerConstants.EMPTY_CODE)){
265
266 try {
267 setTransactionDate(parseDate(getValue(line, pMap.get(OLEPropertyConstants.TRANSACTION_DATE), pMap.get(OLEPropertyConstants.ORGANIZATION_DOCUMENT_NUMBER)), false));
268 }
269 catch (ParseException e) {
270 setTransactionDate(SpringContext.getBean(DateTimeService.class).getCurrentSqlDate());
271 }
272 } else {
273 setTransactionDate(null);
274 }
275
276 setOrganizationDocumentNumber(getValue(line, pMap.get(OLEPropertyConstants.ORGANIZATION_DOCUMENT_NUMBER), pMap.get(OLEPropertyConstants.PROJECT_CODE)));
277 setProjectCode(getValue(line, pMap.get(OLEPropertyConstants.PROJECT_CODE), pMap.get(OLEPropertyConstants.ORGANIZATION_REFERENCE_ID)));
278 setOrganizationReferenceId(getValue(line, pMap.get(OLEPropertyConstants.ORGANIZATION_REFERENCE_ID), pMap.get(OLEPropertyConstants.REFERENCE_FIN_DOCUMENT_TYPE_CODE)));
279 setReferenceFinancialDocumentTypeCode(getValue(line, pMap.get(OLEPropertyConstants.REFERENCE_FIN_DOCUMENT_TYPE_CODE), pMap.get(OLEPropertyConstants.FIN_SYSTEM_REF_ORIGINATION_CODE)));
280 setReferenceFinancialSystemOriginationCode(getValue(line, pMap.get(OLEPropertyConstants.FIN_SYSTEM_REF_ORIGINATION_CODE), pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_REFERENCE_NBR)));
281 setReferenceFinancialDocumentNumber(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_REFERENCE_NBR), pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_REVERSAL_DATE)));
282
283 if (!getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_REVERSAL_DATE), pMap.get(OLEPropertyConstants.TRANSACTION_ENCUMBRANCE_UPDT_CD)).equals(GeneralLedgerConstants.EMPTY_CODE)){
284 try {
285 setFinancialDocumentReversalDate(parseDate(getValue(line, pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_REVERSAL_DATE), pMap.get(OLEPropertyConstants.TRANSACTION_ENCUMBRANCE_UPDT_CD)), false));
286 }
287 catch (ParseException e) {
288 setFinancialDocumentReversalDate(null);
289 returnList.add(new Message("Reversal Date '" + line.substring(pMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_REVERSAL_DATE), pMap.get(OLEPropertyConstants.TRANSACTION_ENCUMBRANCE_UPDT_CD)) + "' contains an invalid value." , Message.TYPE_FATAL));
290
291 }
292 } else {
293 setFinancialDocumentReversalDate(null);
294 }
295
296
297 setTransactionEncumbranceUpdateCode(line.substring(pMap.get(OLEPropertyConstants.TRANSACTION_ENCUMBRANCE_UPDT_CD), GeneralLedgerConstants.getSpaceAllOriginEntryFields().length()));
298
299 return returnList;
300 }
301
302
303 protected String getField(int size, String value) {
304 if (value == null) {
305 return GeneralLedgerConstants.getSpaceAllOriginEntryFields().substring(0, size);
306 }
307 else {
308 if (value.length() < size) {
309 return value + GeneralLedgerConstants.getSpaceAllOriginEntryFields().substring(0, size - value.length());
310 }
311 else {
312 return value.substring(0, size);
313 }
314 }
315 }
316
317 @Override
318 public String getLine() {
319 StringBuffer sb = new StringBuffer();
320 Map<String, Integer> fieldLengthMap = getOriginEntryFieldUtil().getFieldLengthMap();
321
322 if (universityFiscalYear == null) {
323 sb.append(GeneralLedgerConstants.getSpaceUniversityFiscalYear());
324 }
325 else {
326 sb.append(universityFiscalYear);
327 }
328
329 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE), chartOfAccountsCode));
330 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.ACCOUNT_NUMBER), accountNumber));
331 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.SUB_ACCOUNT_NUMBER), subAccountNumber));
332 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FINANCIAL_OBJECT_CODE), financialObjectCode));
333 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE), financialSubObjectCode));
334 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE), financialBalanceTypeCode));
335 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE), financialObjectTypeCode));
336 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.UNIVERSITY_FISCAL_PERIOD_CODE), universityFiscalPeriodCode));
337 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE), financialDocumentTypeCode));
338 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE), financialSystemOriginationCode));
339 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.DOCUMENT_NUMBER), documentNumber));
340
341
342
343
344
345
346
347
348
349
350
351
352 String seqNum ="";
353 if (transactionLedgerEntrySequenceNumber != null) {
354 seqNum = transactionLedgerEntrySequenceNumber.toString();
355 }
356
357 sb.append(StringUtils.leftPad(seqNum.trim(), fieldLengthMap.get(OLEPropertyConstants.TRANSACTION_ENTRY_SEQUENCE_NUMBER), "0"));
358
359 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_DESC), transactionLedgerEntryDescription));
360 if (transactionLedgerEntryAmount == null) {
361 sb.append(GeneralLedgerConstants.getZeroTransactionLedgerEntryAmount());
362 }
363 else {
364 String a = transactionLedgerEntryAmount.abs().toString();
365 if (transactionLedgerEntryAmount.isNegative()) {
366 sb.append("-");
367 } else {
368 sb.append("+");
369 }
370 sb.append(GeneralLedgerConstants.getZeroTransactionLedgerEntryAmount().substring(1, fieldLengthMap.get(OLEPropertyConstants.TRANSACTION_LEDGER_ENTRY_AMOUNT) - a.length()));
371 sb.append(a);
372 }
373 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.TRANSACTION_DEBIT_CREDIT_CODE), transactionDebitCreditCode));
374 sb.append(formatDate(transactionDate));
375 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.ORGANIZATION_DOCUMENT_NUMBER), organizationDocumentNumber));
376 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.PROJECT_CODE), projectCode));
377 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.ORGANIZATION_REFERENCE_ID), organizationReferenceId));
378 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.REFERENCE_FIN_DOCUMENT_TYPE_CODE), referenceFinancialDocumentTypeCode));
379 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FIN_SYSTEM_REF_ORIGINATION_CODE), referenceFinancialSystemOriginationCode));
380 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.FINANCIAL_DOCUMENT_REFERENCE_NBR), referenceFinancialDocumentNumber));
381 sb.append(formatDate(financialDocumentReversalDate));
382 sb.append(getField(fieldLengthMap.get(OLEPropertyConstants.TRANSACTION_ENCUMBRANCE_UPDT_CD), transactionEncumbranceUpdateCode));
383
384 while (GeneralLedgerConstants.getSpaceAllOriginEntryFields().length() > sb.toString().length()) {
385 sb.append(' ');
386 }
387
388
389 Matcher controlCharacterMatcher = MATCH_CONTROL_CHARACTERS.matcher(sb);
390 String returnString = controlCharacterMatcher.replaceAll(REPLACE_MATCHED_CONTROL_CHARACTERS);
391
392 return returnString;
393 }
394
395 public boolean isTransactionScrubberOffsetGenerationIndicator() {
396 return transactionScrubberOffsetGenerationIndicator;
397 }
398
399 @Override
400 public void setTransactionScrubberOffsetGenerationIndicator(boolean transactionScrubberOffsetGenerationIndicator) {
401 this.transactionScrubberOffsetGenerationIndicator = transactionScrubberOffsetGenerationIndicator;
402 }
403
404 @Override
405 public String getAccountNumber() {
406 return accountNumber;
407 }
408
409 @Override
410 public void setAccountNumber(String accountNumber) {
411 this.accountNumber = accountNumber;
412 }
413
414 @Override
415 public String getFinancialBalanceTypeCode() {
416 return financialBalanceTypeCode;
417 }
418
419 @Override
420 public void setFinancialBalanceTypeCode(String financialBalanceTypeCode) {
421 this.financialBalanceTypeCode = financialBalanceTypeCode;
422 }
423
424 @Override
425 public String getChartOfAccountsCode() {
426 return chartOfAccountsCode;
427 }
428
429 @Override
430 public void setChartOfAccountsCode(String chartOfAccountsCode) {
431 this.chartOfAccountsCode = chartOfAccountsCode;
432 }
433
434 @Override
435 public String getTransactionDebitCreditCode() {
436 return transactionDebitCreditCode;
437 }
438
439 @Override
440 public void setTransactionDebitCreditCode(String transactionDebitCreditCode) {
441 if (transactionDebitCreditCode != null) {
442 this.transactionDebitCreditCode = transactionDebitCreditCode.toUpperCase();
443 }
444 }
445
446 @Override
447 public String getDocumentNumber() {
448 return documentNumber;
449 }
450
451 @Override
452 public void setDocumentNumber(String documentNumber) {
453 this.documentNumber = documentNumber;
454 }
455
456 @Override
457 public Date getFinancialDocumentReversalDate() {
458 return financialDocumentReversalDate;
459 }
460
461 @Override
462 public void setFinancialDocumentReversalDate(Date financialDocumentReversalDate) {
463 this.financialDocumentReversalDate = financialDocumentReversalDate;
464 }
465
466 @Override
467 public String getFinancialDocumentTypeCode() {
468 return financialDocumentTypeCode;
469 }
470
471 @Override
472 public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
473 this.financialDocumentTypeCode = financialDocumentTypeCode;
474 }
475
476 @Override
477 public String getTransactionEncumbranceUpdateCode() {
478 return transactionEncumbranceUpdateCode;
479 }
480
481 @Override
482 public void setTransactionEncumbranceUpdateCode(String transactionEncumbranceUpdateCode) {
483 this.transactionEncumbranceUpdateCode = transactionEncumbranceUpdateCode;
484 }
485
486 public Integer getEntryGroupId() {
487 return entryGroupId;
488 }
489
490 @Override
491 public void setEntryGroupId(Integer entryGroupId) {
492 this.entryGroupId = entryGroupId;
493 }
494
495 public Integer getEntryId() {
496 return entryId;
497 }
498
499 public void setEntryId(Integer entryId) {
500 this.entryId = entryId;
501 }
502
503 @Override
504 public void resetEntryId() {
505 this.entryId = null;
506 this.versionNumber = null;
507 }
508
509 @Override
510 public String getFinancialObjectCode() {
511 return financialObjectCode;
512 }
513
514 @Override
515 public void setFinancialObjectCode(String financialObjectCode) {
516 this.financialObjectCode = financialObjectCode;
517 }
518
519 @Override
520 public String getFinancialObjectTypeCode() {
521 return financialObjectTypeCode;
522 }
523
524 @Override
525 public void setFinancialObjectTypeCode(String financialObjectTypeCode) {
526 this.financialObjectTypeCode = financialObjectTypeCode;
527 }
528
529 @Override
530 public String getOrganizationDocumentNumber() {
531 return organizationDocumentNumber;
532 }
533
534 @Override
535 public void setOrganizationDocumentNumber(String organizationDocumentNumber) {
536 this.organizationDocumentNumber = organizationDocumentNumber;
537 }
538
539 @Override
540 public String getOrganizationReferenceId() {
541 return organizationReferenceId;
542 }
543
544 @Override
545 public void setOrganizationReferenceId(String organizationReferenceId) {
546 this.organizationReferenceId = organizationReferenceId;
547 }
548
549 @Override
550 public String getFinancialSystemOriginationCode() {
551 return financialSystemOriginationCode;
552 }
553
554 @Override
555 public void setFinancialSystemOriginationCode(String financialSystemOriginationCode) {
556 this.financialSystemOriginationCode = financialSystemOriginationCode;
557 }
558
559 @Override
560 public String getProjectCode() {
561 if (StringUtils.isBlank(projectCode)) {
562 projectCode = OLEConstants.getDashProjectCode();
563 }
564 return projectCode;
565 }
566
567 @Override
568 public void setProjectCode(String projectCode) {
569 this.projectCode = projectCode;
570 }
571
572 @Override
573 public String getReferenceFinancialDocumentNumber() {
574 return referenceFinancialDocumentNumber;
575 }
576
577 @Override
578 public void setReferenceFinancialDocumentNumber(String referenceFinancialDocumentNumber) {
579 this.referenceFinancialDocumentNumber = referenceFinancialDocumentNumber;
580 }
581
582 @Override
583 public String getReferenceFinancialDocumentTypeCode() {
584 return referenceFinancialDocumentTypeCode;
585 }
586
587 @Override
588 public void setReferenceFinancialDocumentTypeCode(String referenceFinancialDocumentTypeCode) {
589 this.referenceFinancialDocumentTypeCode = referenceFinancialDocumentTypeCode;
590 }
591
592 @Override
593 public String getReferenceFinancialSystemOriginationCode() {
594 return referenceFinancialSystemOriginationCode;
595 }
596
597 @Override
598 public void setReferenceFinancialSystemOriginationCode(String referenceFinancialSystemOriginationCode) {
599 this.referenceFinancialSystemOriginationCode = referenceFinancialSystemOriginationCode;
600 }
601
602 @Override
603 public String getSubAccountNumber() {
604 if (StringUtils.isBlank(subAccountNumber)) {
605 subAccountNumber = OLEConstants.getDashSubAccountNumber();
606 }
607 return subAccountNumber;
608 }
609
610 @Override
611 public void setSubAccountNumber(String subAccountNumber) {
612 this.subAccountNumber = subAccountNumber;
613 }
614
615 @Override
616 public String getFinancialSubObjectCode() {
617 if (StringUtils.isBlank(financialSubObjectCode)) {
618 financialSubObjectCode = OLEConstants.getDashFinancialSubObjectCode();
619 }
620 return financialSubObjectCode;
621 }
622
623 @Override
624 public void setFinancialSubObjectCode(String financialSubObjectCode) {
625 this.financialSubObjectCode = financialSubObjectCode;
626 }
627
628 @Override
629 public Date getTransactionDate() {
630 return transactionDate;
631 }
632
633 @Override
634 public void setTransactionDate(Date transactionDate) {
635 this.transactionDate = transactionDate;
636 }
637
638 @Override
639 public Integer getTransactionLedgerEntrySequenceNumber() {
640 return transactionLedgerEntrySequenceNumber;
641 }
642
643 @Override
644 public void setTransactionLedgerEntrySequenceNumber(Integer transactionLedgerEntrySequenceNumber) {
645 this.transactionLedgerEntrySequenceNumber = transactionLedgerEntrySequenceNumber;
646 }
647
648 @Override
649 public KualiDecimal getTransactionLedgerEntryAmount() {
650 return transactionLedgerEntryAmount;
651 }
652
653 @Override
654 public void setTransactionLedgerEntryAmount(KualiDecimal transactionLedgerEntryAmount) {
655 this.transactionLedgerEntryAmount = transactionLedgerEntryAmount;
656 }
657
658 public void setTransactionLedgerEntryAmount(String transactionLedgerEntryAmount) {
659 this.transactionLedgerEntryAmount = new KualiDecimal(transactionLedgerEntryAmount);
660 }
661
662 public void clearTransactionLedgerEntryAmount() {
663 this.transactionLedgerEntryAmount = null;
664 }
665
666 @Override
667 public String getTransactionLedgerEntryDescription() {
668 return transactionLedgerEntryDescription;
669 }
670
671 @Override
672 public void setTransactionLedgerEntryDescription(String transactionLedgerEntryDescription) {
673 this.transactionLedgerEntryDescription = transactionLedgerEntryDescription;
674 }
675
676 @Override
677 public String getUniversityFiscalPeriodCode() {
678 return universityFiscalPeriodCode;
679 }
680
681 @Override
682 public void setUniversityFiscalPeriodCode(String universityFiscalPeriodCode) {
683 this.universityFiscalPeriodCode = universityFiscalPeriodCode;
684 }
685
686 @Override
687 public Integer getUniversityFiscalYear() {
688 return universityFiscalYear;
689 }
690
691 @Override
692 public void setUniversityFiscalYear(Integer universityFiscalYear) {
693 this.universityFiscalYear = universityFiscalYear;
694 }
695
696 @Override
697 public boolean isDebit() {
698 return OLEConstants.GL_DEBIT_CODE.equals(this.transactionDebitCreditCode);
699 }
700
701 @Override
702 public boolean isCredit() {
703 return OLEConstants.GL_CREDIT_CODE.equals(this.transactionDebitCreditCode);
704 }
705
706 public void setFieldValue(String fieldName, String fieldValue) {
707 if ("universityFiscalYear".equals(fieldName)) {
708 if (StringUtils.isNotBlank(fieldValue)) {
709 setUniversityFiscalYear(Integer.parseInt(fieldValue));
710 }
711 else {
712 setUniversityFiscalYear(null);
713 }
714 }
715 else if ("chartOfAccountsCode".equals(fieldName)) {
716 setChartOfAccountsCode(fieldValue);
717 }
718 else if ("accountNumber".equals(fieldName)) {
719 setAccountNumber(fieldValue);
720 }
721 else if ("subAccountNumber".equals(fieldName)) {
722 setSubAccountNumber(fieldValue);
723 }
724 else if ("financialObjectCode".equals(fieldName)) {
725 setFinancialObjectCode(fieldValue);
726 }
727 else if ("financialSubObjectCode".equals(fieldName)) {
728 setFinancialSubObjectCode(fieldValue);
729 }
730 else if ("financialBalanceTypeCode".equals(fieldName)) {
731 setFinancialBalanceTypeCode(fieldValue);
732 }
733 else if ("financialObjectTypeCode".equals(fieldName)) {
734 setFinancialObjectTypeCode(fieldValue);
735 }
736 else if ("universityFiscalPeriodCode".equals(fieldName)) {
737 setUniversityFiscalPeriodCode(fieldValue);
738 }
739 else if ("financialDocumentTypeCode".equals(fieldName)) {
740 setFinancialDocumentTypeCode(fieldValue);
741 }
742 else if ("financialSystemOriginationCode".equals(fieldName)) {
743 setFinancialSystemOriginationCode(fieldValue);
744 }
745 else if (OLEPropertyConstants.DOCUMENT_NUMBER.equals(fieldName)) {
746 setDocumentNumber(fieldValue);
747 }
748 else if ("transactionLedgerEntrySequenceNumber".equals(fieldName)) {
749 if (StringUtils.isNotBlank(fieldValue)) {
750 setTransactionLedgerEntrySequenceNumber(Integer.parseInt(fieldValue));
751 }
752 else {
753 setTransactionLedgerEntrySequenceNumber(null);
754 }
755 }
756 else if ("transactionLedgerEntryDescription".equals(fieldName)) {
757 setTransactionLedgerEntryDescription(fieldValue);
758 }
759 else if ("transactionLedgerEntryAmount".equals(fieldName)) {
760 if (StringUtils.isNotBlank(fieldValue)) {
761 setTransactionLedgerEntryAmount(new KualiDecimal(fieldValue));
762 }
763 else {
764 clearTransactionLedgerEntryAmount();
765 }
766 }
767 else if ("transactionDebitCreditCode".equals(fieldName)) {
768 setTransactionDebitCreditCode(fieldValue);
769 }
770 else if ("transactionDate".equals(fieldName)) {
771 if (StringUtils.isNotBlank(fieldValue)) {
772 try {
773 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
774 setTransactionDate(new java.sql.Date((df.parse(fieldValue)).getTime()));
775 }
776 catch (ParseException e) {
777 setTransactionDate(null);
778 }
779 }
780 else {
781 setTransactionDate(null);
782 }
783 }
784 else if ("organizationDocumentNumber".equals(fieldName)) {
785 setOrganizationDocumentNumber(fieldValue);
786 }
787 else if ("projectCode".equals(fieldName)) {
788 setProjectCode(fieldValue);
789 }
790 else if ("organizationReferenceId".equals(fieldName)) {
791 setOrganizationReferenceId(fieldValue);
792 }
793 else if ("referenceFinancialDocumentTypeCode".equals(fieldName)) {
794 setReferenceFinancialDocumentTypeCode(fieldValue);
795 }
796 else if ("referenceFinancialSystemOriginationCode".equals(fieldName)) {
797 setReferenceFinancialSystemOriginationCode(fieldValue);
798 }
799 else if ("referenceFinancialDocumentNumber".equals(fieldName)) {
800 setReferenceFinancialDocumentNumber(fieldValue);
801 }
802 else if ("financialDocumentReversalDate".equals(fieldName)) {
803 if (StringUtils.isNotBlank(fieldValue)) {
804 try {
805 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
806 setFinancialDocumentReversalDate(new java.sql.Date((df.parse(fieldValue)).getTime()));
807 }
808 catch (ParseException e) {
809 setFinancialDocumentReversalDate(null);
810 }
811 }
812 else {
813 setFinancialDocumentReversalDate(null);
814 }
815 }
816 else if ("transactionEncumbranceUpdateCode".equals(fieldName)) {
817 setTransactionEncumbranceUpdateCode(fieldValue);
818 }
819 else {
820 throw new IllegalArgumentException("Invalid Field Name " + fieldName);
821 }
822 }
823
824 public Object getFieldValue(String fieldName) {
825 if ("universityFiscalYear".equals(fieldName)) {
826 return getUniversityFiscalYear();
827 }
828 else if ("chartOfAccountsCode".equals(fieldName)) {
829 return getChartOfAccountsCode();
830 }
831 else if ("accountNumber".equals(fieldName)) {
832 return getAccountNumber();
833 }
834 else if ("subAccountNumber".equals(fieldName)) {
835 return getSubAccountNumber();
836 }
837 else if ("financialObjectCode".equals(fieldName)) {
838 return getFinancialObjectCode();
839 }
840 else if ("financialSubObjectCode".equals(fieldName)) {
841 return getFinancialSubObjectCode();
842 }
843 else if ("financialBalanceTypeCode".equals(fieldName)) {
844 return getFinancialBalanceTypeCode();
845 }
846 else if ("financialObjectTypeCode".equals(fieldName)) {
847 return getFinancialObjectTypeCode();
848 }
849 else if ("universityFiscalPeriodCode".equals(fieldName)) {
850 return getUniversityFiscalPeriodCode();
851 }
852 else if ("financialDocumentTypeCode".equals(fieldName)) {
853 return getFinancialDocumentTypeCode();
854 }
855 else if ("financialSystemOriginationCode".equals(fieldName)) {
856 return getFinancialSystemOriginationCode();
857 }
858 else if (OLEPropertyConstants.DOCUMENT_NUMBER.equals(fieldName)) {
859 return getDocumentNumber();
860 }
861 else if ("transactionLedgerEntrySequenceNumber".equals(fieldName)) {
862 return getTransactionLedgerEntrySequenceNumber();
863 }
864 else if ("transactionLedgerEntryDescription".equals(fieldName)) {
865 return getTransactionLedgerEntryDescription();
866 }
867 else if ("transactionLedgerEntryAmount".equals(fieldName)) {
868 return getTransactionLedgerEntryAmount();
869 }
870 else if ("transactionDebitCreditCode".equals(fieldName)) {
871 return getTransactionDebitCreditCode();
872 }
873 else if ("transactionDate".equals(fieldName)) {
874 return getTransactionDate();
875 }
876 else if ("organizationDocumentNumber".equals(fieldName)) {
877 return getOrganizationDocumentNumber();
878 }
879 else if ("projectCode".equals(fieldName)) {
880 return getProjectCode();
881 }
882 else if ("organizationReferenceId".equals(fieldName)) {
883 return getOrganizationReferenceId();
884 }
885 else if ("referenceFinancialDocumentTypeCode".equals(fieldName)) {
886 return getReferenceFinancialDocumentTypeCode();
887 }
888 else if ("referenceFinancialSystemOriginationCode".equals(fieldName)) {
889 return getReferenceFinancialSystemOriginationCode();
890 }
891 else if ("referenceFinancialDocumentNumber".equals(fieldName)) {
892 return getReferenceFinancialDocumentNumber();
893 }
894 else if ("financialDocumentReversalDate".equals(fieldName)) {
895 return getFinancialDocumentReversalDate();
896 }
897 else if ("transactionEncumbranceUpdateCode".equals(fieldName)) {
898 return getTransactionEncumbranceUpdateCode();
899 }
900 else {
901 throw new IllegalArgumentException("Invalid Field Name " + fieldName);
902 }
903 }
904
905 public OriginEntryFull(GeneralLedgerPendingEntry glpe) {
906 accountNumber = glpe.getAccountNumber();
907 documentNumber = glpe.getDocumentNumber();
908 referenceFinancialDocumentNumber = glpe.getReferenceFinancialDocumentNumber();
909 referenceFinancialDocumentTypeCode = glpe.getReferenceFinancialDocumentTypeCode();
910 financialDocumentReversalDate = glpe.getFinancialDocumentReversalDate();
911 financialDocumentTypeCode = glpe.getFinancialDocumentTypeCode();
912 financialBalanceTypeCode = glpe.getFinancialBalanceTypeCode();
913 chartOfAccountsCode = glpe.getChartOfAccountsCode();
914 financialObjectTypeCode = glpe.getFinancialObjectTypeCode();
915 financialObjectCode = glpe.getFinancialObjectCode();
916 financialSubObjectCode = glpe.getFinancialSubObjectCode();
917 financialSystemOriginationCode = glpe.getFinancialSystemOriginationCode();
918 referenceFinancialSystemOriginationCode = glpe.getReferenceFinancialSystemOriginationCode();
919 organizationDocumentNumber = glpe.getOrganizationDocumentNumber();
920 organizationReferenceId = glpe.getOrganizationReferenceId();
921 projectCode = glpe.getProjectCode();
922 subAccountNumber = glpe.getSubAccountNumber();
923 transactionDate = glpe.getTransactionDate();
924 transactionDebitCreditCode = glpe.getTransactionDebitCreditCode();
925 transactionEncumbranceUpdateCode = glpe.getTransactionEncumbranceUpdateCode();
926 transactionLedgerEntrySequenceNumber = glpe.getTransactionLedgerEntrySequenceNumber();
927 transactionLedgerEntryAmount = glpe.getTransactionLedgerEntryAmount();
928 transactionLedgerEntryDescription = glpe.getTransactionLedgerEntryDescription();
929 universityFiscalPeriodCode = glpe.getUniversityFiscalPeriodCode();
930 universityFiscalYear = glpe.getUniversityFiscalYear();
931 }
932
933
934
935
936 public OriginEntryFull(String financialDocumentTypeCode, String financialSystemOriginationCode) {
937 super();
938
939 setChartOfAccountsCode(OLEConstants.EMPTY_STRING);
940 setAccountNumber(OLEConstants.EMPTY_STRING);
941
942 setFinancialDocumentTypeCode(financialDocumentTypeCode);
943 setFinancialSystemOriginationCode(financialSystemOriginationCode);
944
945 setFinancialObjectCode(OLEConstants.EMPTY_STRING);
946 setFinancialBalanceTypeCode(OLEConstants.EMPTY_STRING);
947 setFinancialObjectTypeCode(OLEConstants.EMPTY_STRING);
948 setDocumentNumber(OLEConstants.EMPTY_STRING);
949 setFinancialDocumentReversalDate(null);
950
951 setUniversityFiscalYear(new Integer(0));
952 setUniversityFiscalPeriodCode(OLEConstants.EMPTY_STRING);
953
954 setTransactionLedgerEntrySequenceNumber(new Integer(1));
955 setTransactionLedgerEntryAmount(KualiDecimal.ZERO);
956 setTransactionLedgerEntryDescription(OLEConstants.EMPTY_STRING);
957 setTransactionDate(null);
958 setTransactionDebitCreditCode(OLEConstants.EMPTY_STRING);
959 setTransactionEncumbranceUpdateCode(null);
960
961 setOrganizationDocumentNumber(OLEConstants.EMPTY_STRING);
962 setOrganizationReferenceId(OLEConstants.EMPTY_STRING);
963
964 setReferenceFinancialDocumentTypeCode(OLEConstants.EMPTY_STRING);
965 setReferenceFinancialSystemOriginationCode(OLEConstants.EMPTY_STRING);
966 setReferenceFinancialDocumentNumber(OLEConstants.EMPTY_STRING);
967 }
968
969
970
971
972 public OriginEntryFull() {
973 this(null, null);
974 }
975
976 public OriginEntryFull(Transaction t) {
977 this();
978 copyFieldsFromTransaction(t);
979 }
980
981 public OriginEntryFull(String line) {
982 try {
983 setFromTextFileForBatch(line, 0);
984 }
985 catch (LoadException e) {
986 LOG.error("OriginEntryFull() Error loading line", e);
987 }
988 }
989
990 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
991 LinkedHashMap map = new LinkedHashMap();
992 map.put("entryId", getEntryId());
993 map.put("entryGroupId", getEntryGroupId());
994 map.put("universityFiscalYear", getUniversityFiscalYear());
995 map.put("universityFiscalPeriodCode", getUniversityFiscalPeriodCode());
996 map.put("chartOfAccountsCode", getChartOfAccountsCode());
997 map.put("accountNumber", getAccountNumber());
998 map.put("subAccountNumber", getSubAccountNumber());
999 map.put("financialObjectCode", getFinancialObjectCode());
1000 map.put("financialObjectTypeCode", getFinancialObjectTypeCode());
1001 map.put("financialSubObjectCode", getFinancialSubObjectCode());
1002 map.put("financialBalanceTypeCode", getFinancialBalanceTypeCode());
1003 map.put(OLEPropertyConstants.DOCUMENT_NUMBER, getDocumentNumber());
1004 map.put("financialDocumentTypeCode", getFinancialDocumentTypeCode());
1005 map.put("financialSystemOriginationCode", getFinancialSystemOriginationCode());
1006 map.put("transactionLedgerEntrySequenceNumber", getTransactionLedgerEntrySequenceNumber());
1007 map.put("transactionLedgerEntryDescription", getTransactionLedgerEntryDescription());
1008 return map;
1009 }
1010
1011 public OriginEntryGroup getGroup() {
1012 return group;
1013 }
1014
1015 public void setGroup(OriginEntryGroup oeg) {
1016 if (oeg != null) {
1017 setEntryGroupId(oeg.getId());
1018 group = oeg;
1019 }
1020 else {
1021 setEntryGroupId(null);
1022 group = null;
1023 }
1024 }
1025
1026 public A21SubAccount getA21SubAccount() {
1027 return a21SubAccount;
1028 }
1029
1030 public void setA21SubAccount(A21SubAccount subAccount) {
1031 a21SubAccount = subAccount;
1032 }
1033
1034 @Override
1035 public Account getAccount() {
1036 return account;
1037 }
1038
1039 @Override
1040 public void setAccount(Account account) {
1041 this.account = account;
1042 }
1043
1044 @Override
1045 public BalanceType getBalanceType() {
1046 return balanceType;
1047 }
1048
1049 @Override
1050 public void setBalanceType(BalanceType balanceType) {
1051 this.balanceType = balanceType;
1052 }
1053
1054 @Override
1055 public Chart getChart() {
1056 return chart;
1057 }
1058
1059 @Override
1060 public void setChart(Chart chart) {
1061 this.chart = chart;
1062 }
1063
1064 @Override
1065 public DocumentTypeEBO getFinancialSystemDocumentTypeCode() {
1066 if ( StringUtils.isBlank( financialDocumentTypeCode ) ) {
1067 financialSystemDocumentTypeCode = null;
1068 } else {
1069 if ( financialSystemDocumentTypeCode == null || !StringUtils.equals(financialDocumentTypeCode, financialSystemDocumentTypeCode.getName() ) ) {
1070 org.kuali.rice.kew.api.doctype.DocumentType docType = SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName(financialDocumentTypeCode);
1071 if ( docType != null ) {
1072 financialSystemDocumentTypeCode = DocumentType.from( docType );
1073 } else {
1074 financialSystemDocumentTypeCode = null;
1075 }
1076 }
1077 }
1078 return financialSystemDocumentTypeCode;
1079 }
1080
1081 @Override
1082 public ObjectCode getFinancialObject() {
1083 return financialObject;
1084 }
1085
1086 @Override
1087 public void setFinancialObject(ObjectCode financialObject) {
1088 this.financialObject = financialObject;
1089 }
1090
1091 @Override
1092 public SubObjectCode getFinancialSubObject() {
1093 return financialSubObject;
1094 }
1095
1096 public void setFinancialSubObject(SubObjectCode financialSubObject) {
1097 this.financialSubObject = financialSubObject;
1098 }
1099
1100 @Override
1101 public ObjectType getObjectType() {
1102 return objectType;
1103 }
1104
1105 @Override
1106 public void setObjectType(ObjectType objectType) {
1107 this.objectType = objectType;
1108 }
1109
1110 @Override
1111 public SystemOptions getOption() {
1112 return option;
1113 }
1114
1115 @Override
1116 public void setOption(SystemOptions option) {
1117 this.option = option;
1118 }
1119
1120 public ProjectCode getProject() {
1121 return project;
1122 }
1123
1124 public void setProject(ProjectCode project) {
1125 this.project = project;
1126 }
1127
1128 @Override
1129 public SubAccount getSubAccount() {
1130 return subAccount;
1131 }
1132
1133 public void setSubAccount(SubAccount subAccount) {
1134 this.subAccount = subAccount;
1135 }
1136
1137 public UniversityDate getUniversityDate() {
1138 return universityDate;
1139 }
1140
1141 public void setUniversityDate(UniversityDate universityDate) {
1142 this.universityDate = universityDate;
1143 }
1144
1145 public AccountingPeriod getAccountingPeriod() {
1146 return accountingPeriod;
1147 }
1148
1149 public void setAccountingPeriod(AccountingPeriod accountingPeriod) {
1150 this.accountingPeriod = accountingPeriod;
1151 }
1152
1153 public UniversityDate getReversalDate() {
1154 return reversalDate;
1155 }
1156
1157 public void setReversalDate(UniversityDate reversalDate) {
1158 this.reversalDate = reversalDate;
1159 }
1160
1161 public OriginationCode getOrigination() {
1162 return origination;
1163 }
1164
1165 public void setOrigination(OriginationCode origination) {
1166 this.origination = origination;
1167 }
1168
1169 public DocumentTypeEBO getReferenceFinancialSystemDocumentTypeCode() {
1170 if ( StringUtils.isBlank( referenceFinancialDocumentTypeCode ) ) {
1171 referenceFinancialSystemDocumentTypeCode = null;
1172 } else {
1173 if ( referenceFinancialSystemDocumentTypeCode == null || !StringUtils.equals(referenceFinancialDocumentTypeCode, referenceFinancialSystemDocumentTypeCode.getName() ) ) {
1174 org.kuali.rice.kew.api.doctype.DocumentType temp = SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName(referenceFinancialDocumentTypeCode);
1175 if ( temp != null ) {
1176 referenceFinancialSystemDocumentTypeCode = DocumentType.from( temp );
1177 } else {
1178 referenceFinancialSystemDocumentTypeCode = null;
1179 }
1180 }
1181 }
1182 return referenceFinancialSystemDocumentTypeCode;
1183 }
1184
1185 public static OriginEntryFull copyFromOriginEntryable(OriginEntryInformation oe) {
1186 OriginEntryFull newOriginEntry = new OriginEntryFull();
1187 newOriginEntry.setAccountNumber(oe.getAccountNumber());
1188 newOriginEntry.setDocumentNumber(oe.getDocumentNumber());
1189 newOriginEntry.setReferenceFinancialDocumentNumber(oe.getReferenceFinancialDocumentNumber());
1190 newOriginEntry.setReferenceFinancialDocumentTypeCode(oe.getReferenceFinancialDocumentTypeCode());
1191 newOriginEntry.setFinancialDocumentReversalDate(oe.getFinancialDocumentReversalDate());
1192 newOriginEntry.setFinancialDocumentTypeCode(oe.getFinancialDocumentTypeCode());
1193 newOriginEntry.setFinancialBalanceTypeCode(oe.getFinancialBalanceTypeCode());
1194 newOriginEntry.setChartOfAccountsCode(oe.getChartOfAccountsCode());
1195 newOriginEntry.setFinancialObjectTypeCode(oe.getFinancialObjectTypeCode());
1196 newOriginEntry.setFinancialObjectCode(oe.getFinancialObjectCode());
1197 newOriginEntry.setFinancialSubObjectCode(oe.getFinancialSubObjectCode());
1198 newOriginEntry.setFinancialSystemOriginationCode(oe.getFinancialSystemOriginationCode());
1199 newOriginEntry.setReferenceFinancialSystemOriginationCode(oe.getReferenceFinancialSystemOriginationCode());
1200 newOriginEntry.setOrganizationDocumentNumber(oe.getOrganizationDocumentNumber());
1201 newOriginEntry.setOrganizationReferenceId(oe.getOrganizationReferenceId());
1202 newOriginEntry.setProjectCode(oe.getProjectCode());
1203 newOriginEntry.setSubAccountNumber(oe.getSubAccountNumber());
1204 newOriginEntry.setTransactionDate(oe.getTransactionDate());
1205 newOriginEntry.setTransactionDebitCreditCode(oe.getTransactionDebitCreditCode());
1206 newOriginEntry.setTransactionEncumbranceUpdateCode(oe.getTransactionEncumbranceUpdateCode());
1207 newOriginEntry.setTransactionLedgerEntrySequenceNumber(oe.getTransactionLedgerEntrySequenceNumber());
1208 newOriginEntry.setTransactionLedgerEntryAmount(oe.getTransactionLedgerEntryAmount());
1209 newOriginEntry.setTransactionLedgerEntryDescription(oe.getTransactionLedgerEntryDescription());
1210 newOriginEntry.setUniversityFiscalPeriodCode(oe.getUniversityFiscalPeriodCode());
1211 newOriginEntry.setUniversityFiscalYear(oe.getUniversityFiscalYear());
1212 return newOriginEntry;
1213 }
1214
1215
1216
1217
1218 protected static OriginEntryFieldUtil getOriginEntryFieldUtil() {
1219 if (originEntryFieldUtil == null) {
1220 originEntryFieldUtil = new OriginEntryFieldUtil();
1221 }
1222 return originEntryFieldUtil;
1223 }
1224 }