001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.module.gl.bo;
017:
018: import java.sql.Date;
019: import java.text.ParseException;
020: import java.text.SimpleDateFormat;
021: import java.util.LinkedHashMap;
022:
023: import org.apache.commons.lang.StringUtils;
024: import org.kuali.core.bo.PersistableBusinessObjectBase;
025: import org.kuali.core.util.GlobalVariables;
026: import org.kuali.core.util.KualiDecimal;
027: import org.kuali.kfs.KFSConstants;
028: import org.kuali.kfs.KFSKeyConstants;
029: import org.kuali.kfs.KFSPropertyConstants;
030: import org.kuali.kfs.bo.GeneralLedgerPendingEntry;
031: import org.kuali.module.gl.GLConstants;
032: import org.kuali.module.gl.exception.LoadException;
033:
034: /**
035: * This class represents an origin entry used primarily in the scrubber process
036: */
037: public class OriginEntryLite extends PersistableBusinessObjectBase
038: implements OriginEntry {
039: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
040: .getLogger(OriginEntryLite.class);
041:
042: private static final String DATE_FORMAT = "yyyy-MM-dd";
043:
044: // 17 characters while it is 19 character in DD. Don't change, it has to be 17.
045: public static final String SPACE_TRANSACTION_LEDGER_ENTRY_AMOUNT = " ";
046:
047: private Integer entryId;
048: private Integer entryGroupId;
049: protected String accountNumber;
050: protected String documentNumber;
051: protected String referenceFinancialDocumentNumber;
052: protected String referenceFinancialDocumentTypeCode;
053: protected Date financialDocumentReversalDate;
054: protected String financialDocumentTypeCode;
055: protected String financialBalanceTypeCode;
056: protected String chartOfAccountsCode;
057: protected String financialObjectTypeCode;
058: protected String financialObjectCode;
059: protected String financialSubObjectCode;
060: protected String financialSystemOriginationCode;
061: protected String referenceFinancialSystemOriginationCode;
062: protected String organizationDocumentNumber;
063: protected String organizationReferenceId;
064: protected String projectCode;
065: protected String subAccountNumber;
066: protected Date transactionDate;
067: protected String transactionDebitCreditCode;
068: protected String transactionEncumbranceUpdateCode;
069: protected Integer transactionLedgerEntrySequenceNumber;
070: protected KualiDecimal transactionLedgerEntryAmount;
071: protected String transactionLedgerEntryDescription;
072: protected String universityFiscalPeriodCode;
073: protected Integer universityFiscalYear;
074: private boolean transactionScrubberOffsetGenerationIndicator;
075:
076: public OriginEntryLite(GeneralLedgerPendingEntry glpe) {
077: accountNumber = glpe.getAccountNumber();
078: documentNumber = glpe.getDocumentNumber();
079: referenceFinancialDocumentNumber = glpe
080: .getReferenceFinancialDocumentNumber();
081: referenceFinancialDocumentTypeCode = glpe
082: .getReferenceFinancialDocumentTypeCode();
083: financialDocumentReversalDate = glpe
084: .getFinancialDocumentReversalDate();
085: financialDocumentTypeCode = glpe.getFinancialDocumentTypeCode();
086: financialBalanceTypeCode = glpe.getFinancialBalanceTypeCode();
087: chartOfAccountsCode = glpe.getChartOfAccountsCode();
088: financialObjectTypeCode = glpe.getFinancialObjectTypeCode();
089: financialObjectCode = glpe.getFinancialObjectCode();
090: financialSubObjectCode = glpe.getFinancialSubObjectCode();
091: financialSystemOriginationCode = glpe
092: .getFinancialSystemOriginationCode();
093: referenceFinancialSystemOriginationCode = glpe
094: .getReferenceFinancialSystemOriginationCode();
095: organizationDocumentNumber = glpe
096: .getOrganizationDocumentNumber();
097: organizationReferenceId = glpe.getOrganizationReferenceId();
098: projectCode = glpe.getProjectCode();
099: subAccountNumber = glpe.getSubAccountNumber();
100: transactionDate = glpe.getTransactionDate();
101: transactionDebitCreditCode = glpe
102: .getTransactionDebitCreditCode();
103: transactionEncumbranceUpdateCode = glpe
104: .getTransactionEncumbranceUpdateCode();
105: transactionLedgerEntrySequenceNumber = glpe
106: .getTransactionLedgerEntrySequenceNumber();
107: transactionLedgerEntryAmount = glpe
108: .getTransactionLedgerEntryAmount();
109: transactionLedgerEntryDescription = glpe
110: .getTransactionLedgerEntryDescription();
111: universityFiscalPeriodCode = glpe
112: .getUniversityFiscalPeriodCode();
113: universityFiscalYear = glpe.getUniversityFiscalYear();
114: }
115:
116: /**
117: *
118: */
119: public OriginEntryLite(String financialDocumentTypeCode,
120: String financialSystemOriginationCode) {
121: super ();
122:
123: setChartOfAccountsCode(KFSConstants.EMPTY_STRING);
124: setAccountNumber(KFSConstants.EMPTY_STRING);
125: setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
126: setProjectCode(KFSConstants.getDashProjectCode());
127:
128: setFinancialDocumentTypeCode(financialDocumentTypeCode);
129: setFinancialSystemOriginationCode(financialSystemOriginationCode);
130:
131: setFinancialObjectCode(KFSConstants.EMPTY_STRING);
132: setFinancialSubObjectCode(KFSConstants
133: .getDashFinancialSubObjectCode());
134: setFinancialBalanceTypeCode(KFSConstants.EMPTY_STRING);
135: setFinancialObjectTypeCode(KFSConstants.EMPTY_STRING);
136: setDocumentNumber(KFSConstants.EMPTY_STRING);
137: setFinancialDocumentReversalDate(null);
138:
139: setUniversityFiscalYear(new Integer(0));
140: setUniversityFiscalPeriodCode(KFSConstants.EMPTY_STRING);
141:
142: setTransactionLedgerEntrySequenceNumber(new Integer(1));
143: setTransactionLedgerEntryAmount(new KualiDecimal(0));
144: setTransactionLedgerEntryDescription(KFSConstants.EMPTY_STRING);
145: setTransactionDate(null);
146: setTransactionDebitCreditCode(KFSConstants.EMPTY_STRING);
147: setTransactionEncumbranceUpdateCode(null);
148:
149: setOrganizationDocumentNumber(KFSConstants.EMPTY_STRING);
150: setOrganizationReferenceId(KFSConstants.EMPTY_STRING);
151:
152: setReferenceFinancialDocumentTypeCode(KFSConstants.EMPTY_STRING);
153: setReferenceFinancialSystemOriginationCode(KFSConstants.EMPTY_STRING);
154: setReferenceFinancialDocumentNumber(KFSConstants.EMPTY_STRING);
155: }
156:
157: /**
158: *
159: */
160: public OriginEntryLite() {
161: this (null, null);
162: }
163:
164: public OriginEntryLite(Transaction t) {
165: this ();
166: copyFieldsFromTransaction(t);
167: }
168:
169: public OriginEntryLite(String line) {
170: try {
171: setFromTextFile(line, 0);
172: } catch (LoadException e) {
173: LOG.error("OriginEntryFull() Error loading line", e);
174: }
175: }
176:
177: public void copyFieldsFromTransaction(Transaction t) {
178: setAccountNumber(t.getAccountNumber());
179: setDocumentNumber(t.getDocumentNumber());
180: setReferenceFinancialDocumentNumber(t
181: .getReferenceFinancialDocumentNumber());
182: setReferenceFinancialDocumentTypeCode(t
183: .getReferenceFinancialDocumentTypeCode());
184: setFinancialDocumentReversalDate(t
185: .getFinancialDocumentReversalDate());
186: setFinancialDocumentTypeCode(t.getFinancialDocumentTypeCode());
187: setFinancialBalanceTypeCode(t.getFinancialBalanceTypeCode());
188: setChartOfAccountsCode(t.getChartOfAccountsCode());
189: setFinancialObjectTypeCode(t.getFinancialObjectTypeCode());
190: setFinancialObjectCode(t.getFinancialObjectCode());
191: setFinancialSubObjectCode(t.getFinancialSubObjectCode());
192: setFinancialSystemOriginationCode(t
193: .getFinancialSystemOriginationCode());
194: setReferenceFinancialSystemOriginationCode(t
195: .getReferenceFinancialSystemOriginationCode());
196: setOrganizationDocumentNumber(t.getOrganizationDocumentNumber());
197: setOrganizationReferenceId(t.getOrganizationReferenceId());
198: setProjectCode(t.getProjectCode());
199: setSubAccountNumber(t.getSubAccountNumber());
200: setTransactionDate(t.getTransactionDate());
201: setTransactionDebitCreditCode(t.getTransactionDebitCreditCode());
202: setTransactionEncumbranceUpdateCode(t
203: .getTransactionEncumbranceUpdateCode());
204: setTransactionLedgerEntrySequenceNumber(t
205: .getTransactionLedgerEntrySequenceNumber());
206: setTransactionLedgerEntryAmount(t
207: .getTransactionLedgerEntryAmount());
208: setTransactionLedgerEntryDescription(t
209: .getTransactionLedgerEntryDescription());
210: setUniversityFiscalPeriodCode(t.getUniversityFiscalPeriodCode());
211: setUniversityFiscalYear(t.getUniversityFiscalYear());
212: }
213:
214: protected java.sql.Date parseDate(String sdate,
215: boolean beLenientWithDates) throws ParseException {
216: if ((sdate == null) || (sdate.trim().length() == 0)) {
217: return null;
218: } else {
219:
220: SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
221: sdf.setLenient(beLenientWithDates);
222:
223: java.util.Date d = sdf.parse(sdate);
224: return new Date(d.getTime());
225: }
226: }
227:
228: protected String formatDate(Date date) {
229: if (date == null) {
230: return GLConstants.getSpaceTransactionDate();
231: } else {
232: SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
233: return sdf.format(date);
234: }
235: }
236:
237: protected String getValue(String line, int s, int e) {
238: // String v = line.substring(s, e);
239: return StringUtils.substring(line, s, e).trim();
240: }
241:
242: /**
243: * This method loads the fields of this origin entry by parsing the passed in the string It is assumed that the String does not
244: * contain the origin entry ID, but if it does, it will be ignored
245: *
246: * @param line a string representing an origin entry
247: * @param lineNumber used to render an error message by identifying this line
248: * @throws LoadException
249: */
250: public void setFromTextFile(String line, int lineNumber)
251: throws LoadException {
252:
253: // Just in case
254: line = line + GLConstants.getSpaceAllOriginEntryFields();
255:
256: if (!GLConstants.getSpaceUniversityFiscalYear().equals(
257: line.substring(0, 4))) {
258: try {
259: setUniversityFiscalYear(new Integer(line
260: .substring(0, 4)));
261: } catch (NumberFormatException e) {
262: GlobalVariables
263: .getErrorMap()
264: .putError(
265: "fileUpload",
266: KFSKeyConstants.ERROR_NUMBER_FORMAT_ORIGIN_ENTRY_FROM_TEXT_FILE,
267: new String[] {
268: new Integer(lineNumber)
269: .toString(),
270: "University Fiscal Year" });
271: throw new LoadException(
272: "Invalid university fiscal year");
273: }
274:
275: } else {
276: setUniversityFiscalYear(null);
277: }
278:
279: setChartOfAccountsCode(getValue(line, 4, 6));
280: setAccountNumber(getValue(line, 6, 13));
281: setSubAccountNumber(getValue(line, 13, 18));
282: setFinancialObjectCode(getValue(line, 18, 22));
283: setFinancialSubObjectCode(getValue(line, 22, 25));
284: setFinancialBalanceTypeCode(getValue(line, 25, 27));
285: setFinancialObjectTypeCode(getValue(line, 27, 29));
286: setUniversityFiscalPeriodCode(getValue(line, 29, 31));
287: setFinancialDocumentTypeCode(getValue(line, 31, 35));
288: setFinancialSystemOriginationCode(getValue(line, 35, 37));
289: setDocumentNumber(getValue(line, 37, 51));
290: if (!GLConstants.getSpaceTransactionEntrySequenceNumber()
291: .equals(line.substring(51, 56))
292: && !GLConstants.getZeroTransactionEntrySequenceNumber()
293: .equals(line.substring(51, 56))) {
294: try {
295: setTransactionLedgerEntrySequenceNumber(new Integer(
296: line.substring(51, 56).trim()));
297: } catch (NumberFormatException e) {
298: GlobalVariables
299: .getErrorMap()
300: .putError(
301: "fileUpload",
302: KFSKeyConstants.ERROR_NUMBER_FORMAT_ORIGIN_ENTRY_FROM_TEXT_FILE,
303: new String[] {
304: new Integer(lineNumber)
305: .toString(),
306: "Sequence Number" });
307: throw new LoadException("Invalid sequence number");
308: }
309: } else {
310: setTransactionLedgerEntrySequenceNumber(null);
311: }
312: setTransactionLedgerEntryDescription(getValue(line, 56, 96));
313:
314: try {
315: setTransactionLedgerEntryAmount(new KualiDecimal(line
316: .substring(96, 113).trim()));
317: } catch (NumberFormatException e) {
318: GlobalVariables
319: .getErrorMap()
320: .putError(
321: "fileUpload",
322: KFSKeyConstants.ERROR_NUMBER_FORMAT_ORIGIN_ENTRY_FROM_TEXT_FILE,
323: new String[] {
324: new Integer(lineNumber).toString(),
325: "Transaction Ledger Entry Amount" });
326: throw new LoadException("Invalid Entry Amount");
327: }
328:
329: setTransactionDebitCreditCode(line.substring(113, 114));
330:
331: try {
332: setTransactionDate(parseDate(line.substring(114, 124),
333: false));
334: } catch (ParseException e) {
335: GlobalVariables
336: .getErrorMap()
337: .putError(
338: "fileUpload",
339: KFSKeyConstants.ERROR_NUMBER_FORMAT_ORIGIN_ENTRY_FROM_TEXT_FILE,
340: new String[] {
341: new Integer(lineNumber).toString(),
342: "Transaction Date" });
343: throw new LoadException("Invalid Transaction Date");
344: }
345:
346: setOrganizationDocumentNumber(getValue(line, 124, 134));
347: setProjectCode(getValue(line, 134, 144));
348: setOrganizationReferenceId(getValue(line, 144, 152));
349: setReferenceFinancialDocumentTypeCode(getValue(line, 152, 156));
350: setReferenceFinancialSystemOriginationCode(getValue(line, 156,
351: 158));
352: setReferenceFinancialDocumentNumber(getValue(line, 158, 172));
353: try {
354: setFinancialDocumentReversalDate(parseDate(line.substring(
355: 172, 182), true));
356: } catch (ParseException e) {
357: GlobalVariables
358: .getErrorMap()
359: .putError(
360: "fileUpload",
361: KFSKeyConstants.ERROR_NUMBER_FORMAT_ORIGIN_ENTRY_FROM_TEXT_FILE,
362: new String[] {
363: new Integer(lineNumber).toString(),
364: "Financial Document Reversal Date" });
365: throw new LoadException("Invalid Reversal Date");
366: }
367:
368: setTransactionEncumbranceUpdateCode(line.substring(182, 183));
369: }
370:
371: protected String getField(int size, String value) {
372: if (value == null) {
373: return GLConstants.getSpaceAllOriginEntryFields()
374: .substring(0, size);
375: } else {
376: if (value.length() < size) {
377: return value
378: + GLConstants.getSpaceAllOriginEntryFields()
379: .substring(0, size - value.length());
380: } else {
381: return value;
382: }
383: }
384: }
385:
386: public String getLine() {
387: StringBuffer sb = new StringBuffer();
388: if (universityFiscalYear == null) {
389: sb.append(GLConstants.getSpaceUniversityFiscalYear());
390: } else {
391: sb.append(universityFiscalYear);
392: }
393:
394: sb.append(getField(2, chartOfAccountsCode));
395: sb.append(getField(7, accountNumber));
396: sb.append(getField(5, subAccountNumber));
397: sb.append(getField(4, financialObjectCode));
398: sb.append(getField(3, financialSubObjectCode));
399: sb.append(getField(2, financialBalanceTypeCode));
400: sb.append(getField(2, financialObjectTypeCode));
401: sb.append(getField(2, universityFiscalPeriodCode));
402: sb.append(getField(4, financialDocumentTypeCode));
403: sb.append(getField(2, financialSystemOriginationCode));
404: sb.append(getField(14, documentNumber));
405:
406: // This is the cobol code for transaction sequence numbers.
407: // 3025 019280 IF TRN-ENTR-SEQ-NBR OF GLEN-RECORD NOT NUMERIC
408: // 3026 019290 MOVE ZEROES TO TRN-ENTR-SEQ-NBR OF GLEN-RECORD
409: // 3027 019300 END-IF
410: // 3028 019310 IF TRN-ENTR-SEQ-NBR OF GLEN-RECORD = SPACES
411: // 3029 019320 MOVE ZEROES
412: // 3030 019330 TO TRN-ENTR-SEQ-NBR OF ALT-GLEN-RECORD
413: // 3031 019340 ELSE
414: // 3032 019350 MOVE TRN-ENTR-SEQ-NBR OF GLEN-RECORD
415: // 3033 019360 TO TRN-ENTR-SEQ-NBR OF ALT-GLEN-RECORD
416: // 3034 019370 END-IF
417:
418: if (transactionLedgerEntrySequenceNumber == null) {
419: sb.append("00000");
420: } else {
421: // Format to a length of 5
422: String seqNum = transactionLedgerEntrySequenceNumber
423: .toString();
424: while (5 > seqNum.length()) {
425: seqNum = "0" + seqNum;
426: }
427: sb.append(seqNum);
428: }
429: sb.append(getField(40, transactionLedgerEntryDescription));
430: if (transactionLedgerEntryAmount == null) {
431: sb.append(SPACE_TRANSACTION_LEDGER_ENTRY_AMOUNT);
432: } else {
433: String a = transactionLedgerEntryAmount.toString();
434: sb.append(SPACE_TRANSACTION_LEDGER_ENTRY_AMOUNT.substring(
435: 0, 17 - a.length()));
436: sb.append(a);
437: }
438: sb.append(getField(1, transactionDebitCreditCode));
439: sb.append(formatDate(transactionDate));
440: sb.append(getField(10, organizationDocumentNumber));
441: sb.append(getField(10, projectCode));
442: sb.append(getField(8, organizationReferenceId));
443: sb.append(getField(4, referenceFinancialDocumentTypeCode));
444: sb.append(getField(2, referenceFinancialSystemOriginationCode));
445: sb.append(getField(14, referenceFinancialDocumentNumber));
446: sb.append(formatDate(financialDocumentReversalDate));
447: sb.append(getField(1, transactionEncumbranceUpdateCode));
448: // pad to full length of 173 chars.
449: while (173 > sb.toString().length()) {
450: sb.append(' ');
451: }
452: return sb.toString();
453: }
454:
455: protected LinkedHashMap toStringMapper() {
456: LinkedHashMap map = new LinkedHashMap();
457: map.put("entryId", entryId);
458: map.put("entryGroupId", entryGroupId);
459: map.put("universityFiscalYear", universityFiscalYear);
460: map.put("universityFiscalPeriodCode",
461: universityFiscalPeriodCode);
462: map.put("chartOfAccountsCode", chartOfAccountsCode);
463: map.put("accountNumber", accountNumber);
464: map.put("subAccountNumber", subAccountNumber);
465: map.put("financialObjectCode", financialObjectCode);
466: map.put("financialObjectTypeCode", financialObjectTypeCode);
467: map.put("financialSubObjectCode", financialSubObjectCode);
468: map.put("financialBalanceTypeCode", financialBalanceTypeCode);
469: map.put(KFSPropertyConstants.DOCUMENT_NUMBER, documentNumber);
470: map.put("financialDocumentTypeCode", financialDocumentTypeCode);
471: map.put("financialSystemOriginationCode",
472: financialSystemOriginationCode);
473: map.put("transactionLedgerEntrySequenceNumber",
474: transactionLedgerEntrySequenceNumber);
475: map.put("transactionLedgerEntryDescription",
476: transactionLedgerEntryDescription);
477: return map;
478: }
479:
480: public boolean isTransactionScrubberOffsetGenerationIndicator() {
481: return transactionScrubberOffsetGenerationIndicator;
482: }
483:
484: public void setTransactionScrubberOffsetGenerationIndicator(
485: boolean transactionScrubberOffsetGenerationIndicator) {
486: this .transactionScrubberOffsetGenerationIndicator = transactionScrubberOffsetGenerationIndicator;
487: }
488:
489: public String getAccountNumber() {
490: return accountNumber;
491: }
492:
493: public void setAccountNumber(String accountNumber) {
494: this .accountNumber = accountNumber;
495: }
496:
497: public String getFinancialBalanceTypeCode() {
498: return financialBalanceTypeCode;
499: }
500:
501: public void setFinancialBalanceTypeCode(
502: String financialBalanceTypeCode) {
503: this .financialBalanceTypeCode = financialBalanceTypeCode;
504: }
505:
506: public String getChartOfAccountsCode() {
507: return chartOfAccountsCode;
508: }
509:
510: public void setChartOfAccountsCode(String chartOfAccountsCode) {
511: this .chartOfAccountsCode = chartOfAccountsCode;
512: }
513:
514: public String getTransactionDebitCreditCode() {
515: return transactionDebitCreditCode;
516: }
517:
518: public void setTransactionDebitCreditCode(
519: String transactionDebitCreditCode) {
520: if (transactionDebitCreditCode != null) {
521: this .transactionDebitCreditCode = transactionDebitCreditCode
522: .toUpperCase();
523: }
524: }
525:
526: public String getDocumentNumber() {
527: return documentNumber;
528: }
529:
530: public void setDocumentNumber(String documentNumber) {
531: this .documentNumber = documentNumber;
532: }
533:
534: public Date getFinancialDocumentReversalDate() {
535: return financialDocumentReversalDate;
536: }
537:
538: public void setFinancialDocumentReversalDate(
539: Date financialDocumentReversalDate) {
540: this .financialDocumentReversalDate = financialDocumentReversalDate;
541: }
542:
543: public String getFinancialDocumentTypeCode() {
544: return financialDocumentTypeCode;
545: }
546:
547: public void setFinancialDocumentTypeCode(
548: String financialDocumentTypeCode) {
549: this .financialDocumentTypeCode = financialDocumentTypeCode;
550: }
551:
552: public String getTransactionEncumbranceUpdateCode() {
553: return transactionEncumbranceUpdateCode;
554: }
555:
556: public void setTransactionEncumbranceUpdateCode(
557: String transactionEncumbranceUpdateCode) {
558: this .transactionEncumbranceUpdateCode = transactionEncumbranceUpdateCode;
559: }
560:
561: public Integer getEntryGroupId() {
562: return entryGroupId;
563: }
564:
565: public void setEntryGroupId(Integer entryGroupId) {
566: this .entryGroupId = entryGroupId;
567: }
568:
569: public Integer getEntryId() {
570: return entryId;
571: }
572:
573: public void setEntryId(Integer entryId) {
574: this .entryId = entryId;
575: }
576:
577: public void resetEntryId() {
578: this .entryId = null;
579: this .versionNumber = null;
580: }
581:
582: public String getFinancialObjectCode() {
583: return financialObjectCode;
584: }
585:
586: public void setFinancialObjectCode(String financialObjectCode) {
587: this .financialObjectCode = financialObjectCode;
588: }
589:
590: public String getFinancialObjectTypeCode() {
591: return financialObjectTypeCode;
592: }
593:
594: public void setFinancialObjectTypeCode(
595: String financialObjectTypeCode) {
596: this .financialObjectTypeCode = financialObjectTypeCode;
597: }
598:
599: public String getOrganizationDocumentNumber() {
600: return organizationDocumentNumber;
601: }
602:
603: public void setOrganizationDocumentNumber(
604: String organizationDocumentNumber) {
605: this .organizationDocumentNumber = organizationDocumentNumber;
606: }
607:
608: public String getOrganizationReferenceId() {
609: return organizationReferenceId;
610: }
611:
612: public void setOrganizationReferenceId(
613: String organizationReferenceId) {
614: this .organizationReferenceId = organizationReferenceId;
615: }
616:
617: public String getFinancialSystemOriginationCode() {
618: return financialSystemOriginationCode;
619: }
620:
621: public void setFinancialSystemOriginationCode(
622: String financialSystemOriginationCode) {
623: this .financialSystemOriginationCode = financialSystemOriginationCode;
624: }
625:
626: public String getProjectCode() {
627: return projectCode;
628: }
629:
630: public void setProjectCode(String projectCode) {
631: this .projectCode = projectCode;
632: }
633:
634: public String getReferenceFinancialDocumentNumber() {
635: return referenceFinancialDocumentNumber;
636: }
637:
638: public void setReferenceFinancialDocumentNumber(
639: String referenceFinancialDocumentNumber) {
640: this .referenceFinancialDocumentNumber = referenceFinancialDocumentNumber;
641: }
642:
643: public String getReferenceFinancialDocumentTypeCode() {
644: return referenceFinancialDocumentTypeCode;
645: }
646:
647: public void setReferenceFinancialDocumentTypeCode(
648: String referenceFinancialDocumentTypeCode) {
649: this .referenceFinancialDocumentTypeCode = referenceFinancialDocumentTypeCode;
650: }
651:
652: public String getReferenceFinancialSystemOriginationCode() {
653: return referenceFinancialSystemOriginationCode;
654: }
655:
656: public void setReferenceFinancialSystemOriginationCode(
657: String referenceFinancialSystemOriginationCode) {
658: this .referenceFinancialSystemOriginationCode = referenceFinancialSystemOriginationCode;
659: }
660:
661: public String getSubAccountNumber() {
662: return subAccountNumber;
663: }
664:
665: public void setSubAccountNumber(String subAccountNumber) {
666: this .subAccountNumber = subAccountNumber;
667: }
668:
669: public String getFinancialSubObjectCode() {
670: return financialSubObjectCode;
671: }
672:
673: public void setFinancialSubObjectCode(String financialSubObjectCode) {
674: this .financialSubObjectCode = financialSubObjectCode;
675: }
676:
677: public Date getTransactionDate() {
678: return transactionDate;
679: }
680:
681: public void setTransactionDate(Date transactionDate) {
682: this .transactionDate = transactionDate;
683: }
684:
685: public Integer getTransactionLedgerEntrySequenceNumber() {
686: return transactionLedgerEntrySequenceNumber;
687: }
688:
689: public void setTransactionLedgerEntrySequenceNumber(
690: Integer transactionLedgerEntrySequenceNumber) {
691: this .transactionLedgerEntrySequenceNumber = transactionLedgerEntrySequenceNumber;
692: }
693:
694: public KualiDecimal getTransactionLedgerEntryAmount() {
695: return transactionLedgerEntryAmount;
696: }
697:
698: public void setTransactionLedgerEntryAmount(
699: KualiDecimal transactionLedgerEntryAmount) {
700: this .transactionLedgerEntryAmount = transactionLedgerEntryAmount;
701: }
702:
703: public void setTransactionLedgerEntryAmount(
704: String transactionLedgerEntryAmount) {
705: this .transactionLedgerEntryAmount = new KualiDecimal(
706: transactionLedgerEntryAmount);
707: }
708:
709: public void clearTransactionLedgerEntryAmount() {
710: this .transactionLedgerEntryAmount = null;
711: }
712:
713: public String getTransactionLedgerEntryDescription() {
714: return transactionLedgerEntryDescription;
715: }
716:
717: public void setTransactionLedgerEntryDescription(
718: String transactionLedgerEntryDescription) {
719: this .transactionLedgerEntryDescription = transactionLedgerEntryDescription;
720: }
721:
722: public String getUniversityFiscalPeriodCode() {
723: return universityFiscalPeriodCode;
724: }
725:
726: public void setUniversityFiscalPeriodCode(
727: String universityFiscalPeriodCode) {
728: this .universityFiscalPeriodCode = universityFiscalPeriodCode;
729: }
730:
731: public Integer getUniversityFiscalYear() {
732: return universityFiscalYear;
733: }
734:
735: public void setUniversityFiscalYear(Integer universityFiscalYear) {
736: this .universityFiscalYear = universityFiscalYear;
737: }
738:
739: public boolean isDebit() {
740: return KFSConstants.GL_DEBIT_CODE
741: .equals(this .transactionDebitCreditCode);
742: }
743:
744: public boolean isCredit() {
745: return KFSConstants.GL_CREDIT_CODE
746: .equals(this .transactionDebitCreditCode);
747: }
748:
749: public void setFieldValue(String fieldName, String fieldValue) {
750: if ("universityFiscalYear".equals(fieldName)) {
751: if (StringUtils.isNotBlank(fieldValue)) {
752: setUniversityFiscalYear(Integer.parseInt(fieldValue));
753: } else {
754: setUniversityFiscalYear(null);
755: }
756: } else if ("chartOfAccountsCode".equals(fieldName)) {
757: setChartOfAccountsCode(fieldValue);
758: } else if ("accountNumber".equals(fieldName)) {
759: setAccountNumber(fieldValue);
760: } else if ("subAccountNumber".equals(fieldName)) {
761: setSubAccountNumber(fieldValue);
762: } else if ("financialObjectCode".equals(fieldName)) {
763: setFinancialObjectCode(fieldValue);
764: } else if ("financialSubObjectCode".equals(fieldName)) {
765: setFinancialSubObjectCode(fieldValue);
766: } else if ("financialBalanceTypeCode".equals(fieldName)) {
767: setFinancialBalanceTypeCode(fieldValue);
768: } else if ("financialObjectTypeCode".equals(fieldName)) {
769: setFinancialObjectTypeCode(fieldValue);
770: } else if ("universityFiscalPeriodCode".equals(fieldName)) {
771: setUniversityFiscalPeriodCode(fieldValue);
772: } else if ("financialDocumentTypeCode".equals(fieldName)) {
773: setFinancialDocumentTypeCode(fieldValue);
774: } else if ("financialSystemOriginationCode".equals(fieldName)) {
775: setFinancialSystemOriginationCode(fieldValue);
776: } else if (KFSPropertyConstants.DOCUMENT_NUMBER
777: .equals(fieldName)) {
778: setDocumentNumber(fieldValue);
779: } else if ("transactionLedgerEntrySequenceNumber"
780: .equals(fieldName)) {
781: if (StringUtils.isNotBlank(fieldValue)) {
782: setTransactionLedgerEntrySequenceNumber(Integer
783: .parseInt(fieldValue));
784: } else {
785: setTransactionLedgerEntrySequenceNumber(null);
786: }
787: } else if ("transactionLedgerEntryDescription"
788: .equals(fieldName)) {
789: setTransactionLedgerEntryDescription(fieldValue);
790: } else if ("transactionLedgerEntryAmount".equals(fieldName)) {
791: if (StringUtils.isNotBlank(fieldValue)) {
792: setTransactionLedgerEntryAmount(new KualiDecimal(
793: fieldValue));
794: } else {
795: clearTransactionLedgerEntryAmount();
796: }
797: } else if ("transactionDebitCreditCode".equals(fieldName)) {
798: setTransactionDebitCreditCode(fieldValue);
799: } else if ("transactionDate".equals(fieldName)) {
800: if (StringUtils.isNotBlank(fieldValue)) {
801: try {
802: SimpleDateFormat df = new SimpleDateFormat(
803: "yyyy-MM-dd");
804: setTransactionDate(new java.sql.Date((df
805: .parse(fieldValue)).getTime()));
806: } catch (ParseException e) {
807: setTransactionDate(null);
808: }
809: } else {
810: setTransactionDate(null);
811: }
812: } else if ("organizationDocumentNumber".equals(fieldName)) {
813: setOrganizationDocumentNumber(fieldValue);
814: } else if ("projectCode".equals(fieldName)) {
815: setProjectCode(fieldValue);
816: } else if ("organizationReferenceId".equals(fieldName)) {
817: setOrganizationReferenceId(fieldValue);
818: } else if ("referenceFinancialDocumentTypeCode"
819: .equals(fieldName)) {
820: setReferenceFinancialDocumentTypeCode(fieldValue);
821: } else if ("referenceFinancialSystemOriginationCode"
822: .equals(fieldName)) {
823: setReferenceFinancialSystemOriginationCode(fieldValue);
824: } else if ("referenceFinancialDocumentNumber".equals(fieldName)) {
825: setReferenceFinancialDocumentNumber(fieldValue);
826: } else if ("financialDocumentReversalDate".equals(fieldName)) {
827: if (StringUtils.isNotBlank(fieldValue)) {
828: try {
829: SimpleDateFormat df = new SimpleDateFormat(
830: "yyyy-MM-dd");
831: setFinancialDocumentReversalDate(new java.sql.Date(
832: (df.parse(fieldValue)).getTime()));
833: } catch (ParseException e) {
834: setFinancialDocumentReversalDate(null);
835: }
836: } else {
837: setFinancialDocumentReversalDate(null);
838: }
839: } else if ("transactionEncumbranceUpdateCode".equals(fieldName)) {
840: setTransactionEncumbranceUpdateCode(fieldValue);
841: } else {
842: throw new IllegalArgumentException("Invalid Field Name "
843: + fieldName);
844: }
845: }
846:
847: public Object getFieldValue(String fieldName) {
848: if ("universityFiscalYear".equals(fieldName)) {
849: return getUniversityFiscalYear();
850: } else if ("chartOfAccountsCode".equals(fieldName)) {
851: return getChartOfAccountsCode();
852: } else if ("accountNumber".equals(fieldName)) {
853: return getAccountNumber();
854: } else if ("subAccountNumber".equals(fieldName)) {
855: return getSubAccountNumber();
856: } else if ("financialObjectCode".equals(fieldName)) {
857: return getFinancialObjectCode();
858: } else if ("financialSubObjectCode".equals(fieldName)) {
859: return getFinancialSubObjectCode();
860: } else if ("financialBalanceTypeCode".equals(fieldName)) {
861: return getFinancialBalanceTypeCode();
862: } else if ("financialObjectTypeCode".equals(fieldName)) {
863: return getFinancialObjectTypeCode();
864: } else if ("universityFiscalPeriodCode".equals(fieldName)) {
865: return getUniversityFiscalPeriodCode();
866: } else if ("financialDocumentTypeCode".equals(fieldName)) {
867: return getFinancialDocumentTypeCode();
868: } else if ("financialSystemOriginationCode".equals(fieldName)) {
869: return getFinancialSystemOriginationCode();
870: } else if (KFSPropertyConstants.DOCUMENT_NUMBER
871: .equals(fieldName)) {
872: return getDocumentNumber();
873: } else if ("transactionLedgerEntrySequenceNumber"
874: .equals(fieldName)) {
875: return getTransactionLedgerEntrySequenceNumber();
876: } else if ("transactionLedgerEntryDescription"
877: .equals(fieldName)) {
878: return getTransactionLedgerEntryDescription();
879: } else if ("transactionLedgerEntryAmount".equals(fieldName)) {
880: return getTransactionLedgerEntryAmount();
881: } else if ("transactionDebitCreditCode".equals(fieldName)) {
882: return getTransactionDebitCreditCode();
883: } else if ("transactionDate".equals(fieldName)) {
884: return getTransactionDate();
885: } else if ("organizationDocumentNumber".equals(fieldName)) {
886: return getOrganizationDocumentNumber();
887: } else if ("projectCode".equals(fieldName)) {
888: return getProjectCode();
889: } else if ("organizationReferenceId".equals(fieldName)) {
890: return getOrganizationReferenceId();
891: } else if ("referenceFinancialDocumentTypeCode"
892: .equals(fieldName)) {
893: return getReferenceFinancialDocumentTypeCode();
894: } else if ("referenceFinancialSystemOriginationCode"
895: .equals(fieldName)) {
896: return getReferenceFinancialSystemOriginationCode();
897: } else if ("referenceFinancialDocumentNumber".equals(fieldName)) {
898: return getReferenceFinancialDocumentNumber();
899: } else if ("financialDocumentReversalDate".equals(fieldName)) {
900: return getFinancialDocumentReversalDate();
901: } else if ("transactionEncumbranceUpdateCode".equals(fieldName)) {
902: return getTransactionEncumbranceUpdateCode();
903: } else {
904: throw new IllegalArgumentException("Invalid Field Name "
905: + fieldName);
906: }
907: }
908: }
|