View Javadoc
1   /*
2    * Copyright 2007-2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.gl.businessobject;
17  
18  import java.util.Map;
19  
20  import org.kuali.ole.sys.OLEPropertyConstants;
21  import org.kuali.ole.sys.businessobject.BusinessObjectStringParserFieldUtils;
22  import org.kuali.rice.krad.bo.BusinessObject;
23  
24  /**
25   * This class has utility methods for parsing OriginEntries from Strings
26   */
27  public class CollectorDetailFieldUtil extends BusinessObjectStringParserFieldUtils {
28  
29      /**
30       * Returns the class to parse into - OriginEntryFull
31       * @see org.kuali.ole.sys.businessobject.BusinessObjectStringParserFieldUtils#getBusinessObjectClass()
32       */
33      @Override
34      public Class<? extends BusinessObject> getBusinessObjectClass() {
35          return CollectorDetail.class;
36      }
37  
38      /**
39       * Returns the fields to be parsed from a String, in order, to form an OriginEntryFull
40       * @see org.kuali.ole.sys.businessobject.BusinessObjectStringParserFieldUtils#getOrderedProperties()
41       */
42      @Override
43      public String[] getOrderedProperties() {
44          return new String[] {
45                  OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR,
46                  OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE,
47                  OLEPropertyConstants.ACCOUNT_NUMBER,
48                  OLEPropertyConstants.SUB_ACCOUNT_NUMBER,
49                  OLEPropertyConstants.FINANCIAL_OBJECT_CODE,
50                  OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE,
51                  OLEPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE,
52                  OLEPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE,
53                  OLEPropertyConstants.COLLECTOR_DETAIL_SEQUENCE_NUMBER,
54                  OLEPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE,
55                  OLEPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE,
56                  OLEPropertyConstants.DOCUMENT_NUMBER,
57                  OLEPropertyConstants.COLLECTOR_DETAIL_AMOUNT,
58                  OLEPropertyConstants.COLLECTOR_DETAIL_GL_CREDIT_CODE,
59                  OLEPropertyConstants.COLLECTOR_DETAIL_NOTE_TEXT
60              };
61      }
62  
63      /**
64       *
65       */
66  
67      public int getDetailLineTotalLength() {
68          int totalLength = 0;
69          Map<String, Integer> lengthMap = getFieldLengthMap();
70          for (String property : getOrderedProperties()) {
71              totalLength += lengthMap.get(property).intValue();
72          }
73          return totalLength;
74      }
75  }