001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.kuali.module.financial.bo;
018:
019: import java.sql.Date;
020: import java.util.ArrayList;
021: import java.util.LinkedHashMap;
022: import java.util.List;
023:
024: import org.kuali.core.bo.PersistableBusinessObjectBase;
025: import org.kuali.core.util.KualiDecimal;
026: import org.kuali.kfs.KFSPropertyConstants;
027: import org.kuali.module.financial.document.CashManagementDocument;
028: import org.kuali.module.financial.document.CashReceiptDocument;
029:
030: /**
031: * This class represents a deposit used in the cash management document
032: */
033: public class Deposit extends PersistableBusinessObjectBase {
034: // primary key
035: private String documentNumber;
036: private Integer financialDocumentDepositLineNumber;
037: // attributes
038: private String depositTypeCode;
039: private Date depositDate;
040: private KualiDecimal depositAmount;
041: private String depositTicketNumber;
042: // related objects and foreign keys
043: private String depositBankCode;
044: private String depositBankAccountNumber;
045:
046: private CurrencyDetail depositedCurrency;
047: private CoinDetail depositedCoin;
048:
049: private BankAccount bankAccount;
050: private CashManagementDocument cashManagementDocument;
051: private List depositCashReceiptControl;
052:
053: /**
054: * Default constructor.
055: */
056: public Deposit() {
057: depositCashReceiptControl = new ArrayList();
058: }
059:
060: /**
061: * @return current value of bankAccount.
062: */
063: public BankAccount getBankAccount() {
064: return bankAccount;
065: }
066:
067: /**
068: * Sets the bankAccount attribute value.
069: *
070: * @param bankAccount The bankAccount to set.
071: */
072: public void setBankAccount(BankAccount bankAccount) {
073: this .bankAccount = bankAccount;
074: }
075:
076: /**
077: * @return current value of cashManagementDocument.
078: */
079: public CashManagementDocument getCashManagementDocument() {
080: return cashManagementDocument;
081: }
082:
083: /**
084: * Sets the cashManagementDocument attribute value.
085: *
086: * @param cashManagementDocument The cashManagementDocument to set.
087: */
088: public void setCashManagementDocument(
089: CashManagementDocument cashManagementDocument) {
090: this .cashManagementDocument = cashManagementDocument;
091: }
092:
093: /**
094: * @return current value of depositCashReceiptControl.
095: */
096: public List getDepositCashReceiptControl() {
097: return depositCashReceiptControl;
098: }
099:
100: /**
101: * Sets the depositCashReceiptControl attribute value.
102: *
103: * @param depositCashReceiptControl The depositCashReceiptControl to set.
104: */
105: public void setDepositCashReceiptControl(
106: List depositCashReceiptControl) {
107: this .depositCashReceiptControl = depositCashReceiptControl;
108: }
109:
110: /**
111: * @return current value of depositBankAccountNumber.
112: */
113: public String getDepositBankAccountNumber() {
114: return depositBankAccountNumber;
115: }
116:
117: /**
118: * Sets the depositBankAccountNumber attribute value.
119: *
120: * @param depositBankAccountNumber The depositBankAccountNumber to set.
121: */
122: public void setDepositBankAccountNumber(
123: String depositBankAccountNumber) {
124: this .depositBankAccountNumber = depositBankAccountNumber;
125: }
126:
127: /**
128: * @return current value of depositAmount.
129: */
130: public KualiDecimal getDepositAmount() {
131: return depositAmount;
132: }
133:
134: /**
135: * Sets the depositAmount attribute value.
136: *
137: * @param depositAmount The depositAmount to set.
138: */
139: public void setDepositAmount(KualiDecimal depositAmount) {
140: this .depositAmount = depositAmount;
141: }
142:
143: /**
144: * @return current value of depositBankCode.
145: */
146: public String getDepositBankCode() {
147: return depositBankCode;
148: }
149:
150: /**
151: * Sets the depositBankCode attribute value.
152: *
153: * @param depositBankCode The depositBankCode to set.
154: */
155: public void setDepositBankCode(String depositBankCode) {
156: this .depositBankCode = depositBankCode;
157: }
158:
159: /**
160: * @return current value of depositDate.
161: */
162: public Date getDepositDate() {
163: return depositDate;
164: }
165:
166: /**
167: * Sets the depositDate attribute value.
168: *
169: * @param depositDate The depositDate to set.
170: */
171: public void setDepositDate(Date depositDate) {
172: this .depositDate = depositDate;
173: }
174:
175: /**
176: * @return current value of depositTicketNumber.
177: */
178: public String getDepositTicketNumber() {
179: return depositTicketNumber;
180: }
181:
182: /**
183: * Sets the depositTicketNumber attribute value.
184: *
185: * @param depositTicketNumber The depositTicketNumber to set.
186: */
187: public void setDepositTicketNumber(String depositTicketNumber) {
188: this .depositTicketNumber = depositTicketNumber;
189: }
190:
191: /**
192: * @return current value of depositTypeCode, under a different name, to prevent the POJO code from reformatting it
193: */
194: public String getRawDepositTypeCode() {
195: return depositTypeCode;
196: }
197:
198: /**
199: * @return current value of depositTypeCode.
200: */
201: public String getDepositTypeCode() {
202: return depositTypeCode;
203: }
204:
205: /**
206: * Sets the depositTypeCode attribute value.
207: *
208: * @param depositTypeCode The depositTypeCode to set.
209: */
210: public void setDepositTypeCode(String depositTypeCode) {
211: this .depositTypeCode = depositTypeCode;
212: }
213:
214: /**
215: * @return current value of financialDocumentDepositLineNumber.
216: */
217: public Integer getFinancialDocumentDepositLineNumber() {
218: return financialDocumentDepositLineNumber;
219: }
220:
221: /**
222: * Sets the financialDocumentDepositLineNumber attribute value.
223: *
224: * @param financialDocumentDepositLineNumber The financialDocumentDepositLineNumber to set.
225: */
226: public void setFinancialDocumentDepositLineNumber(
227: Integer financialDocumentDepositLineNumber) {
228: this .financialDocumentDepositLineNumber = financialDocumentDepositLineNumber;
229: }
230:
231: /**
232: * @return current value of documentNumber.
233: */
234: public String getDocumentNumber() {
235: return documentNumber;
236: }
237:
238: /**
239: * Sets the documentNumber attribute value.
240: *
241: * @param documentNumber The documentNumber to set.
242: */
243: public void setDocumentNumber(String documentNumber) {
244: this .documentNumber = documentNumber;
245: }
246:
247: /**
248: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
249: */
250: @Override
251: protected LinkedHashMap toStringMapper() {
252: LinkedHashMap m = new LinkedHashMap();
253: m
254: .put(KFSPropertyConstants.DOCUMENT_NUMBER,
255: getDocumentNumber());
256: m.put("financialDocumentDepositLineNumber",
257: getFinancialDocumentDepositLineNumber());
258: return m;
259: }
260:
261: /**
262: * Returns true if this deposit has the same document deposit line number as the passed in Deposit
263: *
264: * @param other
265: * @return true if the given Deposit has primary key values equal to this Deposit
266: */
267: public boolean keysEqual(Deposit other) {
268: boolean keysEqual = false;
269:
270: if (getDocumentNumber().equals(other.getDocumentNumber())) {
271: if (getFinancialDocumentDepositLineNumber().equals(
272: other.getFinancialDocumentDepositLineNumber())) {
273: keysEqual = true;
274: }
275: }
276:
277: return keysEqual;
278: }
279:
280: /**
281: * This method returns whether the given deposit contains the parameter cash receipt document
282: *
283: * @param crDoc the cash receipt document to look for
284: * @return true if the cash receipt document is part of the deposit, false if otherwise
285: */
286: public boolean containsCashReceipt(CashReceiptDocument crDoc) {
287: boolean result = false;
288: for (int i = 0; i < this .getDepositCashReceiptControl().size()
289: && !result; i++) {
290: DepositCashReceiptControl crCtrl = (DepositCashReceiptControl) getDepositCashReceiptControl()
291: .get(i);
292: result = crCtrl.getFinancialDocumentCashReceiptNumber()
293: .equals(crDoc.getDocumentNumber());
294: }
295: return result;
296: }
297:
298: /**
299: * Gets the depositedCoin attribute.
300: *
301: * @return Returns the depositedCoin.
302: */
303: public CoinDetail getDepositedCoin() {
304: return depositedCoin;
305: }
306:
307: /**
308: * Sets the depositedCoin attribute value.
309: *
310: * @param depositedCoin The depositedCoin to set.
311: */
312: public void setDepositedCoin(CoinDetail depositedCoin) {
313: this .depositedCoin = depositedCoin;
314: }
315:
316: /**
317: * Gets the depositedCurrency attribute.
318: *
319: * @return Returns the depositedCurrency.
320: */
321: public CurrencyDetail getDepositedCurrency() {
322: return depositedCurrency;
323: }
324:
325: /**
326: * Sets the depositedCurrency attribute value.
327: *
328: * @param depositedCurrency The depositedCurrency to set.
329: */
330: public void setDepositedCurrency(CurrencyDetail depositedCurrency) {
331: this.depositedCurrency = depositedCurrency;
332: }
333: }
|