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.chart.bo;
018:
019: import java.sql.Date;
020: import java.util.LinkedHashMap;
021:
022: import org.kuali.core.bo.DocumentType;
023: import org.kuali.core.bo.Inactivateable;
024: import org.kuali.core.bo.PersistableBusinessObjectBase;
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.context.SpringContext;
029:
030: /**
031: *
032: */
033: public class OrganizationRoutingModel extends
034: PersistableBusinessObjectBase implements Inactivateable {
035:
036: private String chartOfAccountsCode;
037: private String organizationCode;
038: private String organizationRoutingModelName;
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: private boolean active;
046:
047: private Chart chartOfAccounts;
048: private DocumentType documentType;
049: private UniversalUser accountDelegate;
050:
051: /**
052: * Default constructor.
053: */
054: public OrganizationRoutingModel() {
055: }
056:
057: public OrganizationRoutingModel(
058: DelegateGlobalDetail delegateGlobalDetail) {
059: accountDelegateUniversalId = delegateGlobalDetail
060: .getAccountDelegateUniversalId();
061: accountDelegatePrimaryRoutingIndicator = delegateGlobalDetail
062: .getAccountDelegatePrimaryRoutingIndicator();
063: approvalFromThisAmount = delegateGlobalDetail
064: .getApprovalFromThisAmount();
065: approvalToThisAmount = delegateGlobalDetail
066: .getApprovalToThisAmount();
067: accountDelegateStartDate = delegateGlobalDetail
068: .getAccountDelegateStartDate();
069: financialDocumentTypeCode = delegateGlobalDetail
070: .getFinancialDocumentTypeCode();
071: }
072:
073: /**
074: * Gets the chartOfAccountsCode attribute.
075: *
076: * @return Returns the chartOfAccountsCode
077: */
078: public String getChartOfAccountsCode() {
079: return chartOfAccountsCode;
080: }
081:
082: /**
083: * Sets the chartOfAccountsCode attribute.
084: *
085: * @param chartOfAccountsCode The chartOfAccountsCode to set.
086: */
087: public void setChartOfAccountsCode(String chartOfAccountsCode) {
088: this .chartOfAccountsCode = chartOfAccountsCode;
089: }
090:
091: /**
092: * Gets the organizationCode attribute.
093: *
094: * @return Returns the organizationCode
095: */
096: public String getOrganizationCode() {
097: return organizationCode;
098: }
099:
100: /**
101: * Sets the organizationCode attribute.
102: *
103: * @param organizationCode The organizationCode to set.
104: */
105: public void setOrganizationCode(String organizationCode) {
106: this .organizationCode = organizationCode;
107: }
108:
109: /**
110: * Gets the organizationRoutingModelName attribute.
111: *
112: * @return Returns the organizationRoutingModelName
113: */
114: public String getOrganizationRoutingModelName() {
115: return organizationRoutingModelName;
116: }
117:
118: /**
119: * Sets the organizationRoutingModelName attribute.
120: *
121: * @param organizationRoutingModelName The organizationRoutingModelName to set.
122: */
123: public void setOrganizationRoutingModelName(
124: String organizationRoutingModelName) {
125: this .organizationRoutingModelName = organizationRoutingModelName;
126: }
127:
128: /**
129: * Gets the accountDelegateUniversalId attribute.
130: *
131: * @return Returns the accountDelegateUniversalId
132: */
133: public String getAccountDelegateUniversalId() {
134: return accountDelegateUniversalId;
135: }
136:
137: /**
138: * Sets the accountDelegateUniversalId attribute.
139: *
140: * @param accountDelegateUniversalId The accountDelegateUniversalId to set.
141: */
142: public void setAccountDelegateUniversalId(
143: String accountDelegateUniversalId) {
144: this .accountDelegateUniversalId = accountDelegateUniversalId;
145: }
146:
147: /**
148: * Gets the accountDelegate attribute.
149: *
150: * @return Returns the accountDelegate.
151: */
152: public UniversalUser getAccountDelegate() {
153: accountDelegate = SpringContext.getBean(
154: UniversalUserService.class)
155: .updateUniversalUserIfNecessary(
156: accountDelegateUniversalId, accountDelegate);
157: return accountDelegate;
158: }
159:
160: /**
161: * Sets the accountDelegate attribute value.
162: *
163: * @param accountDelegate The accountDelegate to set.
164: */
165: public void setAccountDelegate(UniversalUser accountDelegate) {
166: this .accountDelegate = accountDelegate;
167: }
168:
169: /**
170: * Gets the financialDocumentTypeCode attribute.
171: *
172: * @return Returns the financialDocumentTypeCode
173: */
174: public String getFinancialDocumentTypeCode() {
175: return financialDocumentTypeCode;
176: }
177:
178: /**
179: * Sets the financialDocumentTypeCode attribute.
180: *
181: * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
182: */
183: public void setFinancialDocumentTypeCode(
184: String financialDocumentTypeCode) {
185: this .financialDocumentTypeCode = financialDocumentTypeCode;
186: }
187:
188: /**
189: * Gets the documentType attribute.
190: *
191: * @return Returns the documentType.
192: */
193: public DocumentType getDocumentType() {
194: return documentType;
195: }
196:
197: /**
198: * Sets the documentType attribute value.
199: *
200: * @param documentType The documentType to set.
201: */
202: public void setDocumentType(DocumentType documentType) {
203: this .documentType = documentType;
204: }
205:
206: /**
207: * Gets the approvalFromThisAmount attribute.
208: *
209: * @return Returns the approvalFromThisAmount
210: */
211: public KualiDecimal getApprovalFromThisAmount() {
212: return approvalFromThisAmount;
213: }
214:
215: /**
216: * Sets the approvalFromThisAmount attribute.
217: *
218: * @param approvalFromThisAmount The approvalFromThisAmount to set.
219: */
220: public void setApprovalFromThisAmount(
221: KualiDecimal approvalFromThisAmount) {
222: this .approvalFromThisAmount = approvalFromThisAmount;
223: }
224:
225: /**
226: * Gets the approvalToThisAmount attribute.
227: *
228: * @return Returns the approvalToThisAmount
229: */
230: public KualiDecimal getApprovalToThisAmount() {
231: return approvalToThisAmount;
232: }
233:
234: /**
235: * Sets the approvalToThisAmount attribute.
236: *
237: * @param approvalToThisAmount The approvalToThisAmount to set.
238: */
239: public void setApprovalToThisAmount(
240: KualiDecimal approvalToThisAmount) {
241: this .approvalToThisAmount = approvalToThisAmount;
242: }
243:
244: /**
245: * Gets the accountDelegatePrimaryRoutingIndicator attribute.
246: *
247: * @return Returns the accountDelegatePrimaryRoutingIndicator
248: */
249: public boolean getAccountDelegatePrimaryRoutingIndicator() {
250: return accountDelegatePrimaryRoutingIndicator;
251: }
252:
253: /**
254: * Sets the accountDelegatePrimaryRoutingIndicator attribute.
255: *
256: * @param accountDelegatePrimaryRoutingCode The accountDelegatePrimaryRoutingIndicator to set.
257: */
258: public void setAccountDelegatePrimaryRoutingIndicator(
259: boolean accountDelegatePrimaryRoutingCode) {
260: this .accountDelegatePrimaryRoutingIndicator = accountDelegatePrimaryRoutingCode;
261: }
262:
263: /**
264: * Gets the accountDelegateStartDate attribute.
265: *
266: * @return Returns the accountDelegateStartDate
267: */
268: public Date getAccountDelegateStartDate() {
269: return accountDelegateStartDate;
270: }
271:
272: /**
273: * Sets the accountDelegateStartDate attribute.
274: *
275: * @param accountDelegateStartDate The accountDelegateStartDate to set.
276: */
277: public void setAccountDelegateStartDate(
278: Date accountDelegateStartDate) {
279: this .accountDelegateStartDate = accountDelegateStartDate;
280: }
281:
282: /**
283: * Gets the active attribute.
284: *
285: * @return Returns the active.
286: */
287: public boolean isActive() {
288: return active;
289: }
290:
291: /**
292: * Sets the active attribute value.
293: *
294: * @param active The active to set.
295: */
296: public void setActive(boolean active) {
297: this .active = active;
298: }
299:
300: /**
301: * Gets the chartOfAccounts attribute.
302: *
303: * @return Returns the chartOfAccounts
304: */
305: public Chart getChartOfAccounts() {
306: return chartOfAccounts;
307: }
308:
309: /**
310: * Sets the chartOfAccounts attribute.
311: *
312: * @param chartOfAccounts The chartOfAccounts to set.
313: * @deprecated
314: */
315: public void setChartOfAccounts(Chart chartOfAccounts) {
316: this .chartOfAccounts = chartOfAccounts;
317: }
318:
319: /**
320: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
321: */
322: protected LinkedHashMap toStringMapper() {
323: LinkedHashMap m = new LinkedHashMap();
324: m.put("chartOfAccountsCode", this .chartOfAccountsCode);
325: m.put("organizationCode", this .organizationCode);
326: m.put("organizationRoutingModelName",
327: this .organizationRoutingModelName);
328: m.put("accountDelegateUniversalId",
329: this .accountDelegateUniversalId);
330: m.put("financialDocumentTypeCode",
331: this .financialDocumentTypeCode);
332: return m;
333: }
334:
335: public boolean equals(Object o) {
336: if (o instanceof OrganizationRoutingModel) {
337: OrganizationRoutingModel orgRouteModel = (OrganizationRoutingModel) o;
338: return (((this .getChartOfAccountsCode() == null && orgRouteModel
339: .getChartOfAccountsCode() == null) || this
340: .getChartOfAccountsCode().equals(
341: orgRouteModel.getChartOfAccountsCode()))
342: && ((this .getOrganizationCode() == null && orgRouteModel
343: .getOrganizationCode() == null) || this
344: .getOrganizationCode()
345: .equals(orgRouteModel.getOrganizationCode()))
346: && ((this .getOrganizationRoutingModelName() == null && orgRouteModel
347: .getOrganizationRoutingModelName() == null) || this
348: .getOrganizationRoutingModelName()
349: .equals(
350: orgRouteModel
351: .getOrganizationRoutingModelName()))
352: && ((this .getAccountDelegateUniversalId() == null && orgRouteModel
353: .getAccountDelegateUniversalId() == null) || this
354: .getAccountDelegateUniversalId()
355: .equals(
356: orgRouteModel
357: .getAccountDelegateUniversalId())) && ((this
358: .getFinancialDocumentTypeCode() == null && orgRouteModel
359: .getFinancialDocumentTypeCode() == null) || this
360: .getFinancialDocumentTypeCode().equals(
361: orgRouteModel
362: .getFinancialDocumentTypeCode())));
363: } else {
364: return false;
365: }
366: }
367:
368: public int hashCode() {
369: return ((((this .getChartOfAccountsCode().hashCode() * 29 + this
370: .getOrganizationCode().hashCode()) * 29 + this
371: .getOrganizationRoutingModelName().hashCode()) * 29 + this
372: .getAccountDelegateUniversalId().hashCode()) * 29 + this
373: .getFinancialDocumentTypeCode().hashCode()) * 29;
374: }
375:
376: }
|