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.apache.ojb.broker.PersistenceBroker;
022: import org.kuali.core.bo.Campus;
023: import org.kuali.core.bo.PersistableBusinessObjectBase;
024: import org.kuali.core.service.DateTimeService;
025: import org.kuali.core.util.KualiDecimal;
026: import org.kuali.kfs.context.SpringContext;
027:
028: /**
029: *
030: */
031:
032: public class GraduateAssistantRate extends
033: PersistableBusinessObjectBase {
034:
035: private static final long serialVersionUID = 8803703155949499268L;
036: private String campusCode;
037: private boolean active;
038: private KualiDecimal campusMaximumPeriod1Rate;
039: private KualiDecimal campusMaximumPeriod2Rate;
040: private KualiDecimal campusMaximumPeriod3Rate;
041: private KualiDecimal campusMaximumPeriod4Rate;
042: private KualiDecimal campusMaximumPeriod5Rate;
043: private KualiDecimal campusMaximumPeriod6Rate;
044: private Timestamp lastUpdateTimestamp;
045: private Campus campus;
046:
047: /**
048: * Default no-arg constructor.
049: */
050: public GraduateAssistantRate() {
051: super ();
052: }
053:
054: /**
055: * Default no-arg constructor.
056: */
057: public GraduateAssistantRate(String campusCode) {
058: this ();
059: this .campusCode = campusCode;
060: }
061:
062: /**
063: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
064: */
065: protected LinkedHashMap toStringMapper() {
066: LinkedHashMap m = new LinkedHashMap();
067: m.put("campusCode", this .campusCode);
068: return m;
069: }
070:
071: /**
072: * @return
073: */
074: public boolean isActive() {
075: return active;
076: }
077:
078: /**
079: * @param active
080: */
081: public void setActive(boolean active) {
082: this .active = active;
083: }
084:
085: /**
086: * @return
087: */
088: public String getCampusCode() {
089: return campusCode;
090: }
091:
092: /**
093: * @param campusCode
094: */
095: public void setCampusCode(String campusCode) {
096: this .campusCode = campusCode;
097: }
098:
099: public KualiDecimal getCampusMaximumPeriod1Rate() {
100: return campusMaximumPeriod1Rate;
101: }
102:
103: public void setCampusMaximumPeriod1Rate(
104: KualiDecimal campusMaximumPeriod1Rate) {
105: this .campusMaximumPeriod1Rate = campusMaximumPeriod1Rate;
106: }
107:
108: public KualiDecimal getCampusMaximumPeriod2Rate() {
109: return campusMaximumPeriod2Rate;
110: }
111:
112: public void setCampusMaximumPeriod2Rate(
113: KualiDecimal campusMaximumPeriod2Rate) {
114: this .campusMaximumPeriod2Rate = campusMaximumPeriod2Rate;
115: }
116:
117: public KualiDecimal getCampusMaximumPeriod3Rate() {
118: return campusMaximumPeriod3Rate;
119: }
120:
121: public void setCampusMaximumPeriod3Rate(
122: KualiDecimal campusMaximumPeriod3Rate) {
123: this .campusMaximumPeriod3Rate = campusMaximumPeriod3Rate;
124: }
125:
126: public KualiDecimal getCampusMaximumPeriod4Rate() {
127: return campusMaximumPeriod4Rate;
128: }
129:
130: public void setCampusMaximumPeriod4Rate(
131: KualiDecimal campusMaximumPeriod4Rate) {
132: this .campusMaximumPeriod4Rate = campusMaximumPeriod4Rate;
133: }
134:
135: public KualiDecimal getCampusMaximumPeriod5Rate() {
136: return campusMaximumPeriod5Rate;
137: }
138:
139: public void setCampusMaximumPeriod5Rate(
140: KualiDecimal campusMaximumPeriod5Rate) {
141: this .campusMaximumPeriod5Rate = campusMaximumPeriod5Rate;
142: }
143:
144: public KualiDecimal getCampusMaximumPeriod6Rate() {
145: return campusMaximumPeriod6Rate;
146: }
147:
148: public void setCampusMaximumPeriod6Rate(
149: KualiDecimal campusMaximumPeriod6Rate) {
150: this .campusMaximumPeriod6Rate = campusMaximumPeriod6Rate;
151: }
152:
153: /**
154: * @return Returns the campus.
155: */
156: public Campus getCampus() {
157: return campus;
158: }
159:
160: /**
161: * @param campus The campus to set.
162: */
163: public void setCampus(Campus campus) {
164: this .campus = campus;
165: }
166:
167: /*
168: * a "getter" function that treats the Campus Maximum Periods Rates attributes as if they were in an array. @param i - a 1 based
169: * index for the academic year subdivision @returns the Campus Maximum Periods Rate for the given academic year subdivision
170: */
171: public KualiDecimal getCampusMaximumPeriodRate(int i) {
172: switch (i) {
173: case 1:
174: return getCampusMaximumPeriod1Rate();
175: case 2:
176: return getCampusMaximumPeriod2Rate();
177: case 3:
178: return getCampusMaximumPeriod3Rate();
179: case 4:
180: return getCampusMaximumPeriod4Rate();
181: case 5:
182: return getCampusMaximumPeriod5Rate();
183: case 6:
184: return getCampusMaximumPeriod6Rate();
185: default:
186: throw new ArrayIndexOutOfBoundsException(i);
187: }
188: }
189:
190: /*
191: * a "setter" function that treats the Campus Maximum Periods Rates attributes as if they were in an array. @param i - a 1 based
192: * index for the academic year subdivision @param aRate - the rate to set
193: */
194: public void setCampusMaximumPeriodRate(int i, KualiDecimal aRate) {
195: switch (i) {
196: case 1:
197: setCampusMaximumPeriod1Rate(aRate);
198: break;
199: case 2:
200: setCampusMaximumPeriod2Rate(aRate);
201: break;
202: case 3:
203: setCampusMaximumPeriod3Rate(aRate);
204: break;
205: case 4:
206: setCampusMaximumPeriod4Rate(aRate);
207: break;
208: case 5:
209: setCampusMaximumPeriod5Rate(aRate);
210: break;
211: case 6:
212: setCampusMaximumPeriod6Rate(aRate);
213: break;
214: default:
215: throw new ArrayIndexOutOfBoundsException(i);
216: }
217: }
218:
219: /**
220: * @return
221: */
222: public Timestamp getLastUpdateTimestamp() {
223: return lastUpdateTimestamp;
224: }
225:
226: /**
227: * @param lastUpdateTimestamp
228: */
229: public void setLastUpdateTimestamp(Timestamp lastUpdateTimestamp) {
230: this .lastUpdateTimestamp = lastUpdateTimestamp;
231: }
232:
233: public void beforeInsert(PersistenceBroker persistenceBroker) {
234: super .beforeInsert(persistenceBroker);
235: this .lastUpdateTimestamp = SpringContext.getBean(
236: DateTimeService.class).getCurrentTimestamp();
237: }
238:
239: public void beforeUpdate(PersistenceBroker persistenceBroker) {
240: super .beforeUpdate(persistenceBroker);
241: this .lastUpdateTimestamp = SpringContext.getBean(
242: DateTimeService.class).getCurrentTimestamp();
243: }
244: }
|