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.chart.bo;
017:
018: import java.sql.Timestamp;
019: import java.util.LinkedHashMap;
020:
021: import org.apache.commons.lang.StringUtils;
022: import org.kuali.core.bo.DocumentType;
023: import org.kuali.core.bo.PersistableBusinessObjectBase;
024: import org.kuali.core.bo.user.UniversalUser;
025: import org.kuali.core.service.UniversalUserService;
026: import org.kuali.core.util.KualiDecimal;
027: import org.kuali.kfs.context.SpringContext;
028:
029: /**
030: *
031: */
032: public class Delegate extends PersistableBusinessObjectBase {
033:
034: private static final long serialVersionUID = 6883162275377881235L;
035:
036: /**
037: * Default no-arg constructor.
038: */
039: public Delegate() {
040: this .finDocApprovalFromThisAmt = new KualiDecimal(0);
041: this .finDocApprovalToThisAmount = new KualiDecimal(0);
042: }
043:
044: private String chartOfAccountsCode;
045: private String accountNumber;
046: private String financialDocumentTypeCode;
047: private String accountDelegateSystemId;
048: private KualiDecimal finDocApprovalFromThisAmt;
049: private boolean accountsDelegatePrmrtIndicator;
050: private boolean accountDelegateActiveIndicator;
051: private Timestamp accountDelegateStartDate;
052: private KualiDecimal finDocApprovalToThisAmount;
053:
054: private Chart chart;
055: private Account account;
056: private DocumentType documentType;
057: private UniversalUser accountDelegate;
058:
059: /**
060: * Gets the accountNumber attribute.
061: *
062: * @return Returns the accountNumber.
063: */
064: public String getAccountNumber() {
065: return accountNumber;
066: }
067:
068: /**
069: * Sets the accountNumber attribute value.
070: *
071: * @param accountNumber The accountNumber to set.
072: */
073: public void setAccountNumber(String accountNumber) {
074: this .accountNumber = accountNumber;
075: }
076:
077: /**
078: * Gets the chartOfAccountsCode attribute.
079: *
080: * @return Returns the chartOfAccountsCode.
081: */
082: public String getChartOfAccountsCode() {
083: return chartOfAccountsCode;
084: }
085:
086: /**
087: * Sets the chartOfAccountsCode attribute value.
088: *
089: * @param chartOfAccountsCode The chartOfAccountsCode to set.
090: */
091: public void setChartOfAccountsCode(String chartOfAccountsCode) {
092: this .chartOfAccountsCode = chartOfAccountsCode;
093: }
094:
095: /**
096: * Gets the financialDocumentTypeCode attribute.
097: *
098: * @return Returns the financialDocumentTypeCode
099: */
100: public String getFinancialDocumentTypeCode() {
101: return financialDocumentTypeCode;
102: }
103:
104: /**
105: * Sets the financialDocumentTypeCode attribute.
106: *
107: * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
108: */
109: public void setFinancialDocumentTypeCode(
110: String financialDocumentTypeCode) {
111: this .financialDocumentTypeCode = financialDocumentTypeCode;
112: }
113:
114: /**
115: * Gets the accountDelegateSystemId attribute.
116: *
117: * @return Returns the accountDelegateSystemId.
118: */
119: public String getAccountDelegateSystemId() {
120: return accountDelegateSystemId;
121: }
122:
123: /**
124: * Sets the accountDelegateSystemId attribute value.
125: *
126: * @param accountDelegateSystemId The accountDelegateSystemId to set.
127: */
128: public void setAccountDelegateSystemId(
129: String accountDelegateSystemId) {
130: this .accountDelegateSystemId = accountDelegateSystemId;
131: }
132:
133: /**
134: * Gets the finDocApprovalFromThisAmt attribute.
135: *
136: * @return Returns the finDocApprovalFromThisAmt
137: */
138: public KualiDecimal getFinDocApprovalFromThisAmt() {
139: return finDocApprovalFromThisAmt;
140: }
141:
142: /**
143: * Sets the finDocApprovalFromThisAmt attribute.
144: *
145: * @param finDocApprovalFromThisAmt The finDocApprovalFromThisAmt to set.
146: */
147: public void setFinDocApprovalFromThisAmt(
148: KualiDecimal finDocApprovalFromThisAmt) {
149: this .finDocApprovalFromThisAmt = finDocApprovalFromThisAmt;
150: }
151:
152: /**
153: * Gets the accountsDelegatePrmrtIndicator attribute.
154: *
155: * @return Returns the accountsDelegatePrmrtIndicator
156: */
157: public boolean isAccountsDelegatePrmrtIndicator() {
158: return accountsDelegatePrmrtIndicator;
159: }
160:
161: /**
162: * Sets the accountsDelegatePrmrtIndicator attribute.
163: *
164: * @param accountsDelegatePrmrtIndicator The accountsDelegatePrmrtIndicator to set.
165: * @deprecated
166: */
167: public void setAccountsDelegatePrmrtIndicator(
168: boolean accountsDelegatePrmrtIndicator) {
169: this .accountsDelegatePrmrtIndicator = accountsDelegatePrmrtIndicator;
170: }
171:
172: /**
173: * Gets the accountDelegateActiveIndicator attribute.
174: *
175: * @return Returns the accountDelegateActiveIndicator
176: */
177: public boolean isAccountDelegateActiveIndicator() {
178: return accountDelegateActiveIndicator;
179: }
180:
181: /**
182: * Sets the accountDelegateActiveIndicator attribute.
183: *
184: * @param accountDelegateActiveIndicator The accountDelegateActiveIndicator to set.
185: * @deprecated
186: */
187: public void setAccountDelegateActiveIndicator(
188: boolean accountDelegateActiveIndicator) {
189: this .accountDelegateActiveIndicator = accountDelegateActiveIndicator;
190: }
191:
192: /**
193: * Gets the accountDelegateStartDate attribute.
194: *
195: * @return Returns the accountDelegateStartDate
196: */
197: public Timestamp getAccountDelegateStartDate() {
198: return accountDelegateStartDate;
199: }
200:
201: /**
202: * Sets the accountDelegateStartDate attribute.
203: *
204: * @param accountDelegateStartDate The accountDelegateStartDate to set.
205: */
206: public void setAccountDelegateStartDate(
207: Timestamp accountDelegateStartDate) {
208: this .accountDelegateStartDate = accountDelegateStartDate;
209: }
210:
211: /**
212: * Gets the finDocApprovalToThisAmount attribute.
213: *
214: * @return Returns the finDocApprovalToThisAmount
215: */
216: public KualiDecimal getFinDocApprovalToThisAmount() {
217: return finDocApprovalToThisAmount;
218: }
219:
220: /**
221: * Sets the finDocApprovalToThisAmount attribute.
222: *
223: * @param finDocApprovalToThisAmount The finDocApprovalToThisAmount to set.
224: */
225: public void setFinDocApprovalToThisAmount(
226: KualiDecimal finDocApprovalToThisAmount) {
227: this .finDocApprovalToThisAmount = finDocApprovalToThisAmount;
228: }
229:
230: /**
231: * Gets the account attribute.
232: *
233: * @return Returns the account
234: */
235: public Account getAccount() {
236: return account;
237: }
238:
239: /**
240: * Sets the account attribute.
241: *
242: * @param account The account to set.
243: * @deprecated
244: */
245: public void setAccount(Account account) {
246: this .account = account;
247: }
248:
249: /**
250: * Gets the documentType attribute.
251: *
252: * @return Returns the documentType.
253: */
254: public DocumentType getDocumentType() {
255: return documentType;
256: }
257:
258: /**
259: * Sets the documentType attribute value.
260: *
261: * @param documentType The documentType to set.
262: */
263: public void setDocumentType(DocumentType documentType) {
264: this .documentType = documentType;
265: }
266:
267: public UniversalUser getAccountDelegate() {
268: accountDelegate = SpringContext.getBean(
269: UniversalUserService.class)
270: .updateUniversalUserIfNecessary(
271: accountDelegateSystemId, accountDelegate);
272: return accountDelegate;
273: }
274:
275: /**
276: * Sets the accountDelegate attribute value.
277: *
278: * @param accountDelegate The accountDelegate to set.
279: */
280: public void setAccountDelegate(UniversalUser accountDelegate) {
281: this .accountDelegate = accountDelegate;
282: }
283:
284: /**
285: * Gets the chart attribute.
286: *
287: * @return Returns the chart.
288: */
289: public Chart getChart() {
290: return chart;
291: }
292:
293: /**
294: * Sets the chart attribute value.
295: *
296: * @param chart The chart to set.
297: */
298: public void setChart(Chart chart) {
299: this .chart = chart;
300: }
301:
302: /**
303: * @see java.lang.Object#equals(java.lang.Object)
304: */
305: public boolean equals(Object obj) {
306: if (obj != null) {
307: if (this .getClass().equals(obj.getClass())) {
308: Delegate other = (Delegate) obj;
309: if (StringUtils.equalsIgnoreCase(
310: this .chartOfAccountsCode,
311: other.chartOfAccountsCode)) {
312: if (StringUtils.equalsIgnoreCase(
313: this .accountNumber, other.accountNumber)) {
314: if (StringUtils.equalsIgnoreCase(
315: this .financialDocumentTypeCode,
316: other.financialDocumentTypeCode)) {
317: if (StringUtils.equalsIgnoreCase(
318: this .accountDelegateSystemId,
319: other.accountDelegateSystemId)) {
320: return true;
321: }
322: }
323: }
324: }
325: }
326: }
327: return false;
328: }
329:
330: /**
331: * @see java.lang.Object#hashCode()
332: */
333: public int hashCode() {
334: return toStringBuilder(toStringMapper()).hashCode();
335: }
336:
337: /**
338: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
339: */
340: protected LinkedHashMap toStringMapper() {
341: LinkedHashMap m = new LinkedHashMap();
342:
343: m.put("chartCode", this .chartOfAccountsCode);
344: m.put("accountNumber", this .accountNumber);
345: m.put("documentTypeCode", this .financialDocumentTypeCode);
346: m.put("accountDelegateSystemId", this.accountDelegateSystemId);
347:
348: return m;
349: }
350: }
|