01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.labor.bo;
17:
18: import java.text.NumberFormat;
19: import java.util.Arrays;
20: import java.util.Collection;
21:
22: import org.apache.commons.lang.StringUtils;
23: import org.kuali.core.util.KualiDecimal;
24: import org.kuali.module.labor.LaborConstants;
25: import org.kuali.module.labor.LaborPropertyConstants.AccountingPeriodProperties;
26:
27: /**
28: * Labor business object for LedgerBalanceForBenefitExpenseTransfer
29: */
30: public class LedgerBalanceForBenefitExpenseTransfer extends
31: LedgerBalance implements SegmentedBusinessObject {
32:
33: /**
34: * Constructs a LedgerBalanceForBenefitExpenseTransfer.java.
35: */
36: public LedgerBalanceForBenefitExpenseTransfer() {
37: super ();
38: }
39:
40: /**
41: * @see org.kuali.module.labor.bo.SegmentedBusinessObject#isLookupResultsSegmented()
42: */
43: public boolean isLookupResultsSegmented() {
44: return true;
45: }
46:
47: /**
48: * @see org.kuali.module.labor.bo.SegmentedBusinessObject#getSegmentedPropertyNames()
49: * @return a collection
50: */
51: public Collection<String> getSegmentedPropertyNames() {
52: return (Collection<String>) Arrays
53: .asList(AccountingPeriodProperties.namesToArray());
54: }
55:
56: /**
57: * Adds the period amount to the return string. Since the return string cannot have string, multiplies the amount by 100 so the
58: * decimal places are not lost.
59: *
60: * @see org.kuali.module.labor.bo.SegmentedBusinessObject#getAdditionalReturnData(java.lang.String)
61: */
62: public String getAdditionalReturnData(String segmentedPropertyName) {
63: String periodCode = LaborConstants.periodCodeMapping
64: .get(segmentedPropertyName);
65: KualiDecimal periodAmount = getAmount(periodCode);
66: periodAmount = periodAmount.multiply(new KualiDecimal(100));
67: NumberFormat formatter = NumberFormat.getIntegerInstance();
68: String formattedAmount = formatter.format(periodAmount);
69:
70: return StringUtils.replace(formattedAmount, ",", "");
71: }
72: }
|