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 specifically for SalaryExpenseTransferDocument ledger balance import functionality.
29: */
30: public class LedgerBalanceForSalaryExpenseTransfer extends
31: LedgerBalance implements SegmentedBusinessObject {
32:
33: /**
34: * Constructs a LedgerBalanceForSalaryExpenseTransfer
35: */
36: public LedgerBalanceForSalaryExpenseTransfer() {
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: */
50: public Collection<String> getSegmentedPropertyNames() {
51: return (Collection<String>) Arrays
52: .asList(AccountingPeriodProperties.namesToArray());
53: }
54:
55: /**
56: * Adds the period amount to the return string. Since the return string cannot have string, multiplies the amount by 100 so the
57: * decimal places are not lost.
58: *
59: * @see org.kuali.module.labor.bo.SegmentedBusinessObject#getAdditionalReturnData(java.lang.String)
60: */
61: public String getAdditionalReturnData(String segmentedPropertyName) {
62: String periodCode = LaborConstants.periodCodeMapping
63: .get(segmentedPropertyName);
64: KualiDecimal periodAmount = getAmount(periodCode);
65: periodAmount = periodAmount.multiply(new KualiDecimal(100));
66: NumberFormat formatter = NumberFormat.getIntegerInstance();
67: String formattedAmount = formatter.format(periodAmount);
68: return StringUtils.replace(formattedAmount, ",", "");
69: }
70: }
|