001: /*
002: * Copyright 2005-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: package org.kuali.module.financial.bo;
017:
018: import java.sql.Date;
019: import java.util.LinkedHashMap;
020:
021: import org.apache.commons.lang.StringUtils;
022: import org.apache.commons.lang.time.DateUtils;
023: import org.kuali.core.bo.PersistableBusinessObjectBase;
024: import org.kuali.core.util.KualiDecimal;
025: import org.kuali.core.util.NumberUtils;
026:
027: /**
028: * This class represents a check in the system. It is a generalized check business object that will be used by the Cash Receipts
029: * document, the Cashier document, etc.
030: */
031:
032: public class CheckBase extends PersistableBusinessObjectBase implements
033: Check {
034: private String checkNumber;
035: private Date checkDate;
036: private String description;
037: private Integer sequenceId;
038: private KualiDecimal amount;
039: private String documentNumber;
040: private String financialDocumentTypeCode;
041: private String cashieringRecordSource;
042: private Integer financialDocumentDepositLineNumber;
043:
044: /**
045: * Constructs a CheckBase business object.
046: */
047: public CheckBase() {
048: super ();
049: this .sequenceId = new Integer(1);
050: this .amount = new KualiDecimal(0);
051: }
052:
053: /**
054: * Gets the checkDate attribute.
055: *
056: * @return Returns the checkDate.
057: */
058: public Date getCheckDate() {
059: return checkDate;
060: }
061:
062: /**
063: * Sets the checkDate attribute value.
064: *
065: * @param checkDate The checkDate to set.
066: */
067: public void setCheckDate(Date checkDate) {
068: this .checkDate = checkDate;
069: }
070:
071: /**
072: * Gets the checkNumber attribute.
073: *
074: * @return Returns the checkNumber.
075: */
076: public String getCheckNumber() {
077: return checkNumber;
078: }
079:
080: /**
081: * Sets the checkNumber attribute value.
082: *
083: * @param checkNumber The checkNumber to set.
084: */
085: public void setCheckNumber(String checkNumber) {
086: this .checkNumber = checkNumber;
087: }
088:
089: /**
090: * Gets the description attribute.
091: *
092: * @return Returns the description.
093: */
094: public String getDescription() {
095: return description;
096: }
097:
098: /**
099: * Sets the description attribute value.
100: *
101: * @param description The description to set.
102: */
103: public void setDescription(String description) {
104: this .description = description;
105: }
106:
107: /**
108: * Gets the sequenceId attribute.
109: *
110: * @return Returns the sequenceId.
111: */
112: public Integer getSequenceId() {
113: return sequenceId;
114: }
115:
116: /**
117: * Sets the sequenceId attribute value.
118: *
119: * @param sequenceId The sequenceId to set.
120: */
121: public void setSequenceId(Integer sequenceId) {
122: this .sequenceId = sequenceId;
123: }
124:
125: /**
126: * Gets the amount attribute.
127: *
128: * @return Returns the amount.
129: */
130: public KualiDecimal getAmount() {
131: return amount;
132: }
133:
134: /**
135: * Sets the amount attribute value.
136: *
137: * @param amount The amount to set.
138: */
139: public void setAmount(KualiDecimal amount) {
140: this .amount = amount;
141: }
142:
143: /**
144: * Gets the documentNumber attribute.
145: *
146: * @return Returns the documentNumber.
147: */
148: public String getDocumentNumber() {
149: return documentNumber;
150: }
151:
152: /**
153: * Sets the documentNumber attribute value.
154: *
155: * @param documentNumber The documentNumber to set.
156: */
157: public void setDocumentNumber(String documentNumber) {
158: this .documentNumber = documentNumber;
159: }
160:
161: /**
162: * Gets the cashieringRecordSource attribute.
163: *
164: * @return Returns the cashieringRecordSource.
165: */
166: public String getCashieringRecordSource() {
167: return cashieringRecordSource;
168: }
169:
170: /**
171: * Sets the cashieringRecordSource attribute value.
172: *
173: * @param cashieringRecordSource The cashieringRecordSource to set.
174: */
175: public void setCashieringRecordSource(
176: String financialDocumentColumnTypeCode) {
177: this .cashieringRecordSource = financialDocumentColumnTypeCode;
178: }
179:
180: /**
181: * Gets the financialDocumentTypeCode attribute.
182: *
183: * @return Returns the financialDocumentTypeCode.
184: */
185: public String getFinancialDocumentTypeCode() {
186: return financialDocumentTypeCode;
187: }
188:
189: /**
190: * Sets the financialDocumentTypeCode attribute value.
191: *
192: * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
193: */
194: public void setFinancialDocumentTypeCode(
195: String financialDocumentTypeCode) {
196: this .financialDocumentTypeCode = financialDocumentTypeCode;
197: }
198:
199: /**
200: * Gets the financialDocumentDepositLineNumber attribute.
201: *
202: * @return Returns the financialDocumentDepositLineNumber.
203: */
204: public Integer getFinancialDocumentDepositLineNumber() {
205: return financialDocumentDepositLineNumber;
206: }
207:
208: /**
209: * Sets the financialDocumentDepositLineNumber attribute value.
210: *
211: * @param financialDocumentDepositLineNumber The financialDocumentDepositLineNumber to set.
212: */
213: public void setFinancialDocumentDepositLineNumber(
214: Integer financialDocumentDepositLineNumber) {
215: this .financialDocumentDepositLineNumber = financialDocumentDepositLineNumber;
216: }
217:
218: /**
219: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
220: */
221: protected LinkedHashMap toStringMapper() {
222: LinkedHashMap m = new LinkedHashMap();
223:
224: m.put("sequenceId", this .sequenceId);
225: m.put("checkNumber", this .checkNumber);
226: m.put("amount", this .amount);
227: m.put("checkDate", this .checkDate);
228: m.put("financialDocumentDepositLineNumber",
229: this .financialDocumentDepositLineNumber);
230: m.put("description", this .description);
231: m.put("documentHeaderId", this .documentNumber);
232: m.put("financialDocumentTypeCode",
233: this .financialDocumentTypeCode);
234: m.put("cashieringRecordSource", this .cashieringRecordSource);
235:
236: return m;
237: }
238:
239: /**
240: * @see org.kuali.module.financial.bo.Check#isLike(org.kuali.module.financial.bo.Check)
241: */
242: public boolean isLike(Check other) {
243: boolean like = false;
244:
245: if (StringUtils.equals(checkNumber, other.getCheckNumber())) {
246: if (StringUtils.equals(description, other.getDescription())) {
247: if (StringUtils.equals(financialDocumentTypeCode, other
248: .getFinancialDocumentTypeCode())
249: && StringUtils.equals(cashieringRecordSource,
250: other.getCashieringRecordSource())) {
251: if (StringUtils.equals(documentNumber, other
252: .getDocumentNumber())) {
253: if (NumberUtils.equals(sequenceId, other
254: .getSequenceId())) {
255: if (NumberUtils
256: .equals(
257: financialDocumentDepositLineNumber,
258: other
259: .getFinancialDocumentDepositLineNumber())) {
260:
261: if (DateUtils.isSameDay(checkDate,
262: other.getCheckDate())) {
263: if ((amount != null)
264: && amount.equals(other
265: .getAmount())) {
266: like = true;
267: }
268: }
269: }
270: }
271: }
272: }
273: }
274: }
275:
276: return like;
277: }
278: }
|