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.KFSPropertyConstants;
025:
026: /**
027: *
028: */
029: public abstract class BudgetAbstractCostShare extends
030: PersistableBusinessObjectBase {
031:
032: protected String documentNumber;
033: protected Integer budgetCostShareSequenceNumber;
034: protected String budgetCostShareDescription;
035: protected List budgetPeriodCostShare;
036:
037: /**
038: * Default no-arg constructor.
039: */
040: public BudgetAbstractCostShare() {
041: super ();
042: budgetPeriodCostShare = new ArrayList();
043: }
044:
045: /**
046: * Populates the key fields for BudgetAbstractPeriodCostShare object. This could be done on object creation, unfortunatly at
047: * that time we don't have budgetCostShareSequenceNumber set yet (object is created on page load, while sequence number is set
048: * on pressing "add" on the page). Thus we opted for this solution.
049: *
050: * @param documentNumber
051: * @param periods
052: * @param budgetAbstractCostShare
053: */
054: public void populateKeyFields(String documentNumber,
055: List<BudgetPeriod> periods) {
056: this .setDocumentNumber(documentNumber);
057:
058: for (int i = 0; i < periods.size(); i++) {
059: BudgetPeriod period = periods.get(i);
060: BudgetAbstractPeriodCostShare budgetAbstractPeriodCostShare = this
061: .getBudgetPeriodCostShareItem(i);
062:
063: budgetAbstractPeriodCostShare
064: .setDocumentNumber(documentNumber);
065: budgetAbstractPeriodCostShare
066: .setBudgetCostShareSequenceNumber(this
067: .getBudgetCostShareSequenceNumber());
068: budgetAbstractPeriodCostShare
069: .setBudgetPeriodSequenceNumber(period
070: .getBudgetPeriodSequenceNumber());
071: }
072: }
073:
074: public abstract List getBudgetPeriodCostShare();
075:
076: public abstract void setBudgetPeriodCostShare(
077: List budgetPeriodCostShare);
078:
079: public abstract BudgetAbstractPeriodCostShare getBudgetPeriodCostShareItem(
080: int index);
081:
082: /**
083: * Gets the documentNumber attribute.
084: *
085: * @return Returns the documentNumber
086: */
087: public String getDocumentNumber() {
088: return documentNumber;
089: }
090:
091: /**
092: * Sets the documentNumber attribute.
093: *
094: * @param documentNumber The documentNumber to set.
095: */
096: public void setDocumentNumber(String documentNumber) {
097: this .documentNumber = documentNumber;
098: }
099:
100: /**
101: * Gets the budgetThirdPartyCostShareSequenceNumber attribute.
102: *
103: * @return Returns the budgetThirdPartyCostShareSequenceNumber
104: */
105: public Integer getBudgetCostShareSequenceNumber() {
106: return budgetCostShareSequenceNumber;
107: }
108:
109: /**
110: * Sets the budgetThirdPartyCostShareSequenceNumber attribute.
111: *
112: * @param budgetThirdPartyCostShareSequenceNumber The budgetThirdPartyCostShareSequenceNumber to set.
113: */
114: public void setBudgetCostShareSequenceNumber(
115: Integer budgetThirdPartyCostShareSequenceNumber) {
116: this .budgetCostShareSequenceNumber = budgetThirdPartyCostShareSequenceNumber;
117: }
118:
119: /**
120: * Gets the budgetThirdPartyCostShareDescription attribute.
121: *
122: * @return Returns the budgetThirdPartyCostShareDescription
123: */
124: public String getBudgetCostShareDescription() {
125: return budgetCostShareDescription;
126: }
127:
128: /**
129: * Sets the budgetThirdPartyCostShareDescription attribute.
130: *
131: * @param budgetThirdPartyCostShareDescription The budgetThirdPartyCostShareDescription to set.
132: */
133: public void setBudgetCostShareDescription(
134: String budgetThirdPartyCostShareDescription) {
135: this .budgetCostShareDescription = budgetThirdPartyCostShareDescription;
136: }
137:
138: /**
139: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
140: */
141: protected LinkedHashMap toStringMapper() {
142: LinkedHashMap m = new LinkedHashMap();
143:
144: m
145: .put(KFSPropertyConstants.DOCUMENT_NUMBER,
146: this .documentNumber);
147: m.put("budgetCostShareSequenceNumber",
148: this.budgetCostShareSequenceNumber);
149:
150: return m;
151: }
152: }
|