001    /*
002     * Copyright 2011 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     */
016    package org.kuali.kfs.module.ld.businessobject;
017    
018    import java.util.Arrays;
019    import java.util.Collection;
020    
021    import org.kuali.kfs.integration.ld.SegmentedBusinessObject;
022    import org.kuali.kfs.module.ld.LaborConstants;
023    import org.kuali.kfs.module.ld.LaborPropertyConstants.AccountingPeriodProperties;
024    import org.kuali.rice.kns.util.KNSUtils;
025    import org.kuali.rice.kns.util.KualiDecimal;
026    
027    /**
028     * Labor business object specifically for SalaryExpenseTransferDocument ledger balance import functionality.
029     */
030    public class LedgerBalanceForSalaryExpenseTransfer extends LedgerBalance implements SegmentedBusinessObject {
031    
032        /**
033         * Constructs a LedgerBalanceForSalaryExpenseTransfer
034         */
035        public LedgerBalanceForSalaryExpenseTransfer() {
036            super();
037        }
038    
039        /**
040         * @see org.kuali.module.labor.bo.SegmentedBusinessObject#isLookupResultsSegmented()
041         */
042        public boolean isLookupResultsSegmented() {
043            return true;
044        }
045    
046        /**
047         * @see org.kuali.module.labor.bo.SegmentedBusinessObject#getSegmentedPropertyNames()
048         */
049        public Collection<String> getSegmentedPropertyNames() {
050            return (Collection<String>) Arrays.asList(AccountingPeriodProperties.namesToArray());
051        }
052    
053        /**
054         * Adds the period amount to the return string. Since the return string cannot have string, multiplies the amount by 100 so the
055         * decimal places are not lost.
056         * 
057         * @see org.kuali.module.labor.bo.SegmentedBusinessObject#getAdditionalReturnData(java.lang.String)
058         */
059        public String getAdditionalReturnData(String segmentedPropertyName) {
060            String periodCode = LaborConstants.periodCodeMapping.get(segmentedPropertyName);
061            KualiDecimal periodAmount = getAmount(periodCode);
062            
063            return KNSUtils.convertDecimalIntoInteger(periodAmount);
064        }
065    }