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.kra.budget.bo;
018:
019: import java.util.LinkedHashMap;
020:
021: import org.apache.commons.lang.StringUtils;
022: import org.kuali.core.bo.PersistableBusinessObjectBase;
023: import org.kuali.kfs.KFSPropertyConstants;
024: import org.kuali.module.chart.bo.Chart;
025:
026: /**
027: *
028: */
029: public class InstitutionCostSharePersonnel extends
030: PersistableBusinessObjectBase {
031:
032: private String documentNumber;
033: private String chartOfAccountsCode;
034: private String organizationCode;
035: private String budgetInstitutionCostSharePersonnelDescription;
036: private Chart chartOfAccounts;
037:
038: /**
039: * Default no-arg constructor.
040: */
041: public InstitutionCostSharePersonnel() {
042:
043: }
044:
045: /**
046: * Gets the documentNumber attribute.
047: *
048: * @return Returns the documentNumber
049: */
050: public String getDocumentNumber() {
051: return documentNumber;
052: }
053:
054: /**
055: * Sets the documentNumber attribute.
056: *
057: * @param documentNumber The documentNumber to set.
058: */
059: public void setDocumentNumber(String documentNumber) {
060: this .documentNumber = documentNumber;
061: }
062:
063: /**
064: * Gets the chartOfAccountsCode attribute.
065: *
066: * @return Returns the chartOfAccountsCode
067: */
068: public String getChartOfAccountsCode() {
069: return chartOfAccountsCode;
070: }
071:
072: /**
073: * Sets the chartOfAccountsCode attribute.
074: *
075: * @param chartOfAccountsCode The chartOfAccountsCode to set.
076: */
077: public void setChartOfAccountsCode(String chartOfAccountsCode) {
078: this .chartOfAccountsCode = chartOfAccountsCode;
079: }
080:
081: /**
082: * Gets the organizationCode attribute.
083: *
084: * @return Returns the organizationCode
085: */
086: public String getOrganizationCode() {
087: return organizationCode;
088: }
089:
090: /**
091: * Sets the organizationCode attribute.
092: *
093: * @param organizationCode The organizationCode to set.
094: */
095: public void setOrganizationCode(String organizationCode) {
096: this .organizationCode = organizationCode;
097: }
098:
099: /**
100: * Gets the budgetInstitutionCostSharePersonnelDescription attribute.
101: *
102: * @return Returns the budgetInstitutionCostSharePersonnelDescription
103: */
104: public String getBudgetInstitutionCostSharePersonnelDescription() {
105: return budgetInstitutionCostSharePersonnelDescription;
106: }
107:
108: /**
109: * Sets the budgetInstitutionCostSharePersonnelDescription attribute.
110: *
111: * @param budgetInstitutionCostSharePersonnelDescription The budgetInstitutionCostSharePersonnelDescription to set.
112: */
113: public void setBudgetInstitutionCostSharePersonnelDescription(
114: String budgetInstitutionCostSharePersonnelDescription) {
115: this .budgetInstitutionCostSharePersonnelDescription = budgetInstitutionCostSharePersonnelDescription;
116: }
117:
118: /**
119: * Gets the chartOfAccounts attribute.
120: *
121: * @return Returns the chartOfAccounts
122: */
123: public Chart getChartOfAccounts() {
124: return chartOfAccounts;
125: }
126:
127: /**
128: * Sets the chartOfAccounts attribute.
129: *
130: * @param chartOfAccounts The chartOfAccounts to set.
131: */
132: public void setChartOfAccounts(Chart chartOfAccounts) {
133: this .chartOfAccounts = chartOfAccounts;
134: }
135:
136: /**
137: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
138: */
139: protected LinkedHashMap toStringMapper() {
140: LinkedHashMap m = new LinkedHashMap();
141:
142: m
143: .put(KFSPropertyConstants.DOCUMENT_NUMBER,
144: this .documentNumber);
145: m.put("chartOfAccountsCode", this .chartOfAccountsCode);
146: m.put("organizationCode", this .organizationCode);
147:
148: return m;
149: }
150:
151: /**
152: * Implementing equals so that contains behaves reasonable.
153: *
154: * @see java.lang.Object#equals(java.lang.Object)
155: */
156: public boolean equals(Object obj) {
157: boolean equal = false;
158:
159: if (obj != null) {
160: if (this .getClass().equals(obj.getClass())) {
161: InstitutionCostSharePersonnel other = (InstitutionCostSharePersonnel) obj;
162:
163: if (this .getDocumentNumber().equals(
164: other.getDocumentNumber())
165: && this .getChartOfAccountsCode().equals(
166: other.getChartOfAccountsCode())
167: && this .getOrganizationCode().equals(
168: other.getOrganizationCode())
169: && StringUtils
170: .equals(
171: this
172: .getBudgetInstitutionCostSharePersonnelDescription(),
173: other
174: .getBudgetInstitutionCostSharePersonnelDescription())) {
175: equal = true;
176: }
177: }
178: }
179:
180: return equal;
181: }
182:
183: /**
184: * Calculates hashCode based on current values of documentNumber, chartOfAccountsCode and organizationCode fields. This is based
185: * on Account.hashCode().
186: *
187: * @see java.lang.Object#hashCode()
188: */
189: public int hashCode() {
190: String hashString = getDocumentNumber() + "|"
191: + getChartOfAccountsCode() + "|"
192: + getOrganizationCode();
193:
194: return hashString.hashCode();
195: }
196: }
|