View Javadoc
1   /*
2    * Copyright 2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
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.ole.gl.businessobject;
17  
18  import java.util.LinkedHashMap;
19  
20  import org.kuali.ole.sys.OLEKeyConstants;
21  import org.kuali.ole.sys.context.SpringContext;
22  import org.kuali.rice.core.api.config.property.ConfigurationService;
23  import org.kuali.rice.core.api.util.type.KualiDecimal;
24  import org.kuali.rice.krad.bo.TransientBusinessObjectBase;
25  
26  /**
27   * Summarizes Pending Entry data for the GLPE pending entry report.
28   */
29  public class LedgerSummaryTotalLine extends TransientBusinessObjectBase {
30      private KualiDecimal debitAmount = KualiDecimal.ZERO;
31      private int debitCount = 0;
32      private KualiDecimal creditAmount = KualiDecimal.ZERO;
33      private int creditCount = 0;
34      private KualiDecimal budgetAmount = KualiDecimal.ZERO;
35      private int budgetCount = 0;
36      /**
37       * Gets the recordCount attribute. 
38       * @return Returns the recordCount.
39       */
40      public int getRecordCount() {
41          return debitCount + creditCount + budgetCount;
42      }
43      /**
44       * Gets the debitAmount attribute. 
45       * @return Returns the debitAmount.
46       */
47      public KualiDecimal getDebitAmount() {
48          return debitAmount;
49      }
50      /**
51       * Gets the debitCount attribute. 
52       * @return Returns the debitCount.
53       */
54      public int getDebitCount() {
55          return debitCount;
56      }
57      /**
58       * Gets the creditAmount attribute. 
59       * @return Returns the creditAmount.
60       */
61      public KualiDecimal getCreditAmount() {
62          return creditAmount;
63      }
64      /**
65       * Gets the creditCount attribute. 
66       * @return Returns the creditCount.
67       */
68      public int getCreditCount() {
69          return creditCount;
70      }
71      /**
72       * Gets the budgetAmount attribute. 
73       * @return Returns the budgetAmount.
74       */
75      public KualiDecimal getBudgetAmount() {
76          return budgetAmount;
77      }
78      /**
79       * Gets the budgetCount attribute. 
80       * @return Returns the budgetCount.
81       */
82      public int getBudgetCount() {
83          return budgetCount;
84      }
85      
86      /**
87       * Adds a debit amount to the current debit total
88       * @param debitAmount the debit amount to add to the debit total
89       */
90      public void addDebitAmount(KualiDecimal debitAmount) {
91          this.debitAmount = this.debitAmount.add(debitAmount);
92          this.debitCount += 1;
93      }
94      
95      /**
96       * Adds a credit amount to current credit total  
97       * @param creditAmount the amount to add to the credit total
98       */
99      public void addCreditAmount(KualiDecimal creditAmount) {
100         this.creditAmount = this.creditAmount.add(creditAmount);
101         this.creditCount += 1;
102     }
103     
104     /**
105      * Adds a budget amount to current budget total  
106      * @param budgetAmount the amount to add to the budget total
107      */
108     public void addBudgetAmount(KualiDecimal budgetAmount) {
109         this.budgetAmount = this.budgetAmount.add(budgetAmount);
110         this.budgetCount += 1;
111     }
112     
113     /**
114      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
115      */
116     
117     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
118         return new LinkedHashMap();
119     }
120     
121     /**
122      * @return the summary for this summary total line
123      */
124     public String getSummary() {
125         return SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEKeyConstants.MESSAGE_REPORT_NIGHTLY_OUT_LEDGER_TOTAL);
126     }
127 }