1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.ole.gl.businessobject;
17  
18  import java.util.LinkedHashMap;
19  
20  import org.apache.commons.lang.StringUtils;
21  import org.kuali.ole.sys.OLEConstants;
22  import org.kuali.rice.core.api.util.type.KualiDecimal;
23  import org.kuali.rice.krad.bo.TransientBusinessObjectBase;
24  
25  
26  
27  
28  public class PendingEntrySummary extends TransientBusinessObjectBase {
29      private OriginEntryInformation originEntry;
30      private boolean suppress;
31      
32      
33  
34  
35      public String getDocumentNumber() {
36          return (!suppress) ? getConstantDocumentNumber() : "";
37      }
38      
39      
40  
41  
42      public String getConstantDocumentNumber() {
43          return StringUtils.join(new String[] { originEntry.getFinancialSystemOriginationCode(),originEntry.getDocumentNumber()}, '-');
44      }
45      
46      
47  
48  
49      public String getDocumentTypeCode() {
50          return (!suppress) ? getConstantDocumentTypeCode() : "";
51      }
52      
53      
54  
55  
56      public String getConstantDocumentTypeCode() {
57          return originEntry.getFinancialDocumentTypeCode();
58      }
59      
60      
61  
62  
63      public String getBalanceTypeCode() {
64          return (!suppress) ? getConstantBalanceTypeCode() : "";
65      }
66      
67      
68  
69  
70      public String getConstantBalanceTypeCode() {
71          return originEntry.getFinancialBalanceTypeCode();
72      }
73      
74      
75  
76  
77      public String getChartOfAccountsCode() {
78          return originEntry.getChartOfAccountsCode();
79      }
80      
81      
82  
83  
84      public String getAccountNumber() {
85          return originEntry.getAccountNumber();
86      }
87      
88      
89  
90  
91      public String getFinancialObjectCode() {
92          return originEntry.getFinancialObjectCode();
93      }
94      
95      
96  
97  
98      public KualiDecimal getCreditAmount() {
99          if (!StringUtils.isBlank(originEntry.getTransactionDebitCreditCode())) {
100             if (originEntry.getTransactionDebitCreditCode().equals(OLEConstants.GL_CREDIT_CODE)) {
101                 return originEntry.getTransactionLedgerEntryAmount(); 
102             }
103         }
104         return null;
105     }
106 
107     
108 
109 
110     public KualiDecimal getDebitAmount() {
111         if (!StringUtils.isBlank(originEntry.getTransactionDebitCreditCode())) { 
112             if (originEntry.getTransactionDebitCreditCode().equals(OLEConstants.GL_DEBIT_CODE)) {
113                 return originEntry.getTransactionLedgerEntryAmount();
114             }
115         }
116         return null;
117     }
118 
119     
120 
121 
122     public KualiDecimal getBudgetAmount() {
123         return (originEntry.getTransactionDebitCreditCode() == null || originEntry.getTransactionDebitCreditCode().equals(OLEConstants.GL_BUDGET_CODE) || originEntry.getTransactionDebitCreditCode().equals(OLEConstants.EMPTY_STRING)) ? originEntry.getTransactionLedgerEntryAmount() : null;
124     }
125 
126     
127 
128 
129     
130     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
131         LinkedHashMap<String, String> pkHashMap = new LinkedHashMap<String, String>();
132         pkHashMap.put("documentTypeCode", this.getDocumentTypeCode());
133         pkHashMap.put("documentNumber", this.getDocumentNumber());
134         pkHashMap.put("chartOfAccountsCode", this.getChartOfAccountsCode());
135         pkHashMap.put("accountNumber", this.getAccountNumber());
136         pkHashMap.put("balanceTypeCode", this.getBalanceTypeCode());
137         pkHashMap.put("financialObjectCode", this.getFinancialObjectCode());
138         return pkHashMap;
139     }
140     
141     
142 
143 
144     public void setOriginEntry(OriginEntryInformation originEntry) {
145         this.originEntry = originEntry;
146         this.suppress = false;
147     }
148 
149     
150 
151 
152 
153     public void suppressCommonFields(boolean suppress) {
154         this.suppress = suppress;
155     }
156 
157     
158 
159 
160     public String getSuppressableFieldsAsKey() {
161         return StringUtils.join(new String[] {originEntry.getFinancialDocumentTypeCode(),originEntry.getFinancialSystemOriginationCode(),originEntry.getDocumentNumber(),originEntry.getFinancialBalanceTypeCode()}, ':');
162     }
163 }