View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package org.kuali.kfs.gl.businessobject;
21  
22  import java.sql.Date;
23  import java.util.LinkedHashMap;
24  import java.util.Map;
25  
26  import org.apache.commons.lang.StringUtils;
27  import org.kuali.kfs.coa.businessobject.Account;
28  import org.kuali.kfs.coa.businessobject.BalanceType;
29  import org.kuali.kfs.coa.businessobject.Chart;
30  import org.kuali.kfs.coa.businessobject.ObjectCode;
31  import org.kuali.kfs.coa.businessobject.ObjectType;
32  import org.kuali.kfs.coa.service.AccountService;
33  import org.kuali.kfs.gl.GeneralLedgerConstants;
34  import org.kuali.kfs.sys.KFSConstants;
35  import org.kuali.kfs.sys.KFSKeyConstants;
36  import org.kuali.kfs.sys.KFSPropertyConstants;
37  import org.kuali.kfs.sys.businessobject.UniversityDate;
38  import org.kuali.kfs.sys.context.SpringContext;
39  import org.kuali.rice.core.api.util.type.KualiDecimal;
40  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
41  import org.kuali.rice.krad.util.MessageMap;
42  
43  /**
44   * CollectorDetail Business Object.
45   */
46  public class CollectorDetail extends PersistableBusinessObjectBase {
47  
48      private String universityFiscalPeriodCode;
49      private Integer universityFiscalYear;
50      private Date createDate;
51      private Integer transactionLedgerEntrySequenceNumber;
52      private String chartOfAccountsCode;
53      private String accountNumber;
54      private String subAccountNumber;
55      private String financialObjectCode;
56      private String financialSubObjectCode;
57      private String financialBalanceTypeCode;
58      private String financialObjectTypeCode;
59      private String collectorDetailSequenceNumber;
60      private String financialDocumentTypeCode;
61      private String financialSystemOriginationCode;
62      private String documentNumber;
63      private KualiDecimal collectorDetailItemAmount;
64      private String collectorDetailNoteText;
65      private String glCreditCode;
66      
67      private ObjectCode financialObject;
68      private Account account;
69      private Chart chartOfAccounts;
70      private ObjectType objectType;
71      private BalanceType balanceType;
72  
73      private static CollectorDetailFieldUtil collectorDetailFieldUtil;
74      
75      /**
76       * Default constructor.
77       */
78      public CollectorDetail() {
79          setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
80          setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
81      }
82  
83      /**
84       * Gets the universityFiscalPeriodCode attribute.
85       * 
86       * @return Returns the universityFiscalPeriodCode
87       */
88      public String getUniversityFiscalPeriodCode() {
89          return universityFiscalPeriodCode;
90      }
91  
92      /**
93       * Sets the universityFiscalPeriodCode attribute.
94       * 
95       * @param universityFiscalPeriodCode The universityFiscalPeriodCode to set.
96       */
97      public void setUniversityFiscalPeriodCode(String universityFiscalPeriodCode) {
98          this.universityFiscalPeriodCode = universityFiscalPeriodCode;
99      }
100 
101 
102     /**
103      * Gets the universityFiscalYear attribute.
104      * 
105      * @return Returns the universityFiscalYear
106      */
107     public Integer getUniversityFiscalYear() {
108         return universityFiscalYear;
109     }
110 
111     /**
112      * Sets the universityFiscalYear attribute.
113      * 
114      * @param universityFiscalYear The universityFiscalYear to set.
115      */
116     public void setUniversityFiscalYear(Integer universityFiscalYear) {
117         this.universityFiscalYear = universityFiscalYear;
118     }
119 
120 
121     /**
122      * Gets the createDate attribute.
123      * 
124      * @return Returns the createDate
125      */
126     public Date getCreateDate() {
127         return createDate;
128     }
129 
130     /**
131      * Sets the createDate attribute.
132      * 
133      * @param createDate The createDate to set.
134      */
135     public void setCreateDate(Date createDate) {
136         this.createDate = createDate;
137     }
138 
139     /**
140      * Gets the transactionLedgerEntrySequenceNumber attribute. 
141      * @return Returns the transactionLedgerEntrySequenceNumber.
142      */
143     public Integer getTransactionLedgerEntrySequenceNumber() {
144         return transactionLedgerEntrySequenceNumber;
145     }
146 
147     /**
148      * Sets the transactionLedgerEntrySequenceNumber attribute value.
149      * @param transactionLedgerEntrySequenceNumber The transactionLedgerEntrySequenceNumber to set.
150      */
151     public void setTransactionLedgerEntrySequenceNumber(Integer transactionLedgerEntrySequenceNumber) {
152         this.transactionLedgerEntrySequenceNumber = transactionLedgerEntrySequenceNumber;
153     }
154 
155     /**
156      * Gets the chartOfAccountsCode attribute.
157      * 
158      * @return Returns the chartOfAccountsCode
159      */
160     public String getChartOfAccountsCode() {
161         return chartOfAccountsCode;
162     }
163 
164     /**
165      * Sets the chartOfAccountsCode attribute.
166      * 
167      * @param chartOfAccountsCode The chartOfAccountsCode to set.
168      */
169     public void setChartOfAccountsCode(String chartOfAccountsCode) {
170         this.chartOfAccountsCode = chartOfAccountsCode;
171     }
172 
173 
174     /**
175      * Gets the accountNumber attribute.
176      * 
177      * @return Returns the accountNumber
178      */
179     public String getAccountNumber() {
180         return accountNumber;
181     }
182 
183     /**
184      * Sets the accountNumber attribute.
185      * 
186      * @param accountNumber The accountNumber to set.
187      */
188     public void setAccountNumber(String accountNumber) {
189         this.accountNumber = accountNumber;
190     }
191 
192 
193     /**
194      * Gets the subAccountNumber attribute.
195      * 
196      * @return Returns the subAccountNumber
197      */
198     public String getSubAccountNumber() {
199         return subAccountNumber;
200     }
201 
202     /**
203      * Sets the subAccountNumber attribute.
204      * 
205      * @param subAccountNumber The subAccountNumber to set.
206      */
207     public void setSubAccountNumber(String subAccountNumber) {
208         this.subAccountNumber = subAccountNumber;
209     }
210 
211 
212     /**
213      * Gets the financialObjectCode attribute.
214      * 
215      * @return Returns the financialObjectCode
216      */
217     public String getFinancialObjectCode() {
218         return financialObjectCode;
219     }
220 
221     /**
222      * Sets the financialObjectCode attribute.
223      * 
224      * @param financialObjectCode The financialObjectCode to set.
225      */
226     public void setFinancialObjectCode(String financialObjectCode) {
227         this.financialObjectCode = financialObjectCode;
228     }
229 
230 
231     /**
232      * Gets the financialSubObjectCode attribute.
233      * 
234      * @return Returns the financialSubObjectCode
235      */
236     public String getFinancialSubObjectCode() {
237         return financialSubObjectCode;
238     }
239 
240     /**
241      * Sets the financialSubObjectCode attribute.
242      * 
243      * @param financialSubObjectCode The financialSubObjectCode to set.
244      */
245     public void setFinancialSubObjectCode(String financialSubObjectCode) {
246         this.financialSubObjectCode = financialSubObjectCode;
247     }
248 
249 
250     /**
251      * Gets the collectorDetailSequenceNumber attribute.
252      * 
253      * @return Returns the collectorDetailSequenceNumber
254      */
255     public String getCollectorDetailSequenceNumber() {
256         return collectorDetailSequenceNumber;
257     }
258 
259     /**
260      * Sets the collectorDetailSequenceNumber attribute.
261      * 
262      * @param collectorDetailSequenceNumber The collectorDetailSequenceNumber to set.
263      */
264     public void setCollectorDetailSequenceNumber(String collectorDetailSequenceNumber) {
265         this.collectorDetailSequenceNumber = collectorDetailSequenceNumber;
266     }
267 
268 
269     /**
270      * Gets the financialDocumentTypeCode attribute.
271      * 
272      * @return Returns the financialDocumentTypeCode
273      */
274     public String getFinancialDocumentTypeCode() {
275         return financialDocumentTypeCode;
276     }
277 
278     /**
279      * Sets the financialDocumentTypeCode attribute.
280      * 
281      * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
282      */
283     public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
284         this.financialDocumentTypeCode = financialDocumentTypeCode;
285     }
286 
287 
288     /**
289      * Gets the financialSystemOriginationCode attribute.
290      * 
291      * @return Returns the financialSystemOriginationCode
292      */
293     public String getFinancialSystemOriginationCode() {
294         return financialSystemOriginationCode;
295     }
296 
297     /**
298      * Sets the financialSystemOriginationCode attribute.
299      * 
300      * @param financialSystemOriginationCode The financialSystemOriginationCode to set.
301      */
302     public void setFinancialSystemOriginationCode(String financialSystemOriginationCode) {
303         this.financialSystemOriginationCode = financialSystemOriginationCode;
304     }
305 
306 
307     /**
308      * Gets the documentNumber attribute.
309      * 
310      * @return Returns the documentNumber
311      */
312     public String getDocumentNumber() {
313         return documentNumber;
314     }
315 
316     /**
317      * Sets the documentNumber attribute.
318      * 
319      * @param documentNumber The documentNumber to set.
320      */
321     public void setDocumentNumber(String documentNumber) {
322         this.documentNumber = documentNumber;
323     }
324 
325 
326     /**
327      * Gets the collectorDetailItemAmount attribute.
328      * 
329      * @return Returns the collectorDetailItemAmount
330      */
331     public KualiDecimal getCollectorDetailItemAmount() {
332         return collectorDetailItemAmount;
333     }
334 
335     /**
336      * Sets the collectorDetailItemAmount attribute.
337      * 
338      * @param collectorDetailItemAmount The collectorDetailItemAmount to set.
339      */
340     public void setCollectorDetailItemAmount(KualiDecimal collectorDetailItemAmount) {
341         this.collectorDetailItemAmount = collectorDetailItemAmount;
342     }
343 
344     public void setCollectorDetailItemAmount(String collectorDetailItemAmount) {
345         this.collectorDetailItemAmount = new KualiDecimal(collectorDetailItemAmount);
346     }
347 
348     public void clearcollectorDetailItemAmount() {
349         this.collectorDetailItemAmount = null;
350     }
351 
352     /**
353      * Gets the collectorDetailNoteText attribute.
354      * 
355      * @return Returns the collectorDetailNoteText
356      */
357     public String getCollectorDetailNoteText() {
358         return collectorDetailNoteText;
359     }
360 
361     /**
362      * Sets the collectorDetailNoteText attribute.
363      * 
364      * @param collectorDetailNoteText The collectorDetailNoteText to set.
365      */
366     public void setCollectorDetailNoteText(String collectorDetailNoteText) {
367         this.collectorDetailNoteText = collectorDetailNoteText;
368     }
369 
370 
371     /**
372      * Gets the financialObject attribute.
373      * 
374      * @return Returns the financialObject
375      */
376     public ObjectCode getFinancialObject() {
377         return financialObject;
378     }
379 
380     /**
381      * Sets the financialObject attribute.
382      * 
383      * @param financialObject The financialObject to set.
384      * @deprecated
385      */
386     public void setFinancialObject(ObjectCode financialObject) {
387         this.financialObject = financialObject;
388     }
389 
390     /**
391      * Gets the account attribute.
392      * 
393      * @return Returns the account
394      */
395     public Account getAccount() {
396         return account;
397     }
398 
399     /**
400      * Sets the account attribute.
401      * 
402      * @param account The account to set.
403      * @deprecated
404      */
405     public void setAccount(Account account) {
406         this.account = account;
407     }
408 
409     /**
410      * Gets the chartOfAccounts attribute.
411      * 
412      * @return Returns the chartOfAccounts
413      */
414     public Chart getChartOfAccounts() {
415         return chartOfAccounts;
416     }
417 
418     /**
419      * Sets the chartOfAccounts attribute.
420      * 
421      * @param chartOfAccounts The chartOfAccounts to set.
422      * @deprecated
423      */
424     public void setChartOfAccounts(Chart chartOfAccounts) {
425         this.chartOfAccounts = chartOfAccounts;
426     }
427 
428     /**
429      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
430      */
431     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
432         LinkedHashMap m = new LinkedHashMap();
433         m.put("universityFiscalPeriodCode", getUniversityFiscalPeriodCode());
434         if (getUniversityFiscalYear() != null) {
435             m.put("universityFiscalYear", getUniversityFiscalYear().toString());
436         }
437         if (getCreateDate() != null) {
438             m.put("createDate", getCreateDate().toString());
439         }
440         m.put("transactionLedgerEntrySequenceNumber", getTransactionLedgerEntrySequenceNumber());
441         m.put("chartOfAccountsCode", getChartOfAccountsCode());
442         m.put("accountNumber", getAccountNumber());
443         m.put("subAccountNumber", getSubAccountNumber());
444         m.put("financialObjectCode", getFinancialObjectCode());
445         m.put("financialSubObjectCode", getFinancialSubObjectCode());
446         m.put("collectorDetailSequenceNumber", getCollectorDetailSequenceNumber());
447         m.put("financialDocumentTypeCode", getFinancialDocumentTypeCode());
448         m.put(KFSPropertyConstants.DOCUMENT_NUMBER, getDocumentNumber());
449         return m;
450     }
451 
452     /**
453      * Gets the balanceTyp attribute.
454      * 
455      * @return Returns the balanceTyp.
456      */
457     public BalanceType getBalanceType() {
458         return balanceType;
459     }
460 
461     /**
462      * Sets the balanceTyp attribute value.
463      * 
464      * @param balanceTyp The balanceTyp to set.
465      */
466     public void setBalanceType(BalanceType balanceTyp) {
467         this.balanceType = balanceTyp;
468     }
469 
470     /**
471      * Gets the financialBalanceTypeCode attribute.
472      * 
473      * @return Returns the financialBalanceTypeCode.
474      */
475     public String getFinancialBalanceTypeCode() {
476         return financialBalanceTypeCode;
477     }
478 
479     /**
480      * Sets the financialBalanceTypeCode attribute value.
481      * 
482      * @param financialBalanceTypeCode The financialBalanceTypeCode to set.
483      */
484     public void setFinancialBalanceTypeCode(String financialBalanceTypeCode) {
485         this.financialBalanceTypeCode = financialBalanceTypeCode;
486     }
487 
488     /**
489      * Gets the financialObjectTypeCode attribute.
490      * 
491      * @return Returns the financialObjectTypeCode.
492      */
493     public String getFinancialObjectTypeCode() {
494         return financialObjectTypeCode;
495     }
496 
497     /**
498      * Sets the financialObjectTypeCode attribute value.
499      * 
500      * @param financialObjectTypeCode The financialObjectTypeCode to set.
501      */
502     public void setFinancialObjectTypeCode(String financialObjectTypeCode) {
503         this.financialObjectTypeCode = financialObjectTypeCode;
504     }
505 
506     /**
507      * Gets the glCreditCode attribute.
508      * 
509      * @return Returns the glCreditCode.
510      */
511     public String getGlCreditCode() {
512         return glCreditCode;
513     }
514 
515     /**
516      * Sets the glCreditCode attribute value.
517      * 
518      * @param glCreditCode The glCreditCode to set.
519      */
520     public void setGLCreditCode(String glCreditCode) {
521         this.glCreditCode = glCreditCode;
522     }
523 
524 
525     /**
526      * Gets the objectType attribute.
527      * 
528      * @return Returns the objectType.
529      */
530     public ObjectType getObjectType() {
531         return objectType;
532     }
533 
534     /**
535      * Sets the objectType attribute value.
536      * 
537      * @param objectType The objectType to set.
538      */
539     public void setObjectType(ObjectType objectType) {
540         this.objectType = objectType;
541     }
542     
543     protected String getValue(String headerLine, int s, int e) {
544         return org.springframework.util.StringUtils.trimTrailingWhitespace(StringUtils.substring(headerLine, s, e));
545     }
546         
547     /**
548      * @return the static instance of the CollectorBatchrFieldUtil
549      */
550     protected static CollectorDetailFieldUtil getCollectorDetailFieldUtil() {
551         if (collectorDetailFieldUtil == null) {
552             collectorDetailFieldUtil = new CollectorDetailFieldUtil();
553         }
554         return collectorDetailFieldUtil;
555     }
556     
557     public void setFromFileForCollectorDetail(String detailLine, Map<String, String>accountRecordBalanceTypeMap, Date curDate, UniversityDate universityDate, int lineNumber, MessageMap messageMap) {
558 
559         try{
560             
561             final Map<String, Integer> pMap = getCollectorDetailFieldUtil().getFieldBeginningPositionMap();
562             
563             detailLine = org.apache.commons.lang.StringUtils.rightPad(detailLine, GeneralLedgerConstants.getSpaceAllCollectorDetailFields().length(), ' ');
564 
565             setCreateDate(curDate);
566             if (!GeneralLedgerConstants.getSpaceUniversityFiscalYear().equals(detailLine.substring(pMap.get(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR), pMap.get(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE)))) {
567                 try {
568                     setUniversityFiscalYear(new Integer(getValue(detailLine, pMap.get(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR), pMap.get(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE))));
569                 }
570                 catch (NumberFormatException e) {
571                     messageMap.putError(KFSConstants.GLOBAL_ERRORS, KFSKeyConstants.ERROR_CUSTOM, "Collector detail university fiscal year " + lineNumber + " string " + detailLine.substring(pMap.get(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR), pMap.get(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE)));
572                     setUniversityFiscalYear(null);
573                 }
574             }
575             else {
576                 setUniversityFiscalYear(null);
577             }
578             
579             if (!GeneralLedgerConstants.getSpaceChartOfAccountsCode().equals(detailLine.substring(pMap.get(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR), pMap.get(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE))))
580                 setChartOfAccountsCode(getValue(detailLine, pMap.get(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE), pMap.get(KFSPropertyConstants.ACCOUNT_NUMBER)));
581             else
582                 setChartOfAccountsCode(GeneralLedgerConstants.getSpaceChartOfAccountsCode());            
583             setAccountNumber(getValue(detailLine, pMap.get(KFSPropertyConstants.ACCOUNT_NUMBER), pMap.get(KFSPropertyConstants.SUB_ACCOUNT_NUMBER)));
584             
585             // if chart code is empty while accounts cannot cross charts, then derive chart code from account number
586             AccountService acctserv = SpringContext.getBean(AccountService.class);
587             if (StringUtils.isEmpty(getChartOfAccountsCode()) && StringUtils.isNotEmpty(getAccountNumber()) && !acctserv.accountsCanCrossCharts()) {
588                 Account account = acctserv.getUniqueAccountForAccountNumber(getAccountNumber());
589                 if (account != null) {
590                     setChartOfAccountsCode(account.getChartOfAccountsCode());
591                 }            
592             }
593                         
594             setSubAccountNumber(getValue(detailLine, pMap.get(KFSPropertyConstants.SUB_ACCOUNT_NUMBER), pMap.get(KFSPropertyConstants.FINANCIAL_OBJECT_CODE)));
595             setFinancialObjectCode(getValue(detailLine, pMap.get(KFSPropertyConstants.FINANCIAL_OBJECT_CODE), pMap.get(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE)));
596             setFinancialSubObjectCode(getValue(detailLine, pMap.get(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE), pMap.get(KFSPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE)));
597             
598             // We are in Collector Detail for ID Billing Details because the value from file positions 26, 27 = DT.  We don not want to set Financial Balance Type Code to detail type code (DT)   
599             // Generate the account record key to retrieve the balance type from the map which contains the balance type from the accounting record/origin entry
600             String accountRecordKey = generateAccountRecordBalanceTypeKey();
601             String financialBalanceTypeCode = accountRecordBalanceTypeMap.get(accountRecordKey);
602             // Default to "AC" if we do not find account record key record from the map
603             setFinancialBalanceTypeCode(StringUtils.defaultIfEmpty(financialBalanceTypeCode, GeneralLedgerConstants.FINALNCIAL_BALANCE_TYPE_FOR_COLLECTOR_DETAIL_RECORD));
604             setFinancialObjectTypeCode(getValue(detailLine, pMap.get(KFSPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE), pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_SEQUENCE_NUMBER)));
605             setUniversityFiscalPeriodCode(universityDate.getUniversityFiscalAccountingPeriod());
606             setCollectorDetailSequenceNumber(getValue(detailLine, pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_SEQUENCE_NUMBER), pMap.get(KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE)));
607             setFinancialDocumentTypeCode(getValue(detailLine, pMap.get(KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE), pMap.get(KFSPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE)));
608             setFinancialSystemOriginationCode(getValue(detailLine, pMap.get(KFSPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE), pMap.get(KFSPropertyConstants.DOCUMENT_NUMBER)));
609             setDocumentNumber(getValue(detailLine, pMap.get(KFSPropertyConstants.DOCUMENT_NUMBER), pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_AMOUNT)));
610             try {
611                 setCollectorDetailItemAmount(getValue(detailLine, pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_AMOUNT), pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_GL_CREDIT_CODE)));
612             }
613             catch (NumberFormatException e) {
614                 setCollectorDetailItemAmount(KualiDecimal.ZERO);
615                 messageMap.putError(KFSConstants.GLOBAL_ERRORS, KFSKeyConstants.ERROR_CUSTOM, "Collector detail amount cannot be parsed on line " + lineNumber + " amount string " + detailLine.substring(pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_AMOUNT), pMap.get(KFSPropertyConstants.GL_CREDIT_CODE)));
616             }
617             if (KFSConstants.GL_CREDIT_CODE.equalsIgnoreCase(getValue(detailLine, pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_GL_CREDIT_CODE), pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_NOTE_TEXT)))) {
618                 setCollectorDetailItemAmount(getCollectorDetailItemAmount().negated());
619             }
620             setCollectorDetailNoteText(getValue(detailLine, pMap.get(KFSPropertyConstants.COLLECTOR_DETAIL_NOTE_TEXT), GeneralLedgerConstants.getSpaceAllCollectorDetailFields().length()));
621             
622             if (org.apache.commons.lang.StringUtils.isEmpty(getSubAccountNumber())) {
623                 setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
624             }
625             if (org.apache.commons.lang.StringUtils.isEmpty(getFinancialSubObjectCode())) {
626                 setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
627             }
628             if (org.apache.commons.lang.StringUtils.isEmpty(getCollectorDetailSequenceNumber())) {
629                 setCollectorDetailSequenceNumber(" ");
630             }
631         } catch (Exception e){
632             throw new RuntimeException(e + " occurred in CollectorDetail.setFromFileForCollectorDetail()");
633         }
634     }
635     
636     /**
637      * Account record balance type key 
638      * Fiscal Year - Chart Code - Account Number - Sub-account Number - Object code - Sub-object Code
639      * 
640      * For the two optional fields sub-account and sub-object code, create an additional filter to replace
641      * the usual place holder - with spaces
642      * 
643      * NOTE: this should match the same implementation in CollectorFlatFile generateAccountRecordBalanceTypeKey
644      * 
645      * @return
646      */
647     private String generateAccountRecordBalanceTypeKey() {
648         StringBuilder builder = new StringBuilder();
649         builder.append(getUniversityFiscalYear()).append("|")
650             .append(getChartOfAccountsCode()).append("|")
651             .append(getAccountNumber()).append("|")
652             .append(StringUtils.replace(getSubAccountNumber(), "-", "")).append("|")
653             .append(getFinancialObjectCode()).append("|")
654             .append(StringUtils.replace(getFinancialSubObjectCode(), "-", ""));
655         return builder.toString();
656     }
657 }