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: package org.kuali.module.kra.budget.bo;
017:
018: import java.sql.Timestamp;
019: import java.util.LinkedHashMap;
020:
021: import org.kuali.core.bo.PersistableBusinessObjectBase;
022: import org.kuali.core.util.KualiDecimal;
023: import org.kuali.core.util.ObjectUtils;
024: import org.kuali.kfs.KFSPropertyConstants;
025:
026: /**
027: *
028: */
029:
030: public class BudgetGraduateAssistantRate extends
031: PersistableBusinessObjectBase implements Comparable {
032: private static final long serialVersionUID = -5360306689257897228L;
033:
034: private String documentNumber;
035: private String campusCode;
036: private KualiDecimal campusMaximumPeriod1Rate;
037: private KualiDecimal campusMaximumPeriod2Rate;
038: private KualiDecimal campusMaximumPeriod3Rate;
039: private KualiDecimal campusMaximumPeriod4Rate;
040: private KualiDecimal campusMaximumPeriod5Rate;
041: private KualiDecimal campusMaximumPeriod6Rate;
042: private Timestamp lastUpdateTimestamp;
043:
044: private GraduateAssistantRate graduateAssistantRate;
045:
046: /**
047: * Default no-arg constructor.
048: */
049: public BudgetGraduateAssistantRate() {
050: super ();
051: graduateAssistantRate = new GraduateAssistantRate();
052: }
053:
054: public BudgetGraduateAssistantRate(String documentNumber,
055: String campusCode) {
056: this ();
057: this .documentNumber = documentNumber;
058: this .campusCode = campusCode;
059: }
060:
061: public BudgetGraduateAssistantRate(String documentNumber,
062: String campusCode, KualiDecimal campusMaximumPeriod1Rate,
063: KualiDecimal campusMaximumPeriod2Rate,
064: KualiDecimal campusMaximumPeriod3Rate,
065: KualiDecimal campusMaximumPeriod4Rate,
066: KualiDecimal campusMaximumPeriod5Rate,
067: KualiDecimal campusMaximumPeriod6Rate,
068: GraduateAssistantRate graduateAssistantRate) {
069: this (documentNumber, campusCode, campusMaximumPeriod1Rate,
070: campusMaximumPeriod2Rate, campusMaximumPeriod3Rate,
071: campusMaximumPeriod4Rate, campusMaximumPeriod5Rate,
072: campusMaximumPeriod3Rate, graduateAssistantRate, null,
073: null);
074: }
075:
076: public BudgetGraduateAssistantRate(String documentNumber,
077: String campusCode, KualiDecimal campusMaximumPeriod1Rate,
078: KualiDecimal campusMaximumPeriod2Rate,
079: KualiDecimal campusMaximumPeriod3Rate,
080: KualiDecimal campusMaximumPeriod4Rate,
081: KualiDecimal campusMaximumPeriod5Rate,
082: KualiDecimal campusMaximumPeriod6Rate,
083: GraduateAssistantRate graduateAssistantRate,
084: String objectId, Long versionNumber) {
085: super ();
086: this .documentNumber = documentNumber;
087: this .campusCode = campusCode;
088: this .campusMaximumPeriod1Rate = campusMaximumPeriod1Rate;
089: this .campusMaximumPeriod2Rate = campusMaximumPeriod2Rate;
090: this .campusMaximumPeriod3Rate = campusMaximumPeriod3Rate;
091: this .campusMaximumPeriod4Rate = campusMaximumPeriod4Rate;
092: this .campusMaximumPeriod5Rate = campusMaximumPeriod5Rate;
093: this .campusMaximumPeriod6Rate = campusMaximumPeriod6Rate;
094: this .graduateAssistantRate = graduateAssistantRate;
095: setObjectId(objectId);
096: setVersionNumber(versionNumber);
097: }
098:
099: public BudgetGraduateAssistantRate(String documentNumber,
100: GraduateAssistantRate gradAssistantRate) {
101: this (documentNumber, gradAssistantRate.getCampusCode(),
102: gradAssistantRate.getCampusMaximumPeriod1Rate(),
103: gradAssistantRate.getCampusMaximumPeriod2Rate(),
104: gradAssistantRate.getCampusMaximumPeriod3Rate(),
105: gradAssistantRate.getCampusMaximumPeriod4Rate(),
106: gradAssistantRate.getCampusMaximumPeriod5Rate(),
107: gradAssistantRate.getCampusMaximumPeriod6Rate(),
108: gradAssistantRate);
109: }
110:
111: public String getCampusCode() {
112: return campusCode;
113: }
114:
115: public void setCampusCode(String campusCode) {
116: this .campusCode = campusCode;
117: }
118:
119: public KualiDecimal getCampusMaximumPeriod1Rate() {
120: return campusMaximumPeriod1Rate;
121: }
122:
123: public void setCampusMaximumPeriod1Rate(
124: KualiDecimal campusMaximumPeriod1Rate) {
125: this .campusMaximumPeriod1Rate = campusMaximumPeriod1Rate;
126: }
127:
128: public KualiDecimal getCampusMaximumPeriod2Rate() {
129: return campusMaximumPeriod2Rate;
130: }
131:
132: public void setCampusMaximumPeriod2Rate(
133: KualiDecimal campusMaximumPeriod2Rate) {
134: this .campusMaximumPeriod2Rate = campusMaximumPeriod2Rate;
135: }
136:
137: public KualiDecimal getCampusMaximumPeriod3Rate() {
138: return campusMaximumPeriod3Rate;
139: }
140:
141: public void setCampusMaximumPeriod3Rate(
142: KualiDecimal campusMaximumPeriod3Rate) {
143: this .campusMaximumPeriod3Rate = campusMaximumPeriod3Rate;
144: }
145:
146: public KualiDecimal getCampusMaximumPeriod4Rate() {
147: return campusMaximumPeriod4Rate;
148: }
149:
150: public void setCampusMaximumPeriod4Rate(
151: KualiDecimal campusMaximumPeriod4Rate) {
152: this .campusMaximumPeriod4Rate = campusMaximumPeriod4Rate;
153: }
154:
155: public KualiDecimal getCampusMaximumPeriod5Rate() {
156: return campusMaximumPeriod5Rate;
157: }
158:
159: public void setCampusMaximumPeriod5Rate(
160: KualiDecimal campusMaximumPeriod5Rate) {
161: this .campusMaximumPeriod5Rate = campusMaximumPeriod5Rate;
162: }
163:
164: public KualiDecimal getCampusMaximumPeriod6Rate() {
165: return campusMaximumPeriod6Rate;
166: }
167:
168: public void setCampusMaximumPeriod6Rate(
169: KualiDecimal campusMaximumPeriod6Rate) {
170: this .campusMaximumPeriod6Rate = campusMaximumPeriod6Rate;
171: }
172:
173: /*
174: * a "getter" function that treats the Campus Maximum Periods Rates attributes as if they were in an array. @param i - a 1 based
175: * index for the academic year subdivision @returns the Campus Maximum Periods Rate for the given academic year subdivision
176: */
177: public KualiDecimal getCampusMaximumPeriodRate(int i) {
178: switch (i) {
179: case 1:
180: return getCampusMaximumPeriod1Rate();
181: case 2:
182: return getCampusMaximumPeriod2Rate();
183: case 3:
184: return getCampusMaximumPeriod3Rate();
185: case 4:
186: return getCampusMaximumPeriod4Rate();
187: case 5:
188: return getCampusMaximumPeriod5Rate();
189: case 6:
190: return getCampusMaximumPeriod6Rate();
191: default:
192: throw new ArrayIndexOutOfBoundsException(i);
193: }
194: }
195:
196: /*
197: * a "setter" function that treats the Campus Maximum Periods Rates attributes as if they were in an array. @param i - a 1 based
198: * index for the academic year subdivision @param aRate - the rate to set
199: */
200: public void setCampusMaximumPeriodRate(int i, KualiDecimal aRate) {
201: switch (i) {
202: case 1:
203: setCampusMaximumPeriod1Rate(aRate);
204: break;
205: case 2:
206: setCampusMaximumPeriod2Rate(aRate);
207: break;
208: case 3:
209: setCampusMaximumPeriod3Rate(aRate);
210: break;
211: case 4:
212: setCampusMaximumPeriod4Rate(aRate);
213: break;
214: case 5:
215: setCampusMaximumPeriod5Rate(aRate);
216: break;
217: case 6:
218: setCampusMaximumPeriod6Rate(aRate);
219: break;
220: default:
221: throw new ArrayIndexOutOfBoundsException(i);
222: }
223: }
224:
225: public String getDocumentNumber() {
226: return documentNumber;
227: }
228:
229: public void setDocumentNumber(String documentNumber) {
230: this .documentNumber = documentNumber;
231: }
232:
233: protected String toStringBuilder(LinkedHashMap fieldValues) {
234: // TODO Auto-generated method stub
235: return super .toStringBuilder(fieldValues);
236: }
237:
238: protected LinkedHashMap toStringMapper() {
239: LinkedHashMap m = new LinkedHashMap();
240:
241: m
242: .put(KFSPropertyConstants.DOCUMENT_NUMBER,
243: this .documentNumber);
244: m.put("campusCode", this .campusCode);
245: return m;
246: }
247:
248: /**
249: * @return Returns the graduateAssistantRate.
250: */
251: public GraduateAssistantRate getGraduateAssistantRate() {
252: return graduateAssistantRate;
253: }
254:
255: /**
256: * @param graduateAssistantRate The graduateAssistantRate to set.
257: */
258: public void setGraduateAssistantRate(
259: GraduateAssistantRate graduateAssistantRate) {
260: this .graduateAssistantRate = graduateAssistantRate;
261: }
262:
263: /**
264: * @return Returns the lastUpdateTimestamp.
265: */
266: public Timestamp getLastUpdateTimestamp() {
267: return lastUpdateTimestamp;
268: }
269:
270: /**
271: * @param lastUpdateTimestamp The lastUpdateTimestamp to set.
272: */
273: public void setLastUpdateTimestamp(Timestamp lastUpdateTimestamp) {
274: this .lastUpdateTimestamp = lastUpdateTimestamp;
275: }
276:
277: /**
278: * @see java.lang.Comparable#compareTo(java.lang.Object)
279: */
280: public int compareTo(Object o) {
281: return this .getCampusCode().compareTo(
282: ((BudgetGraduateAssistantRate) o).getCampusCode());
283: }
284:
285: /*
286: * (non-Javadoc) Doesn't compare timestamps
287: *
288: * @see java.lang.Object#equals(java.lang.Object)
289: */
290: public boolean equals(Object obj) {
291: boolean equals = true;
292:
293: if (ObjectUtils.isNotNull(obj)
294: && obj instanceof BudgetGraduateAssistantRate) {
295: BudgetGraduateAssistantRate objCompare = (BudgetGraduateAssistantRate) obj;
296: equals &= this.documentNumber.equals(objCompare
297: .getDocumentNumber());
298: equals &= this.campusCode
299: .equals(objCompare.getCampusCode());
300:
301: if (this.campusMaximumPeriod1Rate == null
302: && objCompare.getCampusMaximumPeriod1Rate() == null) {
303: } else {
304: equals &= this.campusMaximumPeriod1Rate != null
305: && objCompare.getCampusMaximumPeriod1Rate() != null
306: && this.campusMaximumPeriod1Rate
307: .equals(objCompare
308: .getCampusMaximumPeriod1Rate());
309: }
310:
311: if (this.campusMaximumPeriod2Rate == null
312: && objCompare.getCampusMaximumPeriod2Rate() == null) {
313: } else {
314: equals &= this.campusMaximumPeriod2Rate != null
315: && objCompare.getCampusMaximumPeriod2Rate() != null
316: && this.campusMaximumPeriod2Rate
317: .equals(objCompare
318: .getCampusMaximumPeriod2Rate());
319: }
320:
321: if (this.campusMaximumPeriod3Rate == null
322: && objCompare.getCampusMaximumPeriod3Rate() == null) {
323: } else {
324: equals &= this.campusMaximumPeriod3Rate != null
325: && objCompare.getCampusMaximumPeriod3Rate() != null
326: && this.campusMaximumPeriod3Rate
327: .equals(objCompare
328: .getCampusMaximumPeriod3Rate());
329: }
330:
331: if (this.campusMaximumPeriod3Rate == null
332: && objCompare.getCampusMaximumPeriod3Rate() == null) {
333: } else {
334: equals &= this.campusMaximumPeriod4Rate != null
335: && objCompare.getCampusMaximumPeriod4Rate() != null
336: && this.campusMaximumPeriod4Rate
337: .equals(objCompare
338: .getCampusMaximumPeriod4Rate());
339: }
340:
341: if (this.campusMaximumPeriod5Rate == null
342: && objCompare.getCampusMaximumPeriod5Rate() == null) {
343: } else {
344: equals &= this.campusMaximumPeriod5Rate != null
345: && objCompare.getCampusMaximumPeriod5Rate() != null
346: && this.campusMaximumPeriod5Rate
347: .equals(objCompare
348: .getCampusMaximumPeriod5Rate());
349: }
350:
351: if (this.campusMaximumPeriod6Rate == null
352: && objCompare.getCampusMaximumPeriod6Rate() == null) {
353: } else {
354: equals &= this.campusMaximumPeriod6Rate != null
355: && objCompare.getCampusMaximumPeriod6Rate() != null
356: && this.campusMaximumPeriod6Rate
357: .equals(objCompare
358: .getCampusMaximumPeriod6Rate());
359: }
360: }
361:
362: return equals;
363: }
364: }
|