001/*
002 * Copyright 2007-2009 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.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/ecl2.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 */
016package org.kuali.ole.gl.businessobject;
017
018import java.util.Map;
019
020import org.kuali.ole.sys.OLEPropertyConstants;
021import org.kuali.ole.sys.businessobject.BusinessObjectStringParserFieldUtils;
022import org.kuali.rice.krad.bo.BusinessObject;
023
024/**
025 * This class has utility methods for parsing OriginEntries from Strings
026 */
027public class CollectorDetailFieldUtil extends BusinessObjectStringParserFieldUtils {
028
029    /**
030     * Returns the class to parse into - OriginEntryFull
031     * @see org.kuali.ole.sys.businessobject.BusinessObjectStringParserFieldUtils#getBusinessObjectClass()
032     */
033    @Override
034    public Class<? extends BusinessObject> getBusinessObjectClass() {
035        return CollectorDetail.class;
036    }
037
038    /**
039     * Returns the fields to be parsed from a String, in order, to form an OriginEntryFull
040     * @see org.kuali.ole.sys.businessobject.BusinessObjectStringParserFieldUtils#getOrderedProperties()
041     */
042    @Override
043    public String[] getOrderedProperties() {
044        return new String[] {
045                OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR,
046                OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE,
047                OLEPropertyConstants.ACCOUNT_NUMBER,
048                OLEPropertyConstants.SUB_ACCOUNT_NUMBER,
049                OLEPropertyConstants.FINANCIAL_OBJECT_CODE,
050                OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE,
051                OLEPropertyConstants.FINANCIAL_BALANCE_TYPE_CODE,
052                OLEPropertyConstants.FINANCIAL_OBJECT_TYPE_CODE,
053                OLEPropertyConstants.COLLECTOR_DETAIL_SEQUENCE_NUMBER,
054                OLEPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE,
055                OLEPropertyConstants.FINANCIAL_SYSTEM_ORIGINATION_CODE,
056                OLEPropertyConstants.DOCUMENT_NUMBER,
057                OLEPropertyConstants.COLLECTOR_DETAIL_AMOUNT,
058                OLEPropertyConstants.COLLECTOR_DETAIL_GL_CREDIT_CODE,
059                OLEPropertyConstants.COLLECTOR_DETAIL_NOTE_TEXT
060            };
061    }
062
063    /**
064     *
065     */
066
067    public int getDetailLineTotalLength() {
068        int totalLength = 0;
069        Map<String, Integer> lengthMap = getFieldLengthMap();
070        for (String property : getOrderedProperties()) {
071            totalLength += lengthMap.get(property).intValue();
072        }
073        return totalLength;
074    }
075}