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.ArrayList;
020: import java.util.Arrays;
021: import java.util.Iterator;
022: import java.util.LinkedHashMap;
023: import java.util.List;
024:
025: import org.kuali.core.bo.PersistableBusinessObjectBase;
026: import org.kuali.core.util.KualiInteger;
027:
028: /**
029: *
030: */
031: public class BudgetModular extends PersistableBusinessObjectBase {
032:
033: // Stored values - Budget Modular table
034: private String documentNumber;
035: private KualiInteger budgetModularIncrementAmount;
036: private Integer budgetModularTaskNumber;
037: private String budgetModularConsortiumDescription;
038: private String budgetModularPersonnelDescription;
039: private String budgetModularVariableAdjustmentDescription;
040: private List budgetModularPeriods;
041:
042: // Stored values - Agency table
043: private KualiInteger budgetPeriodMaximumAmount;
044:
045: // Derived values
046: private KualiInteger budgetModularDirectCostAmount;
047: private KualiInteger totalActualDirectCostAmount;
048: private KualiInteger totalModularDirectCostAmount;
049: private KualiInteger totalAdjustedModularDirectCostAmount;
050: private KualiInteger totalDirectCostAmount;
051: private KualiInteger totalConsortiumAmount;
052: private List increments;
053: private boolean invalidMode;
054:
055: /**
056: * Default no-arg constructor.
057: */
058: public BudgetModular() {
059: super ();
060: this .budgetModularPeriods = new ArrayList();
061: this .increments = new ArrayList();
062: }
063:
064: public BudgetModular(String documentNumber) {
065: this ();
066: this .documentNumber = documentNumber;
067: }
068:
069: /**
070: * Gets the documentNumber attribute.
071: *
072: * @return Returns the documentNumber
073: */
074: public String getDocumentNumber() {
075: return documentNumber;
076: }
077:
078: /**
079: * Sets the documentNumber attribute.
080: *
081: * @param documentNumber The documentNumber to set.
082: */
083: public void setDocumentNumber(String documentNumber) {
084: this .documentNumber = documentNumber;
085: }
086:
087: /**
088: * Gets the budgetModularIncrementAmount attribute.
089: *
090: * @return Returns the budgetModularIncrementAmount
091: */
092: public KualiInteger getBudgetModularIncrementAmount() {
093: return budgetModularIncrementAmount;
094: }
095:
096: /**
097: * Sets the budgetModularIncrementAmount attribute.
098: *
099: * @param budgetModularIncrementAmount The budgetModularIncrementAmount to set.
100: */
101: public void setBudgetModularIncrementAmount(
102: KualiInteger budgetModularIncrementAmount) {
103: this .budgetModularIncrementAmount = budgetModularIncrementAmount;
104: }
105:
106: /**
107: * Gets the budgetModularTaskNumber attribute.
108: *
109: * @return Returns the budgetModularTaskNumber
110: */
111: public Integer getBudgetModularTaskNumber() {
112: return budgetModularTaskNumber;
113: }
114:
115: /**
116: * Sets the budgetModularTaskNumber attribute.
117: *
118: * @param budgetModularTaskNumber The budgetModularTaskNumber to set.
119: */
120: public void setBudgetModularTaskNumber(
121: Integer budgetModularTaskNumber) {
122: this .budgetModularTaskNumber = budgetModularTaskNumber;
123: }
124:
125: /**
126: * Gets the budgetModularConsortiumDescription attribute.
127: *
128: * @return Returns the budgetModularConsortiumDescription
129: */
130: public String getBudgetModularConsortiumDescription() {
131: return budgetModularConsortiumDescription;
132: }
133:
134: /**
135: * Sets the budgetModularConsortiumDescription attribute.
136: *
137: * @param budgetModularConsortiumDescription The budgetModularConsortiumDescription to set.
138: */
139: public void setBudgetModularConsortiumDescription(
140: String budgetModularConsortiumDescription) {
141: this .budgetModularConsortiumDescription = budgetModularConsortiumDescription;
142: }
143:
144: /**
145: * Gets the budgetModularPersonnelDescription attribute.
146: *
147: * @return Returns the budgetModularPersonnelDescription
148: */
149: public String getBudgetModularPersonnelDescription() {
150: return budgetModularPersonnelDescription;
151: }
152:
153: /**
154: * Sets the budgetModularPersonnelDescription attribute.
155: *
156: * @param budgetModularPersonnelDescription The budgetModularPersonnelDescription to set.
157: */
158: public void setBudgetModularPersonnelDescription(
159: String budgetModularPersonnelDescription) {
160: this .budgetModularPersonnelDescription = budgetModularPersonnelDescription;
161: }
162:
163: /**
164: * Gets the budgetModularVariableAdjustmentDescription attribute.
165: *
166: * @return Returns the budgetModularVariableAdjustmentDescription
167: */
168: public String getBudgetModularVariableAdjustmentDescription() {
169: return budgetModularVariableAdjustmentDescription;
170: }
171:
172: /**
173: * Sets the budgetModularVariableAdjustmentDescription attribute.
174: *
175: * @param budgetModularVariableAdjustmentDescription The budgetModularVariableAdjustmentDescription to set.
176: */
177: public void setBudgetModularVariableAdjustmentDescription(
178: String budgetModularVariableAdjustmentDescription) {
179: this .budgetModularVariableAdjustmentDescription = budgetModularVariableAdjustmentDescription;
180: }
181:
182: /**
183: * Gets the budgetPeriodMaximumAmount attribute.
184: *
185: * @return Returns the budgetPeriodMaximumAmount
186: */
187: public KualiInteger getBudgetPeriodMaximumAmount() {
188: return budgetPeriodMaximumAmount;
189: }
190:
191: /**
192: * Sets the budgetPeriodMaximumAmount attribute.
193: *
194: * @param budgetPeriodMaximumAmount The budgetPeriodMaximumAmount to set.
195: */
196: public void setBudgetPeriodMaximumAmount(
197: KualiInteger budgetPeriodMaximumAmount) {
198: this .budgetPeriodMaximumAmount = budgetPeriodMaximumAmount;
199: }
200:
201: public List getBudgetModularPeriods() {
202: return budgetModularPeriods;
203: }
204:
205: public void setBudgetModularPeriods(List budgetModularPeriods) {
206: this .budgetModularPeriods = budgetModularPeriods;
207: }
208:
209: public KualiInteger getBudgetModularDirectCostAmount() {
210: return budgetModularDirectCostAmount;
211: }
212:
213: public void setBudgetModularDirectCostAmount(
214: KualiInteger budgetModularDirectCostAmount) {
215: this .budgetModularDirectCostAmount = budgetModularDirectCostAmount;
216: }
217:
218: public List getIncrements() {
219: return increments;
220: }
221:
222: public void setIncrements(List increments) {
223: this .increments = increments;
224: }
225:
226: public String getIncrementsString() {
227: StringBuffer sb = new StringBuffer();
228: for (Iterator iter = getIncrements().iterator(); iter.hasNext();) {
229: sb.append((String) iter.next());
230: if (iter.hasNext()) {
231: sb.append("-");
232: }
233: }
234: return sb.toString();
235: }
236:
237: public void setIncrementsString(String strIncrements) {
238: setIncrements(Arrays.asList(strIncrements.split("-")));
239: }
240:
241: /**
242: * Retrieve a particular modularPeriod at a given index in the list of modularPeriods.
243: *
244: * @param index
245: * @return
246: */
247: public BudgetModularPeriod getBudgetModularPeriod(int index) {
248: while (getBudgetModularPeriods().size() <= index) {
249: getBudgetModularPeriods().add(new BudgetModularPeriod());
250: }
251: return (BudgetModularPeriod) getBudgetModularPeriods().get(
252: index);
253: }
254:
255: public KualiInteger getTotalActualDirectCostAmount() {
256: return totalActualDirectCostAmount;
257: }
258:
259: public KualiInteger getTotalModularDirectCostAmount() {
260: return totalModularDirectCostAmount;
261: }
262:
263: public KualiInteger getTotalAdjustedModularDirectCostAmount() {
264: return totalAdjustedModularDirectCostAmount;
265: }
266:
267: public KualiInteger getTotalDirectCostAmount() {
268: return totalDirectCostAmount;
269: }
270:
271: public void setTotalActualDirectCostAmount(
272: KualiInteger totalActualDirectCostAmount) {
273: this .totalActualDirectCostAmount = totalActualDirectCostAmount;
274: }
275:
276: public void setTotalAdjustedModularDirectCostAmount(
277: KualiInteger totalAdjustedModularDirectCostAmount) {
278: this .totalAdjustedModularDirectCostAmount = totalAdjustedModularDirectCostAmount;
279: }
280:
281: public void setTotalDirectCostAmount(
282: KualiInteger totalDirectCostAmount) {
283: this .totalDirectCostAmount = totalDirectCostAmount;
284: }
285:
286: public void setTotalModularDirectCostAmount(
287: KualiInteger totalModularDirectCostAmount) {
288: this .totalModularDirectCostAmount = totalModularDirectCostAmount;
289: }
290:
291: public KualiInteger getTotalConsortiumAmount() {
292: return totalConsortiumAmount;
293: }
294:
295: public void setTotalConsortiumAmount(
296: KualiInteger totalConsortiumAmount) {
297: this .totalConsortiumAmount = totalConsortiumAmount;
298: }
299:
300: public KualiInteger getTotalModularVarianceAmount() {
301: if (this .getTotalAdjustedModularDirectCostAmount() != null
302: && this .getTotalActualDirectCostAmount() != null) {
303: return this .getTotalAdjustedModularDirectCostAmount()
304: .subtract(this .getTotalActualDirectCostAmount());
305: }
306: return new KualiInteger(0);
307: }
308:
309: public boolean isInvalidMode() {
310: return invalidMode;
311: }
312:
313: public void setInvalidMode(boolean invalidMode) {
314: this .invalidMode = invalidMode;
315: }
316:
317: /**
318: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
319: */
320: protected LinkedHashMap toStringMapper() {
321: LinkedHashMap m = new LinkedHashMap();
322:
323: // m.put("<unique identifier 1>", this.<UniqueIdentifier1>());
324: // m.put("<unique identifier 2>", this.<UniqueIdentifier2>());
325:
326: return m;
327: }
328: }
|