001: /*
002: * Copyright 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.chart.bo;
018:
019: import java.sql.Date;
020: import java.util.LinkedHashMap;
021:
022: import org.apache.commons.lang.StringUtils;
023: import org.kuali.core.bo.DocumentType;
024: import org.kuali.core.bo.GlobalBusinessObjectDetailBase;
025: import org.kuali.core.bo.user.UniversalUser;
026: import org.kuali.core.service.UniversalUserService;
027: import org.kuali.core.util.KualiDecimal;
028: import org.kuali.kfs.KFSPropertyConstants;
029: import org.kuali.kfs.context.SpringContext;
030:
031: /**
032: *
033: */
034: public class DelegateGlobalDetail extends
035: GlobalBusinessObjectDetailBase {
036:
037: private static final long serialVersionUID = -8089154029664644867L;
038:
039: private String accountDelegateUniversalId;
040: private String financialDocumentTypeCode;
041: private KualiDecimal approvalFromThisAmount;
042: private KualiDecimal approvalToThisAmount;
043: private boolean accountDelegatePrimaryRoutingIndicator;
044: private Date accountDelegateStartDate;
045:
046: private UniversalUser accountDelegate;
047: private DocumentType documentType;
048:
049: /**
050: * Default constructor.
051: */
052: public DelegateGlobalDetail() {
053: super ();
054: }
055:
056: public DelegateGlobalDetail(OrganizationRoutingModel model) {
057: accountDelegatePrimaryRoutingIndicator = model
058: .getAccountDelegatePrimaryRoutingIndicator();
059: accountDelegateStartDate = model.getAccountDelegateStartDate();
060: accountDelegateUniversalId = model
061: .getAccountDelegateUniversalId();
062: approvalFromThisAmount = model.getApprovalFromThisAmount();
063: approvalToThisAmount = model.getApprovalToThisAmount();
064: financialDocumentTypeCode = model
065: .getFinancialDocumentTypeCode();
066: }
067:
068: /**
069: * Gets the documentType attribute.
070: *
071: * @return Returns the documentType.
072: */
073: public DocumentType getDocumentType() {
074: return documentType;
075: }
076:
077: /**
078: * Sets the documentType attribute value.
079: *
080: * @param documentType The documentType to set.
081: * @deprecated
082: */
083: public void setDocumentType(DocumentType documentType) {
084: this .documentType = documentType;
085: }
086:
087: /**
088: * Gets the accountDelegateUniversalId attribute.
089: *
090: * @return Returns the accountDelegateUniversalId
091: */
092: public String getAccountDelegateUniversalId() {
093: return accountDelegateUniversalId;
094: }
095:
096: /**
097: * Sets the accountDelegateUniversalId attribute.
098: *
099: * @param accountDelegateUniversalId The accountDelegateUniversalId to set.
100: */
101: public void setAccountDelegateUniversalId(
102: String accountDelegateUniversalId) {
103: this .accountDelegateUniversalId = accountDelegateUniversalId;
104: }
105:
106: /**
107: * Gets the financialDocumentTypeCode attribute.
108: *
109: * @return Returns the financialDocumentTypeCode
110: */
111: public String getFinancialDocumentTypeCode() {
112: return financialDocumentTypeCode;
113: }
114:
115: /**
116: * Sets the financialDocumentTypeCode attribute.
117: *
118: * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
119: */
120: public void setFinancialDocumentTypeCode(
121: String financialDocumentTypeCode) {
122: this .financialDocumentTypeCode = financialDocumentTypeCode;
123: }
124:
125: /**
126: * Gets the approvalFromThisAmount attribute.
127: *
128: * @return Returns the approvalFromThisAmount
129: */
130: public KualiDecimal getApprovalFromThisAmount() {
131: return approvalFromThisAmount;
132: }
133:
134: /**
135: * Sets the approvalFromThisAmount attribute.
136: *
137: * @param approvalFromThisAmount The approvalFromThisAmount to set.
138: */
139: public void setApprovalFromThisAmount(
140: KualiDecimal approvalFromThisAmount) {
141: this .approvalFromThisAmount = approvalFromThisAmount;
142: }
143:
144: /**
145: * Gets the approvalToThisAmount attribute.
146: *
147: * @return Returns the approvalToThisAmount
148: */
149: public KualiDecimal getApprovalToThisAmount() {
150: return approvalToThisAmount;
151: }
152:
153: /**
154: * Sets the approvalToThisAmount attribute.
155: *
156: * @param approvalToThisAmount The approvalToThisAmount to set.
157: */
158: public void setApprovalToThisAmount(
159: KualiDecimal approvalToThisAmount) {
160: this .approvalToThisAmount = approvalToThisAmount;
161: }
162:
163: /**
164: * Gets the accountDelegatePrimaryRoutingIndicator attribute.
165: *
166: * @return Returns the accountDelegatePrimaryRoutingIndicator
167: */
168: public boolean getAccountDelegatePrimaryRoutingIndicator() {
169: return accountDelegatePrimaryRoutingIndicator;
170: }
171:
172: /**
173: * Sets the accountDelegatePrimaryRoutingIndicator attribute.
174: *
175: * @param accountDelegatePrimaryRoutingIndicator The accountDelegatePrimaryRoutingIndicator to set.
176: * @deprecated
177: */
178: public void setAccountDelegatePrimaryRoutingIndicator(
179: boolean accountDelegatePrimaryRoutingIndicator) {
180: this .accountDelegatePrimaryRoutingIndicator = accountDelegatePrimaryRoutingIndicator;
181: }
182:
183: /**
184: * Gets the accountDelegateStartDate attribute.
185: *
186: * @return Returns the accountDelegateStartDate
187: */
188: public Date getAccountDelegateStartDate() {
189: return accountDelegateStartDate;
190: }
191:
192: /**
193: * Sets the accountDelegateStartDate attribute.
194: *
195: * @param accountDelegateStartDate The accountDelegateStartDate to set.
196: */
197: public void setAccountDelegateStartDate(
198: Date accountDelegateStartDate) {
199: this .accountDelegateStartDate = accountDelegateStartDate;
200: }
201:
202: public UniversalUser getAccountDelegate() {
203: accountDelegate = SpringContext.getBean(
204: UniversalUserService.class)
205: .updateUniversalUserIfNecessary(
206: accountDelegateUniversalId, accountDelegate);
207: return accountDelegate;
208: }
209:
210: /**
211: * @param accountDelegate The accountDelegate to set.
212: * @deprecated
213: */
214: public void setAccountDelegate(UniversalUser accountDelegate) {
215: this .accountDelegate = accountDelegate;
216: }
217:
218: /**
219: * @see java.lang.Object#equals(java.lang.Object)
220: */
221: public boolean equals(Object obj) {
222: if (obj != null) {
223: if (this .getClass().equals(obj.getClass())) {
224: DelegateGlobalDetail other = (DelegateGlobalDetail) obj;
225: if (StringUtils.equalsIgnoreCase(getDocumentNumber(),
226: other.getDocumentNumber())) {
227: if (StringUtils.equalsIgnoreCase(
228: this .financialDocumentTypeCode,
229: other.financialDocumentTypeCode)) {
230: if (this .accountDelegatePrimaryRoutingIndicator == other.accountDelegatePrimaryRoutingIndicator) {
231: if (StringUtils.equalsIgnoreCase(
232: this .accountDelegateUniversalId,
233: other.accountDelegateUniversalId)) {
234: return true;
235: }
236: }
237: }
238: }
239: }
240: }
241: return false;
242: }
243:
244: /**
245: * @see java.lang.Object#hashCode()
246: */
247: public int hashCode() {
248: return toStringBuilder(toStringMapper()).hashCode();
249: }
250:
251: /**
252: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
253: */
254: protected LinkedHashMap toStringMapper() {
255: LinkedHashMap m = new LinkedHashMap();
256: m
257: .put(KFSPropertyConstants.DOCUMENT_NUMBER,
258: getDocumentNumber());
259: m.put("accountDelegateUniversalId",
260: this .accountDelegateUniversalId);
261: m.put("financialDocumentTypeCode",
262: this.financialDocumentTypeCode);
263: return m;
264: }
265: }
|