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.LinkedHashMap;
021: import java.util.List;
022:
023: import org.kuali.core.bo.PersistableBusinessObjectBase;
024: import org.kuali.kfs.context.SpringContext;
025: import org.kuali.kfs.service.ParameterService;
026: import org.kuali.module.kra.KraConstants;
027: import org.kuali.module.kra.budget.document.BudgetDocument;
028: import org.kuali.module.kra.routingform.bo.Purpose;
029:
030: /**
031: *
032: */
033: public class BudgetIndirectCost extends PersistableBusinessObjectBase {
034:
035: private String documentNumber;
036:
037: /**
038: * This is the top left of the IDC parameters form.
039: */
040: private String budgetPurposeCode; // BDGT_PRPS_CD
041: private String budgetBaseCode; // BDGT_BASE_CD
042: private String budgetManualRateIndicator; // BDGT_MAN_RT_IND
043:
044: /**
045: * This is the top right of the IDC parameters form.
046: */
047: private boolean budgetIndirectCostCostShareIndicator; // BDGT_IDC_CST_SHR_IND
048: private boolean budgetUnrecoveredIndirectCostIndicator; // BDGT_URCV_IDC_IND
049: private String budgetIndirectCostJustificationText; // BDGT_IDC_JSTF_TXT
050:
051: /**
052: * This is ???? in the IDC parameters form.
053: */
054: private boolean budgetManualMtdcIndicator; // BDGT_MAN_MTDC_IND
055:
056: private String budgetManualRateIndicatorDescription;
057: private Purpose purpose;
058: private BudgetBaseCode baseCode;
059: private List budgetTaskPeriodIndirectCostItems;
060:
061: /**
062: * Default no-arg constructor.
063: */
064: public BudgetIndirectCost() {
065: super ();
066:
067: // Set up default values for the IDC object.
068: // We do this in case we are entering a budget for the first time.
069: this .purpose = new Purpose();
070: this .baseCode = new BudgetBaseCode();
071: this .setBudgetTaskPeriodIndirectCostItems(new ArrayList());
072: this .setBudgetIndirectCostCostShareIndicator(false);
073: this .setBudgetUnrecoveredIndirectCostIndicator(false);
074: this .setBudgetManualMtdcIndicator(false);
075:
076: ParameterService parameterService = SpringContext
077: .getBean(ParameterService.class);
078: this
079: .setBudgetPurposeCode(parameterService
080: .getParameterValue(
081: BudgetDocument.class,
082: KraConstants.BUDGET_PURPOSE_CODE_DEFAULT_VALUE_PARAMETER_NAME));
083: this
084: .setBudgetBaseCode(parameterService
085: .getParameterValue(
086: BudgetDocument.class,
087: KraConstants.BUDGET_BASE_CODE_DEFAULT_VALUE_PARAMETER_NAME));
088: this
089: .setBudgetManualRateIndicator(parameterService
090: .getParameterValue(
091: BudgetDocument.class,
092: KraConstants.BUDGET_MANUAL_RATE_INDICATOR_DEFAULT_VALUE_PARAMETER_NAME));
093:
094: this .budgetTaskPeriodIndirectCostItems = new ArrayList();
095: }
096:
097: /**
098: * Constructor with documentNumber.
099: *
100: * @param String documentNumber
101: */
102: public BudgetIndirectCost(String documentNumber) {
103: this ();
104: this .setDocumentNumber(documentNumber);
105: }
106:
107: /**
108: * Constructor to create a new idc object based on passed idc object.
109: *
110: * @param BudgetIndirectCost idc
111: */
112: public BudgetIndirectCost(BudgetIndirectCost idc) {
113: // First call default constructor.
114: this ();
115:
116: this .setDocumentNumber(idc.getDocumentNumber());
117: this .setVersionNumber(idc.getVersionNumber());
118: this .setObjectId(idc.getObjectId());
119:
120: this .setBudgetPurposeCode(idc.getBudgetPurposeCode());
121: this .setBudgetBaseCode(idc.getBudgetBaseCode());
122: this .setBudgetManualRateIndicator(idc
123: .getBudgetManualRateIndicator());
124: this .setBudgetIndirectCostCostShareIndicator(idc
125: .getBudgetIndirectCostCostShareIndicator());
126: this .setBudgetUnrecoveredIndirectCostIndicator(idc
127: .getBudgetUnrecoveredIndirectCostIndicator());
128: this .setBudgetIndirectCostJustificationText(idc
129: .getBudgetIndirectCostJustificationText());
130: this .setBudgetManualMtdcIndicator(idc
131: .getBudgetManualMtdcIndicator());
132: this .setBudgetTaskPeriodIndirectCostItems(idc
133: .getBudgetTaskPeriodIndirectCostItems());
134:
135: this .purpose.setPurposeDescription(idc.getPurpose()
136: .getPurposeDescription());
137: this .baseCode.setBudgetBaseDescription(idc.getBaseCode()
138: .getBudgetBaseDescription());
139: }
140:
141: /**
142: * Gets the documentNumber attribute.
143: *
144: * @return Returns the documentNumber
145: */
146: public String getDocumentNumber() {
147: return documentNumber;
148: }
149:
150: /**
151: * Sets the documentNumber attribute.
152: *
153: * @param documentNumber The documentNumber to set.
154: */
155: public void setDocumentNumber(String documentNumber) {
156: this .documentNumber = documentNumber;
157: }
158:
159: /**
160: * Gets the budgetBaseCode attribute.
161: *
162: * @return Returns the budgetBaseCode
163: */
164: public String getBudgetBaseCode() {
165: return budgetBaseCode;
166: }
167:
168: /**
169: * Sets the budgetBaseCode attribute.
170: *
171: * @param budgetBaseCode The budgetBaseCode to set.
172: */
173: public void setBudgetBaseCode(String budgetBaseCode) {
174: this .budgetBaseCode = budgetBaseCode;
175: }
176:
177: /**
178: * Gets the budgetIndirectCostCostShareIndicator attribute.
179: *
180: * @return Returns the budgetIndirectCostCostShareIndicator
181: */
182: public boolean getBudgetIndirectCostCostShareIndicator() {
183: return budgetIndirectCostCostShareIndicator;
184: }
185:
186: /**
187: * Sets the budgetIndirectCostCostShareIndicator attribute.
188: *
189: * @param budgetIndirectCostCostShareIndicator The budgetIndirectCostCostShareIndicator to set.
190: */
191: public void setBudgetIndirectCostCostShareIndicator(
192: boolean budgetIndirectCostCostShareIndicator) {
193: this .budgetIndirectCostCostShareIndicator = budgetIndirectCostCostShareIndicator;
194: }
195:
196: /**
197: * Get boolean value of idc cost share indicator.
198: */
199: public boolean isBudgetIndirectCostCostShareIndicator() {
200: return this .budgetIndirectCostCostShareIndicator;
201: }
202:
203: /**
204: * Gets the budgetIndirectCostJustificationText attribute.
205: *
206: * @return Returns the budgetIndirectCostJustificationText
207: */
208: public String getBudgetIndirectCostJustificationText() {
209: return budgetIndirectCostJustificationText;
210: }
211:
212: /**
213: * Sets the budgetIndirectCostJustificationText attribute.
214: *
215: * @param budgetIndirectCostJustificationText The budgetIndirectCostJustificationText to set.
216: */
217: public void setBudgetIndirectCostJustificationText(
218: String budgetIndirectCostJustificationText) {
219: this .budgetIndirectCostJustificationText = budgetIndirectCostJustificationText;
220: }
221:
222: /**
223: * Gets the budgetManualMtdcIndicator attribute.
224: *
225: * @return Returns the budgetManualMtdcIndicator
226: */
227: public boolean getBudgetManualMtdcIndicator() {
228: return budgetManualMtdcIndicator;
229: }
230:
231: /**
232: * Sets the budgetManualMtdcIndicator attribute.
233: *
234: * @param budgetManualMtdcIndicator The budgetManualMtdcIndicator to set.
235: */
236: public void setBudgetManualMtdcIndicator(
237: boolean budgetManualMtdcIndicator) {
238: this .budgetManualMtdcIndicator = budgetManualMtdcIndicator;
239: }
240:
241: /**
242: * Gets the budgetManualRateIndicator attribute.
243: *
244: * @return Returns the budgetManualRateIndicator
245: */
246: public String getBudgetManualRateIndicator() {
247: return budgetManualRateIndicator;
248: }
249:
250: /**
251: * Gets the budgetManualRateIndicatorDescription attribute.
252: *
253: * @return Returns the budgetManualRateIndicatorDescription
254: */
255: public String getBudgetManualRateIndicatorDescription() {
256: return budgetManualRateIndicatorDescription;
257: }
258:
259: /**
260: * Sets the budgetManualRateIndicatorDescription attribute.
261: *
262: * @param budgetManualRateIndicatorDescription The budgetManualRateIndicatorDescription to set.
263: */
264: public void setBudgetManualRateIndicatorDescription(
265: String budgetManualRateIndicatorDescription) {
266: this .budgetManualRateIndicatorDescription = budgetManualRateIndicatorDescription;
267: }
268:
269: /**
270: * Sets the budgetManualRateIndicator attribute.
271: *
272: * @param budgetManualRateIndicator The budgetManualRateIndicator to set.
273: */
274: public void setBudgetManualRateIndicator(
275: String budgetManualRateIndicator) {
276: this .budgetManualRateIndicator = budgetManualRateIndicator;
277: }
278:
279: /**
280: * Gets the budgetPurposeCode attribute.
281: *
282: * @return Returns the budgetPurposeCode
283: */
284: public String getBudgetPurposeCode() {
285: return budgetPurposeCode;
286: }
287:
288: /**
289: * Sets the budgetPurposeCode attribute.
290: *
291: * @param budgetPurposeCode The budgetPurposeCode to set.
292: */
293: public void setBudgetPurposeCode(String budgetPurposeCode) {
294: this .budgetPurposeCode = budgetPurposeCode;
295: }
296:
297: /**
298: * Gets the budgetUnrecoveredIndirectCostIndicator attribute.
299: *
300: * @return Returns the budgetUnrecoveredIndirectCostIndicator
301: */
302: public boolean getBudgetUnrecoveredIndirectCostIndicator() {
303: return budgetUnrecoveredIndirectCostIndicator;
304: }
305:
306: /**
307: * Sets the budgetUnrecoveredIndirectCostIndicator attribute.
308: *
309: * @param budgetUnrecoveredIndirectCostIndicator The budgetUnrecoveredIndirectCostIndicator to set.
310: */
311: public void setBudgetUnrecoveredIndirectCostIndicator(
312: boolean budgetUnrecoveredIndirectCostIndicator) {
313: this .budgetUnrecoveredIndirectCostIndicator = budgetUnrecoveredIndirectCostIndicator;
314: }
315:
316: /**
317: * Get boolean value of idc cost share indicator.
318: */
319: public boolean isBudgetUnrecoveredIndirectCostIndicator() {
320: return this .budgetUnrecoveredIndirectCostIndicator;
321: }
322:
323: /**
324: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
325: */
326: protected LinkedHashMap toStringMapper() {
327: LinkedHashMap m = new LinkedHashMap();
328:
329: // m.put("<unique identifier 1>", this.<UniqueIdentifier1>());
330: // m.put("<unique identifier 2>", this.<UniqueIdentifier2>());
331:
332: return m;
333: }
334:
335: /**
336: * Gets task/period IDC.
337: *
338: * @return List
339: */
340: public List<BudgetTaskPeriodIndirectCost> getBudgetTaskPeriodIndirectCostItems() {
341: return budgetTaskPeriodIndirectCostItems;
342: }
343:
344: /**
345: * Sets the task/period IDC list.
346: *
347: * @param budgetTaskPeriodIndirectCostItems
348: */
349: public void setBudgetTaskPeriodIndirectCostItems(
350: List budgetTaskPeriodIndirectCostItems) {
351: this .budgetTaskPeriodIndirectCostItems = budgetTaskPeriodIndirectCostItems;
352: }
353:
354: /**
355: * Gets baseCode.
356: *
357: * @return
358: */
359: public BudgetBaseCode getBaseCode() {
360: return baseCode;
361: }
362:
363: /**
364: * Sets baseCode.
365: *
366: * @param
367: * @deprecated
368: */
369: public void setBaseCode(BudgetBaseCode baseCode) {
370: this .baseCode = baseCode;
371: }
372:
373: /**
374: * Gets purpose.
375: *
376: * @return
377: */
378: public Purpose getPurpose() {
379: return purpose;
380: }
381:
382: /**
383: * Sets purpose.
384: *
385: * @param
386: * @deprecated
387: */
388: public void setPurpose(Purpose purpose) {
389: this .purpose = purpose;
390: }
391:
392: /**
393: * Retreive a particular taskPeriod.
394: *
395: * @param index
396: * @return
397: */
398: public BudgetTaskPeriodIndirectCost getBudgetTaskPeriodIndirectCostItem(
399: int index) {
400: while (getBudgetTaskPeriodIndirectCostItems().size() <= index) {
401: getBudgetTaskPeriodIndirectCostItems().add(
402: new BudgetTaskPeriodIndirectCost());
403: }
404: return (BudgetTaskPeriodIndirectCost) getBudgetTaskPeriodIndirectCostItems()
405: .get(index);
406: }
407: }
|