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.ArrayList;
21  import java.util.LinkedHashMap;
22  import java.util.List;
23  
24  import org.kuali.ole.fp.document.CashManagementDocument;
25  import org.kuali.ole.fp.document.CashReceiptDocument;
26  import org.kuali.ole.sys.OLEPropertyConstants;
27  import org.kuali.ole.sys.businessobject.Bank;
28  import org.kuali.rice.core.api.util.type.KualiDecimal;
29  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
30  
31  
32  /**
33   * This class represents a deposit used in the cash management document
34   */
35  public class Deposit extends PersistableBusinessObjectBase {
36      // primary key
37      private String documentNumber;
38      private Integer financialDocumentDepositLineNumber;
39      // attributes
40      private String depositTypeCode;
41      private Date depositDate;
42      private KualiDecimal depositAmount;
43      private String depositTicketNumber;
44      // related objects and foreign keys
45      private String depositBankCode;
46  
47      private CurrencyDetail depositedCurrency;
48      private CoinDetail depositedCoin;
49  
50      private Bank bank;
51      private CashManagementDocument cashManagementDocument;
52      private List depositCashReceiptControl;
53  
54  
55      /**
56       * Default constructor.
57       */
58      public Deposit() {
59          depositCashReceiptControl = new ArrayList();
60          bank = new Bank();
61      }
62  
63      /**
64       * Gets the bank attribute. 
65       * @return Returns the bank.
66       */
67      public Bank getBank() {
68          return bank;
69      }
70  
71      /**
72       * Sets the bank attribute value.
73       * @param bank The bank to set.
74       */
75      public void setBank(Bank bank) {
76          this.bank = bank;
77      }
78  
79      /**
80       * @return current value of cashManagementDocument.
81       */
82      public CashManagementDocument getCashManagementDocument() {
83          return cashManagementDocument;
84      }
85  
86      /**
87       * Sets the cashManagementDocument attribute value.
88       * 
89       * @param cashManagementDocument The cashManagementDocument to set.
90       */
91      public void setCashManagementDocument(CashManagementDocument cashManagementDocument) {
92          this.cashManagementDocument = cashManagementDocument;
93      }
94  
95  
96      /**
97       * @return current value of depositCashReceiptControl.
98       */
99      public List getDepositCashReceiptControl() {
100         return depositCashReceiptControl;
101     }
102 
103     /**
104      * Sets the depositCashReceiptControl attribute value.
105      * 
106      * @param depositCashReceiptControl The depositCashReceiptControl to set.
107      */
108     public void setDepositCashReceiptControl(List depositCashReceiptControl) {
109         this.depositCashReceiptControl = depositCashReceiptControl;
110     }
111 
112     /**
113      * @return current value of depositAmount.
114      */
115     public KualiDecimal getDepositAmount() {
116         return depositAmount;
117     }
118 
119     /**
120      * Sets the depositAmount attribute value.
121      * 
122      * @param depositAmount The depositAmount to set.
123      */
124     public void setDepositAmount(KualiDecimal depositAmount) {
125         this.depositAmount = depositAmount;
126     }
127 
128 
129     /**
130      * @return current value of depositBankCode.
131      */
132     public String getDepositBankCode() {
133         return depositBankCode;
134     }
135 
136     /**
137      * Sets the depositBankCode attribute value.
138      * 
139      * @param depositBankCode The depositBankCode to set.
140      */
141     public void setDepositBankCode(String depositBankCode) {
142         this.depositBankCode = depositBankCode;
143     }
144 
145 
146     /**
147      * @return current value of depositDate.
148      */
149     public Date getDepositDate() {
150         return depositDate;
151     }
152 
153     /**
154      * Sets the depositDate attribute value.
155      * 
156      * @param depositDate The depositDate to set.
157      */
158     public void setDepositDate(Date depositDate) {
159         this.depositDate = depositDate;
160     }
161 
162 
163     /**
164      * @return current value of depositTicketNumber.
165      */
166     public String getDepositTicketNumber() {
167         return depositTicketNumber;
168     }
169 
170     /**
171      * Sets the depositTicketNumber attribute value.
172      * 
173      * @param depositTicketNumber The depositTicketNumber to set.
174      */
175     public void setDepositTicketNumber(String depositTicketNumber) {
176         this.depositTicketNumber = depositTicketNumber;
177     }
178 
179     /**
180      * @return current value of depositTypeCode, under a different name, to prevent the POJO code from reformatting it
181      */
182     public String getRawDepositTypeCode() {
183         return depositTypeCode;
184     }
185 
186     /**
187      * @return current value of depositTypeCode.
188      */
189     public String getDepositTypeCode() {
190         return depositTypeCode;
191     }
192 
193     /**
194      * Sets the depositTypeCode attribute value.
195      * 
196      * @param depositTypeCode The depositTypeCode to set.
197      */
198     public void setDepositTypeCode(String depositTypeCode) {
199         this.depositTypeCode = depositTypeCode;
200     }
201 
202 
203     /**
204      * @return current value of financialDocumentDepositLineNumber.
205      */
206     public Integer getFinancialDocumentDepositLineNumber() {
207         return financialDocumentDepositLineNumber;
208     }
209 
210     /**
211      * Sets the financialDocumentDepositLineNumber attribute value.
212      * 
213      * @param financialDocumentDepositLineNumber The financialDocumentDepositLineNumber to set.
214      */
215     public void setFinancialDocumentDepositLineNumber(Integer financialDocumentDepositLineNumber) {
216         this.financialDocumentDepositLineNumber = financialDocumentDepositLineNumber;
217     }
218 
219 
220     /**
221      * @return current value of documentNumber.
222      */
223     public String getDocumentNumber() {
224         return documentNumber;
225     }
226 
227     /**
228      * Sets the documentNumber attribute value.
229      * 
230      * @param documentNumber The documentNumber to set.
231      */
232     public void setDocumentNumber(String documentNumber) {
233         this.documentNumber = documentNumber;
234     }
235 
236 
237     /**
238      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
239      */
240     
241     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
242         LinkedHashMap m = new LinkedHashMap();
243         m.put(OLEPropertyConstants.DOCUMENT_NUMBER, getDocumentNumber());
244         m.put("financialDocumentDepositLineNumber", getFinancialDocumentDepositLineNumber());
245         return m;
246     }
247 
248 
249     /**
250      * Returns true if this deposit has the same document deposit line number as the passed in Deposit
251      * 
252      * @param other
253      * @return true if the given Deposit has primary key values equal to this Deposit
254      */
255     public boolean keysEqual(Deposit other) {
256         boolean keysEqual = false;
257 
258         if (getDocumentNumber().equals(other.getDocumentNumber())) {
259             if (getFinancialDocumentDepositLineNumber().equals(other.getFinancialDocumentDepositLineNumber())) {
260                 keysEqual = true;
261             }
262         }
263 
264         return keysEqual;
265     }
266 
267     /**
268      * This method returns whether the given deposit contains the parameter cash receipt document
269      * 
270      * @param crDoc the cash receipt document to look for
271      * @return true if the cash receipt document is part of the deposit, false if otherwise
272      */
273     public boolean containsCashReceipt(CashReceiptDocument crDoc) {
274         boolean result = false;
275         for (int i = 0; i < this.getDepositCashReceiptControl().size() && !result; i++) {
276             DepositCashReceiptControl crCtrl = (DepositCashReceiptControl) getDepositCashReceiptControl().get(i);
277             result = crCtrl.getFinancialDocumentCashReceiptNumber().equals(crDoc.getDocumentNumber());
278         }
279         return result;
280     }
281 
282     /**
283      * Gets the depositedCoin attribute.
284      * 
285      * @return Returns the depositedCoin.
286      */
287     public CoinDetail getDepositedCoin() {
288         return depositedCoin;
289     }
290 
291 
292     /**
293      * Sets the depositedCoin attribute value.
294      * 
295      * @param depositedCoin The depositedCoin to set.
296      */
297     public void setDepositedCoin(CoinDetail depositedCoin) {
298         this.depositedCoin = depositedCoin;
299     }
300 
301 
302     /**
303      * Gets the depositedCurrency attribute.
304      * 
305      * @return Returns the depositedCurrency.
306      */
307     public CurrencyDetail getDepositedCurrency() {
308         return depositedCurrency;
309     }
310 
311 
312     /**
313      * Sets the depositedCurrency attribute value.
314      * 
315      * @param depositedCurrency The depositedCurrency to set.
316      */
317     public void setDepositedCurrency(CurrencyDetail depositedCurrency) {
318         this.depositedCurrency = depositedCurrency;
319     }
320 }