View Javadoc
1   /*
2    * Copyright 2006 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  
17  package org.kuali.ole.fp.businessobject;
18  
19  import java.sql.Date;
20  import java.util.LinkedHashMap;
21  
22  import org.kuali.ole.fp.document.AdvanceDepositDocument;
23  import org.kuali.ole.sys.OLEPropertyConstants;
24  import org.kuali.ole.sys.businessobject.Bank;
25  import org.kuali.ole.sys.context.SpringContext;
26  import org.kuali.ole.sys.service.BankService;
27  import org.kuali.rice.core.api.util.type.KualiDecimal;
28  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
29  
30  /**
31   * This business object represents the advance deposit detail business object that is used by the Advance Deposit Document.
32   */
33  public class AdvanceDepositDetail extends PersistableBusinessObjectBase {
34      private String documentNumber;
35      private String financialDocumentTypeCode;
36      private Integer financialDocumentLineNumber;
37      private Date financialDocumentAdvanceDepositDate;
38      private String financialDocumentAdvanceDepositReferenceNumber;
39      private String financialDocumentAdvanceDepositDescription;
40      private KualiDecimal financialDocumentAdvanceDepositAmount;
41      private String financialDocumentBankCode;
42  
43      /* NOTE
44       * The following reference to AdvanceDepositDocument is removed, as it won't get properly populated when the document is loaded from DB,
45       * and that causes NPE when copying the document, as well as in any other circumstance when the reference is used.
46       * Research has been done to confirm that this reference is not currently used anywhere in KFS; and if any institution intends to use it
47       * somehow, they can put it back, and meanwhile, uncomment the overriden method AdvanceDepositAction.copy, which populates the referenced
48       * document properly (or even better, move the logic into AdvanceDepositAction.execute).
49       */
50      //private AdvanceDepositDocument advanceDepositDocument;
51      
52      private Bank bank;
53  
54      /**
55       * Default constructor.
56       */
57      public AdvanceDepositDetail() {
58          bank = new Bank();
59      }
60      
61      /**
62       * Sets the bank code for a new AdvanceDepositDetail to the setup default for the Advance Deposit document.
63       */
64      public void setDefaultBankCode() {
65          Bank defaultBank = SpringContext.getBean(BankService.class).getDefaultBankByDocType(AdvanceDepositDocument.ADVANCE_DEPOSIT_DOCUMENT_TYPE_CODE);
66          if (defaultBank != null) {
67              this.financialDocumentBankCode = defaultBank.getBankCode();
68              this.bank = defaultBank;
69          }
70      }
71  
72      /**
73       * Gets the documentNumber attribute.
74       * 
75       * @return Returns the documentNumber
76       */
77      public String getDocumentNumber() {
78          return documentNumber;
79      }
80  
81      /**
82       * Sets the documentNumber attribute.
83       * 
84       * @param documentNumber The documentNumber to set.
85       */
86      public void setDocumentNumber(String documentNumber) {
87          this.documentNumber = documentNumber;
88      }
89  
90      /**
91       * Gets the financialDocumentTypeCode attribute.
92       * 
93       * @return Returns the financialDocumentTypeCode
94       */
95      public String getFinancialDocumentTypeCode() {
96          return financialDocumentTypeCode;
97      }
98  
99      /**
100      * Sets the financialDocumentTypeCode attribute.
101      * 
102      * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
103      */
104     public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
105         this.financialDocumentTypeCode = financialDocumentTypeCode;
106     }
107 
108     /**
109      * Gets the financialDocumentLineNumber attribute.
110      * 
111      * @return Returns the financialDocumentLineNumber
112      */
113     public Integer getFinancialDocumentLineNumber() {
114         return financialDocumentLineNumber;
115     }
116 
117     /**
118      * Sets the financialDocumentLineNumber attribute.
119      * 
120      * @param financialDocumentLineNumber The financialDocumentLineNumber to set.
121      */
122     public void setFinancialDocumentLineNumber(Integer financialDocumentLineNumber) {
123         this.financialDocumentLineNumber = financialDocumentLineNumber;
124     }
125 
126 
127     /**
128      * Gets the financialDocumentAdvanceDepositDate attribute.
129      * 
130      * @return Returns the financialDocumentAdvanceDepositDate
131      */
132     public Date getFinancialDocumentAdvanceDepositDate() {
133         return financialDocumentAdvanceDepositDate;
134     }
135 
136     /**
137      * Sets the financialDocumentAdvanceDepositDate attribute.
138      * 
139      * @param financialDocumentAdvanceDepositDate The financialDocumentAdvanceDepositDate to set.
140      */
141     public void setFinancialDocumentAdvanceDepositDate(Date financialDocumentAdvanceDepositDate) {
142         this.financialDocumentAdvanceDepositDate = financialDocumentAdvanceDepositDate;
143     }
144 
145     /**
146      * Gets the financialDocumentAdvanceDepositReferenceNumber attribute.
147      * 
148      * @return Returns the financialDocumentAdvanceDepositReferenceNumber
149      */
150     public String getFinancialDocumentAdvanceDepositReferenceNumber() {
151         return financialDocumentAdvanceDepositReferenceNumber;
152     }
153 
154     /**
155      * Sets the financialDocumentAdvanceDepositReferenceNumber attribute.
156      * 
157      * @param financialDocumentAdvanceDepositReferenceNumber The financialDocumentAdvanceDepositReferenceNumber to set.
158      */
159     public void setFinancialDocumentAdvanceDepositReferenceNumber(String financialDocumentAdvanceDepositReferenceNumber) {
160         this.financialDocumentAdvanceDepositReferenceNumber = financialDocumentAdvanceDepositReferenceNumber;
161     }
162 
163 
164     /**
165      * Gets the financialDocumentAdvanceDepositDescription attribute.
166      * 
167      * @return Returns the financialDocumentAdvanceDepositDescription
168      */
169     public String getFinancialDocumentAdvanceDepositDescription() {
170         return financialDocumentAdvanceDepositDescription;
171     }
172 
173     /**
174      * Sets the financialDocumentAdvanceDepositDescription attribute.
175      * 
176      * @param financialDocumentAdvanceDepositDescription The financialDocumentAdvanceDepositDescription to set.
177      */
178     public void setFinancialDocumentAdvanceDepositDescription(String financialDocumentAdvanceDepositDescription) {
179         this.financialDocumentAdvanceDepositDescription = financialDocumentAdvanceDepositDescription;
180     }
181 
182 
183     /**
184      * Gets the financialDocumentAdvanceDepositAmount attribute.
185      * 
186      * @return Returns the financialDocumentAdvanceDepositAmount
187      */
188     public KualiDecimal getFinancialDocumentAdvanceDepositAmount() {
189         return financialDocumentAdvanceDepositAmount;
190     }
191 
192     /**
193      * Sets the financialDocumentAdvanceDepositAmount attribute.
194      * 
195      * @param financialDocumentAdvanceDepositAmount The financialDocumentAdvanceDepositAmount to set.
196      */
197     public void setFinancialDocumentAdvanceDepositAmount(KualiDecimal financialDocumentAdvanceDepositAmount) {
198         this.financialDocumentAdvanceDepositAmount = financialDocumentAdvanceDepositAmount;
199     }
200 
201 
202     /**
203      * Gets the financialDocumentBankCode attribute.
204      * 
205      * @return Returns the financialDocumentBankCode
206      */
207     public String getFinancialDocumentBankCode() {
208         return financialDocumentBankCode;
209     }
210 
211     /**
212      * Sets the financialDocumentBankCode attribute.
213      * 
214      * @param financialDocumentBankCode The financialDocumentBankCode to set.
215      */
216     public void setFinancialDocumentBankCode(String financialDocumentBankCode) {
217         this.financialDocumentBankCode = financialDocumentBankCode;
218     }
219 
220     /* NOTE
221      * The following reference to AdvanceDepositDocument is removed, as it won't get properly populated when the document is loaded from DB,
222      * and that causes NPE when copying the document, as well as in any other circumstance when the reference is used.
223      * Research has been done to confirm that this reference is not currently used anywhere in KFS; and if any institution intends to use it
224      * somehow, they can put it back, and meanwhile, uncomment the overriden method AdvanceDepositAction.copy, which populates the referenced
225      * document properly (or even better, move the logic into AdvanceDepositAction.execute).
226      */
227     /**
228      * @return AdvanceDepositDocument
229      *
230     public AdvanceDepositDocument getAdvanceDepositDocument() {
231         return advanceDepositDocument;
232     }
233     /**
234      * @param advanceDepositDocument
235      *
236     public void setAdvanceDepositDocument(AdvanceDepositDocument advanceDepositDocument) {
237         this.advanceDepositDocument = advanceDepositDocument;
238     }
239     */
240     
241     /**
242      * @return Bank
243      */
244     public Bank getBank() {
245         return bank;
246     }
247 
248     /**
249      * @param bank
250      */
251     public void setBank(Bank bank) {
252         this.bank = bank;
253     }
254 
255     /**
256      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
257      */
258     
259     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
260         LinkedHashMap m = new LinkedHashMap();
261         m.put(OLEPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
262         m.put("financialDocumentTypeCode", this.financialDocumentTypeCode);
263         if (this.financialDocumentLineNumber != null) {
264             m.put("financialDocumentLineNumber", this.financialDocumentLineNumber.toString());
265         }
266         return m;
267     }
268 }