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 for LedgerBalanceForBenefitExpenseTransfer 029 */ 030 public class LedgerBalanceForBenefitExpenseTransfer extends LedgerBalance implements SegmentedBusinessObject { 031 032 /** 033 * Constructs a LedgerBalanceForBenefitExpenseTransfer.java. 034 */ 035 public LedgerBalanceForBenefitExpenseTransfer() { 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 * @return a collection 049 */ 050 public Collection<String> getSegmentedPropertyNames() { 051 return (Collection<String>) Arrays.asList(AccountingPeriodProperties.namesToArray()); 052 } 053 054 /** 055 * Adds the period amount to the return string. Since the return string cannot have string, multiplies the amount by 100 so the 056 * decimal places are not lost. 057 * 058 * @see org.kuali.module.labor.bo.SegmentedBusinessObject#getAdditionalReturnData(java.lang.String) 059 */ 060 public String getAdditionalReturnData(String segmentedPropertyName) { 061 String periodCode = LaborConstants.periodCodeMapping.get(segmentedPropertyName); 062 KualiDecimal periodAmount = getAmount(periodCode); 063 064 return KNSUtils.convertDecimalIntoInteger(periodAmount); 065 } 066 }