0001: /*
0002: * Copyright 2006-2007 The Kuali Foundation.
0003: *
0004: * Licensed under the Educational Community License, Version 1.0 (the "License");
0005: * you may not use this file except in compliance with the License.
0006: * You may obtain a copy of the License at
0007: *
0008: * http://www.opensource.org/licenses/ecl1.php
0009: *
0010: * Unless required by applicable law or agreed to in writing, software
0011: * distributed under the License is distributed on an "AS IS" BASIS,
0012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013: * See the License for the specific language governing permissions and
0014: * limitations under the License.
0015: */
0016: package org.kuali.module.kra.budget.web.struts.form;
0017:
0018: import java.sql.Date;
0019: import java.util.ArrayList;
0020: import java.util.Arrays;
0021: import java.util.Collections;
0022: import java.util.GregorianCalendar;
0023: import java.util.HashMap;
0024: import java.util.Iterator;
0025: import java.util.List;
0026:
0027: import javax.servlet.http.HttpServletRequest;
0028:
0029: import org.apache.struts.action.ActionErrors;
0030: import org.apache.struts.action.ActionMapping;
0031: import org.kuali.core.bo.user.UniversalUser;
0032: import org.kuali.core.datadictionary.DataDictionary;
0033: import org.kuali.core.datadictionary.DocumentEntry;
0034: import org.kuali.core.service.DataDictionaryService;
0035: import org.kuali.core.web.ui.KeyLabelPair;
0036: import org.kuali.kfs.context.SpringContext;
0037: import org.kuali.kfs.service.ParameterService;
0038: import org.kuali.kfs.service.impl.ParameterConstants;
0039: import org.kuali.module.chart.bo.ChartUser;
0040: import org.kuali.module.chart.service.ChartUserService;
0041: import org.kuali.module.kra.KraConstants;
0042: import org.kuali.module.kra.budget.bo.Budget;
0043: import org.kuali.module.kra.budget.bo.BudgetFringeRate;
0044: import org.kuali.module.kra.budget.bo.BudgetGraduateAssistantRate;
0045: import org.kuali.module.kra.budget.bo.BudgetInstitutionCostShare;
0046: import org.kuali.module.kra.budget.bo.BudgetNonpersonnel;
0047: import org.kuali.module.kra.budget.bo.BudgetPeriod;
0048: import org.kuali.module.kra.budget.bo.BudgetTask;
0049: import org.kuali.module.kra.budget.bo.BudgetThirdPartyCostShare;
0050: import org.kuali.module.kra.budget.bo.BudgetTypeCode;
0051: import org.kuali.module.kra.budget.bo.BudgetUser;
0052: import org.kuali.module.kra.budget.bo.NonpersonnelCategory;
0053: import org.kuali.module.kra.budget.document.BudgetDocument;
0054: import org.kuali.module.kra.budget.service.BudgetPeriodService;
0055: import org.kuali.module.kra.budget.service.BudgetPersonnelService;
0056: import org.kuali.module.kra.budget.service.BudgetTaskService;
0057: import org.kuali.module.kra.document.ResearchDocument;
0058: import org.kuali.module.kra.web.struts.form.ResearchDocumentFormBase;
0059:
0060: /**
0061: * This class is the action form for KRA Budget.
0062: */
0063: public class BudgetForm extends ResearchDocumentFormBase {
0064:
0065: private static final long serialVersionUID = 1L;
0066:
0067: private HashMap appointmentTypeGridMappings;
0068:
0069: private String DEFAULT_BUDGET_TASK_NAME;
0070: private String TO_BE_NAMED_LABEL;
0071:
0072: private BudgetTask newTask;
0073: private BudgetPeriod newPeriod;
0074: private BudgetUser newPersonnel;
0075: private String newPersonnelType = "person";
0076: private BudgetFringeRate newFringeRate;
0077: private BudgetGraduateAssistantRate newGraduateAssistantRate;
0078:
0079: private UniversalUser initiator;
0080:
0081: private String[] deleteValues = new String[50];
0082:
0083: private List budgetTypeCodes;
0084:
0085: private List academicYearSubdivisionNames;
0086: private int numberOfAcademicYearSubdivisions;
0087:
0088: private List nonpersonnelCategories;
0089: private List newNonpersonnelList;
0090: private BudgetOverviewFormHelper budgetOverviewFormHelper;
0091: private BudgetNonpersonnelFormHelper budgetNonpersonnelFormHelper;
0092: private BudgetNonpersonnelCopyOverFormHelper budgetNonpersonnelCopyOverFormHelper;
0093: private BudgetIndirectCostFormHelper budgetIndirectCostFormHelper;
0094:
0095: private BudgetInstitutionCostShare newInstitutionCostShare;
0096: private BudgetThirdPartyCostShare newThirdPartyCostShare;
0097: private BudgetCostShareFormHelper budgetCostShareFormHelper;
0098:
0099: private Integer currentTaskNumber;
0100: private Integer previousTaskNumber;
0101: private Integer currentPeriodNumber;
0102: private Integer previousPeriodNumber;
0103:
0104: private String currentNonpersonnelCategoryCode;
0105:
0106: private String currentOutputReportType;
0107: private String currentOutputDetailLevel;
0108: private String currentOutputAgencyType;
0109: private String currentOutputAgencyPeriod; // can't use currentPeriodNumber because it has logic in getter
0110:
0111: private boolean supportsModular;
0112: private boolean auditActivated;
0113: private boolean includeAdHocPermissions;
0114: private boolean includeBudgetIdcRates;
0115: private boolean displayCostSharePermission;
0116:
0117: public BudgetForm() {
0118: super ();
0119:
0120: DEFAULT_BUDGET_TASK_NAME = SpringContext.getBean(
0121: ParameterService.class).getParameterValue(
0122: BudgetDocument.class,
0123: KraConstants.DEFAULT_BUDGET_TASK_NAME);
0124: TO_BE_NAMED_LABEL = SpringContext
0125: .getBean(ParameterService.class)
0126: .getParameterValue(
0127: ParameterConstants.RESEARCH_ADMINISTRATION_DOCUMENT.class,
0128: KraConstants.TO_BE_NAMED_LABEL);
0129:
0130: newPeriod = new BudgetPeriod();
0131: newTask = new BudgetTask();
0132: newPersonnel = new BudgetUser();
0133: newFringeRate = new BudgetFringeRate();
0134: newGraduateAssistantRate = new BudgetGraduateAssistantRate();
0135: initiator = new UniversalUser();
0136: setDocument(new BudgetDocument());
0137: newInstitutionCostShare = new BudgetInstitutionCostShare();
0138: newThirdPartyCostShare = new BudgetThirdPartyCostShare();
0139: budgetTypeCodes = new ArrayList();
0140: nonpersonnelCategories = new ArrayList();
0141: newNonpersonnelList = new ArrayList();
0142: budgetNonpersonnelCopyOverFormHelper = new BudgetNonpersonnelCopyOverFormHelper();
0143:
0144: academicYearSubdivisionNames = new ArrayList();
0145:
0146: DataDictionary dataDictionary = SpringContext.getBean(
0147: DataDictionaryService.class).getDataDictionary();
0148: DocumentEntry budgetDocumentEntry = dataDictionary
0149: .getDocumentEntry(org.kuali.module.kra.budget.document.BudgetDocument.class
0150: .getName());
0151: this .setHeaderNavigationTabs(budgetDocumentEntry
0152: .getHeaderTabNavigation());
0153: }
0154:
0155: @Override
0156: public ResearchDocument getResearchDocument() {
0157: return this .getBudgetDocument();
0158: }
0159:
0160: /**
0161: * Checks for methodToCall parameter, and if not populated in form calls utility method to parse the string from the request.
0162: */
0163: public void populate(HttpServletRequest request) {
0164: super .populate(request);
0165: checkHeaderNavigation();
0166: }
0167:
0168: /**
0169: * <p>
0170: * This method resets the tab states, task number (depending on parameters) and period number.
0171: * </p>
0172: *
0173: * @param resetTask determines whether task is to be reset.
0174: * @param resetPeriod determines whether period is to be reset.
0175: */
0176: public void newTabState(boolean resetTask, boolean resetPeriod) {
0177: this .setTabStates(new HashMap());
0178: if (resetTask)
0179: this .setCurrentTaskNumber(null);
0180: if (resetPeriod)
0181: this .setCurrentPeriodNumber(null);
0182: }
0183:
0184: public void checkHeaderNavigation() {
0185: if (!this .getBudgetDocument().getBudget()
0186: .isAgencyModularIndicator()) {
0187: disableHeaderNavigation("modular");
0188: } else {
0189: enableHeaderNavigation("modular");
0190: }
0191: }
0192:
0193: public void processValidationFail() {
0194: Budget budget = this .getBudgetDocument().getBudget();
0195: for (Iterator i = budget.getPersonnel().iterator(); i.hasNext();) {
0196: BudgetUser budgetUser = (BudgetUser) i.next();
0197: if (budgetUser.getPreviousAppointmentTypeCode() != null) {
0198: budgetUser.setAppointmentTypeCode(budgetUser
0199: .getPreviousAppointmentTypeCode());
0200: }
0201: if (budgetUser.getPreviousTaskNumber() != null) {
0202: budgetUser.setCurrentTaskNumber(budgetUser
0203: .getPreviousTaskNumber());
0204: }
0205: }
0206: }
0207:
0208: /**
0209: * @return Returns the internalBillingDocument.
0210: */
0211: public BudgetDocument getBudgetDocument() {
0212: return (BudgetDocument) getDocument();
0213: }
0214:
0215: /**
0216: * @param internalBillingDocument The internalBillingDocument to set.
0217: */
0218: public void setBudgetDocument(BudgetDocument budgetDocument) {
0219: setDocument(budgetDocument);
0220: }
0221:
0222: public boolean isIncludeAdHocPermissions() {
0223: return includeAdHocPermissions;
0224: }
0225:
0226: public void setIncludeAdHocPermissions(boolean include_ad_hocs) {
0227: this .includeAdHocPermissions = include_ad_hocs;
0228: }
0229:
0230: /**
0231: * Gets the includeBudgetIdcRates attribute.
0232: *
0233: * @return Returns the includeBudgetIdcRates.
0234: */
0235: public boolean isIncludeBudgetIdcRates() {
0236: return includeBudgetIdcRates;
0237: }
0238:
0239: /**
0240: * Sets the includeBudgetIdcRates attribute value.
0241: *
0242: * @param includeBudgetIdcRates The includeBudgetIdcRates to set.
0243: */
0244: public void setIncludeBudgetIdcRates(boolean includeBudgetIdcRates) {
0245: this .includeBudgetIdcRates = includeBudgetIdcRates;
0246: }
0247:
0248: /**
0249: * Gets the newBudgetPeriod attribute.
0250: *
0251: * @return Returns the newBudgetPeriod.
0252: */
0253: public BudgetPeriod getNewPeriod() {
0254: return newPeriod;
0255: }
0256:
0257: /**
0258: * Sets the newBudgetPeriod attribute value.
0259: *
0260: * @param newBudgetPeriod The newBudgetPeriod to set.
0261: */
0262: public void setNewPeriod(BudgetPeriod newBudgetPeriod) {
0263: if (newPeriod != null
0264: && newPeriod.getBudgetPeriodEndDate() != null) {
0265: Date oldEndDate = newPeriod.getBudgetPeriodEndDate();
0266: GregorianCalendar oldEndCal = new GregorianCalendar();
0267: oldEndCal.setTime(oldEndDate);
0268: oldEndCal.add(GregorianCalendar.DATE, 1);
0269: newBudgetPeriod.setBudgetPeriodBeginDate(new Date(oldEndCal
0270: .getTimeInMillis()));
0271: }
0272: this .newPeriod = newBudgetPeriod;
0273: }
0274:
0275: /**
0276: * Gets the newBudgetTask attribute.
0277: *
0278: * @return Returns the newBudgetTask.
0279: */
0280: public BudgetTask getNewTask() {
0281: return newTask;
0282: }
0283:
0284: /**
0285: * Sets the newBudgetTask attribute value.
0286: *
0287: * @param newBudgetTask The newBudgetTask to set.
0288: */
0289: public void setNewTask(BudgetTask newBudgetTask) {
0290: this .newTask = newBudgetTask;
0291:
0292: // Set our next task number to be whatever the task list size is + 1.
0293: // Integer nextSequenceNumber = new Integer(getBudgetDocument().getBudgetTaskNextSequenceNumber().intValue() + 1);
0294:
0295: // Now set the default TaskName for the new task in the addline.
0296: newTask.setBudgetTaskName(DEFAULT_BUDGET_TASK_NAME
0297: + " "
0298: + getBudgetDocument().getBudgetTaskNextSequenceNumber()
0299: .toString());
0300: }
0301:
0302: /**
0303: * Gets the newNonpersonnel attribute.
0304: *
0305: * @return Returns the newNonpersonnel.
0306: */
0307: public BudgetUser getNewPersonnel() {
0308: return newPersonnel;
0309: }
0310:
0311: /**
0312: * Sets the newNonpersonnel attribute value.
0313: *
0314: * @param newNonpersonnel The newNonpersonnel to set.
0315: */
0316: public void setNewPersonnel(BudgetUser newPersonnel) {
0317: this .newPersonnel = newPersonnel;
0318: }
0319:
0320: /**
0321: * Gets the newFringeRate attribute.
0322: *
0323: * @return Returns the newFringeRate.
0324: */
0325: public BudgetFringeRate getNewFringeRate() {
0326: return newFringeRate;
0327: }
0328:
0329: /**
0330: * Sets the newFringeRate attribute value.
0331: *
0332: * @param newFringeRate The newFringRate to set.
0333: */
0334: public void setNewFringeRate(BudgetFringeRate newFringeRate) {
0335: this .newFringeRate = newFringeRate;
0336: }
0337:
0338: /**
0339: * @return Returns the newGraduateAssistantRate.
0340: */
0341: public BudgetGraduateAssistantRate getNewGraduateAssistantRate() {
0342: return newGraduateAssistantRate;
0343: }
0344:
0345: /**
0346: * @param newGraduateAssistantRate The newGraduateAssistantRate to set.
0347: */
0348: public void setNewGraduateAssistantRate(
0349: BudgetGraduateAssistantRate newGraduateAssistantRate) {
0350: this .newGraduateAssistantRate = newGraduateAssistantRate;
0351: }
0352:
0353: /**
0354: * Sets the newNonpersonnel attribute value.
0355: *
0356: * @param newNonpersonnel The newNonpersonnel to set.
0357: */
0358: public void setNewNonpersonnelList(List newNonpersonnelList) {
0359: this .newNonpersonnelList = newNonpersonnelList;
0360: }
0361:
0362: public List getNewNonpersonnelList() {
0363: return newNonpersonnelList;
0364: }
0365:
0366: public BudgetNonpersonnel getNewNonpersonnel(int index) {
0367: while (getNewNonpersonnelList().size() <= index) {
0368: getNewNonpersonnelList().add(new BudgetNonpersonnel());
0369: }
0370: return (BudgetNonpersonnel) getNewNonpersonnelList().get(index);
0371: }
0372:
0373: /**
0374: * Gets the initiator attribute.
0375: *
0376: * @return Returns the initiator.
0377: */
0378: public UniversalUser getInitiator() {
0379: return initiator;
0380: }
0381:
0382: /**
0383: * Sets the initiator attribute value.
0384: *
0385: * @param initiator The initiator to set.
0386: */
0387: public void setInitiator(UniversalUser initiator) {
0388: this .initiator = initiator;
0389: }
0390:
0391: /**
0392: * Gets the initiator org code based on deptid.
0393: *
0394: * @return Returns the user.
0395: */
0396: public String getInitiatorOrgCode() {
0397: if (this .getInitiator() != null) {
0398: if (this .getInitiator().getModuleUser(ChartUser.MODULE_ID) != null) {
0399: return ((ChartUser) this .getInitiator().getModuleUser(
0400: ChartUser.MODULE_ID)).getOrganizationCode();
0401: } else {
0402: return SpringContext
0403: .getBean(ChartUserService.class)
0404: .getDefaultOrganizationCode(this .getInitiator());
0405: }
0406: }
0407: return "";
0408: }
0409:
0410: /**
0411: * @return Returns the newInstitutionCostShare.
0412: */
0413: public BudgetInstitutionCostShare getNewInstitutionCostShare() {
0414: return newInstitutionCostShare;
0415: }
0416:
0417: /**
0418: * @param newInstitutionCostShare The newInstitutionCostShare to set.
0419: */
0420: public void setNewInstitutionCostShare(
0421: BudgetInstitutionCostShare newInstitutionCostShare) {
0422: this .newInstitutionCostShare = newInstitutionCostShare;
0423: }
0424:
0425: /**
0426: * Gets the budgetTypeCodes attribute.
0427: *
0428: * @return Returns the list of budgetTypeCodes.
0429: */
0430: public List getBudgetTypeCodes() {
0431: return budgetTypeCodes;
0432: }
0433:
0434: /**
0435: * Sets the budgetTypeCodes attribute value.
0436: *
0437: * @param budgetTypes The budgetTypeCodes to set.
0438: */
0439: public void setBudgetTypeCodes(List budgetTypeCodes) {
0440: this .budgetTypeCodes = budgetTypeCodes;
0441: }
0442:
0443: /**
0444: * Gets the budgetTypeCode attribute.
0445: *
0446: * @return Returns the budgetTypeCode.
0447: */
0448: public BudgetTypeCode getBudgetTypeCode(int index) {
0449: while (getBudgetTypeCodes().size() <= index) {
0450: getBudgetTypeCodes().add(new BudgetTypeCode());
0451: }
0452: return (BudgetTypeCode) getBudgetTypeCodes().get(index);
0453: }
0454:
0455: /**
0456: * Gets the nonpersonnelCategories attribute.
0457: *
0458: * @return Returns the nonpersonnelCategories.
0459: */
0460: public List getNonpersonnelCategories() {
0461: return nonpersonnelCategories;
0462: }
0463:
0464: /**
0465: * Sets the nonpersonnelCategories attribute value.
0466: *
0467: * @param nonpersonnelCategories The nonpersonnelCategories to set.
0468: */
0469: public void setNonpersonnelCategories(List nonpersonnelCategories) {
0470: this .nonpersonnelCategories = nonpersonnelCategories;
0471: }
0472:
0473: /**
0474: * Gets the newNonpersonnel attribute.
0475: *
0476: * @return Returns the newNonpersonnel.
0477: */
0478: public NonpersonnelCategory getNonpersonnelCategory(int index) {
0479: while (getNonpersonnelCategories().size() <= index) {
0480: getNonpersonnelCategories().add(new NonpersonnelCategory());
0481: }
0482: return (NonpersonnelCategory) getNonpersonnelCategories().get(
0483: index);
0484: }
0485:
0486: public ActionErrors validate(ActionMapping mapping,
0487: HttpServletRequest request) {
0488: return super .validate(mapping, request);
0489: }
0490:
0491: /**
0492: * Gets the budgetOverviewFormHelper attribute.
0493: *
0494: * @return Returns the budgetOverviewFormHelper.
0495: */
0496: public BudgetOverviewFormHelper getBudgetOverviewFormHelper()
0497: throws Exception {
0498: if (budgetOverviewFormHelper == null) {
0499: budgetOverviewFormHelper = new BudgetOverviewFormHelper(
0500: this );
0501: }
0502: return budgetOverviewFormHelper;
0503: }
0504:
0505: /**
0506: * Sets the budgetOverviewFormHelper attribute value.
0507: *
0508: * @param budgetOverviewFormHelper The budgetOverviewFormHelper to set.
0509: */
0510: public void setBudgetOverviewFormHelper(
0511: BudgetOverviewFormHelper budgetOverviewFormHelper) {
0512: this .budgetOverviewFormHelper = budgetOverviewFormHelper;
0513: }
0514:
0515: /**
0516: * Gets the budgetNonpersonnelFormHelper attribute.
0517: *
0518: * @return Returns the budgetNonpersonnelFormHelper.
0519: */
0520: public BudgetNonpersonnelFormHelper getBudgetNonpersonnelFormHelper() {
0521: if (budgetNonpersonnelFormHelper == null) {
0522: budgetNonpersonnelFormHelper = new BudgetNonpersonnelFormHelper(
0523: this );
0524: }
0525: return budgetNonpersonnelFormHelper;
0526: }
0527:
0528: /**
0529: * Sets the budgetNonpersonnelFormHelper attribute value.
0530: *
0531: * @param budgetNonpersonnelFormHelper The budgetNonpersonnelFormHelper to set.
0532: */
0533: public void setBudgetNonpersonnelFormHelper(
0534: BudgetNonpersonnelFormHelper budgetNonpersonnelFormHelper) {
0535: this .budgetNonpersonnelFormHelper = budgetNonpersonnelFormHelper;
0536: }
0537:
0538: /**
0539: * Gets the budgetNonpersonnelCopyOverFormHelper attribute.
0540: *
0541: * @return Returns the budgetNonpersonnelCopyOverFormHelper.
0542: */
0543: public BudgetNonpersonnelCopyOverFormHelper getBudgetNonpersonnelCopyOverFormHelper() {
0544: return budgetNonpersonnelCopyOverFormHelper;
0545: }
0546:
0547: /**
0548: * Sets the budgetNonpersonnelCopyOverFormHelper attribute value.
0549: *
0550: * @param budgetNonpersonnelCopyOverFormHelper The budgetNonpersonnelCopyOverFormHelper to set.
0551: */
0552: public void setBudgetNonpersonnelCopyOverFormHelper(
0553: BudgetNonpersonnelCopyOverFormHelper budgetNonpersonnelCopyOverFormHelper) {
0554: this .budgetNonpersonnelCopyOverFormHelper = budgetNonpersonnelCopyOverFormHelper;
0555: }
0556:
0557: /**
0558: * Gets the deleteValues attribute.
0559: *
0560: * @return Returns the deleteValues.
0561: */
0562: public String[] getDeleteValues() {
0563: return deleteValues;
0564: }
0565:
0566: /**
0567: * Sets the deleteValues attribute value.
0568: *
0569: * @param deleteValues The deleteValues to set.
0570: */
0571: public void setDeleteValues(String[] deleteValues) {
0572: this .deleteValues = deleteValues;
0573: }
0574:
0575: /**
0576: * @return Returns the budgetCostShareFormHelper.
0577: */
0578: public BudgetCostShareFormHelper getBudgetCostShareFormHelper()
0579: throws Exception {
0580: if (budgetCostShareFormHelper == null) {
0581: budgetCostShareFormHelper = new BudgetCostShareFormHelper(
0582: this );
0583: }
0584: return budgetCostShareFormHelper;
0585: }
0586:
0587: /**
0588: * @param budgetCostShareFormHelper The budgetCostShareFormHelper to set.
0589: */
0590: public void setBudgetCostShareFormHelper(
0591: BudgetCostShareFormHelper budgetCostShareFormHelper) {
0592: this .budgetCostShareFormHelper = budgetCostShareFormHelper;
0593: }
0594:
0595: /**
0596: * @return Returns the currentPeriodNumber.
0597: */
0598: public Integer getCurrentPeriodNumber() {
0599: if (currentPeriodNumber == null) {
0600: currentPeriodNumber = SpringContext.getBean(
0601: BudgetPeriodService.class).getFirstBudgetPeriod(
0602: ((BudgetDocument) getDocument())
0603: .getDocumentNumber())
0604: .getBudgetPeriodSequenceNumber();
0605: }
0606: return currentPeriodNumber;
0607: }
0608:
0609: /**
0610: * @param currentPeriodNumber The currentPeriodNumber to set.
0611: */
0612: public void setCurrentPeriodNumber(Integer currentPeriodNumber) {
0613: this .currentPeriodNumber = currentPeriodNumber;
0614: }
0615:
0616: /**
0617: * @return Returns the currentTaskNumber.
0618: */
0619: public Integer getCurrentTaskNumber() {
0620: if (currentTaskNumber == null) {
0621: currentTaskNumber = SpringContext.getBean(
0622: BudgetTaskService.class).getFirstBudgetTask(
0623: ((BudgetDocument) getDocument())
0624: .getDocumentNumber())
0625: .getBudgetTaskSequenceNumber();
0626: }
0627: return currentTaskNumber;
0628: }
0629:
0630: /**
0631: * @param currentTaskNumber The currentTaskNumber to set.
0632: */
0633: public void setCurrentTaskNumber(Integer currentTaskNumber) {
0634: this .currentTaskNumber = currentTaskNumber;
0635: }
0636:
0637: /**
0638: * @return Returns the currentNonpersonnelCategoryCode.
0639: */
0640: public String getCurrentNonpersonnelCategoryCode() {
0641: return currentNonpersonnelCategoryCode;
0642: }
0643:
0644: /**
0645: * @param currentNonpersonnelCategoryCode The currentNonpersonnelCategoryCode to set.
0646: */
0647: public void setCurrentNonpersonnelCategoryCode(
0648: String currentNonpersonnelCategoryCode) {
0649: this .currentNonpersonnelCategoryCode = currentNonpersonnelCategoryCode;
0650: }
0651:
0652: /**
0653: * @see org.kuali.core.web.struts.form.KualiForm#getAdditionalDocInfo1()
0654: */
0655: public KeyLabelPair getAdditionalDocInfo1() {
0656: if (this .getBudgetDocument().getBudget()
0657: .isProjectDirectorToBeNamedIndicator()) {
0658: return new KeyLabelPair(
0659: "DataDictionary.Budget.attributes.budgetProjectDirectorUniversalIdentifier",
0660: TO_BE_NAMED_LABEL);
0661: } else if (this .getBudgetDocument().getBudget()
0662: .getProjectDirector() != null
0663: && this .getBudgetDocument().getBudget()
0664: .getProjectDirector().getUniversalUser() != null
0665: && this .getBudgetDocument().getBudget()
0666: .getProjectDirector().getUniversalUser()
0667: .getPersonUniversalIdentifier() != null) {
0668: return new KeyLabelPair(
0669: "DataDictionary.Budget.attributes.budgetProjectDirectorUniversalIdentifier",
0670: this .getBudgetDocument().getBudget()
0671: .getProjectDirector().getUniversalUser()
0672: .getPersonName());
0673: }
0674: return null;
0675: }
0676:
0677: /**
0678: * @see org.kuali.core.web.struts.form.KualiForm#getAdditionalDocInfo2()
0679: */
0680: public KeyLabelPair getAdditionalDocInfo2() {
0681: if (this .getBudgetDocument().getBudget()
0682: .isAgencyToBeNamedIndicator()) {
0683: return new KeyLabelPair(
0684: "DataDictionary.Budget.attributes.budgetAgency",
0685: TO_BE_NAMED_LABEL);
0686: } else if (this .getBudgetDocument().getBudget()
0687: .getBudgetAgency() != null) {
0688: return new KeyLabelPair(
0689: "DataDictionary.Budget.attributes.budgetAgency",
0690: this .getBudgetDocument().getBudget()
0691: .getBudgetAgency().getFullName());
0692: }
0693: return null;
0694: }
0695:
0696: /**
0697: * @see org.kuali.core.web.struts.form.KualiForm#setAdditionalDocInfo1(org.kuali.core.web.uidraw.KeyLabelPair)
0698: */
0699: public void setAdditionalDocInfo1(KeyLabelPair additionalDocInfo1) {
0700: // TODO Auto-generated method stub
0701: super .setAdditionalDocInfo1(additionalDocInfo1);
0702: }
0703:
0704: /**
0705: * @see org.kuali.core.web.struts.form.KualiForm#setAdditionalDocInfo2(org.kuali.core.web.uidraw.KeyLabelPair)
0706: */
0707: public void setAdditionalDocInfo2(KeyLabelPair additionalDocInfo2) {
0708: // TODO Auto-generated method stub
0709: super .setAdditionalDocInfo2(additionalDocInfo2);
0710: }
0711:
0712: /**
0713: * Gets the previousPeriodNumber attribute.
0714: *
0715: * @return Returns the previousPeriodNumber.
0716: */
0717: public Integer getPreviousPeriodNumber() {
0718: return previousPeriodNumber;
0719: }
0720:
0721: /**
0722: * Sets the previousPeriodNumber attribute value.
0723: *
0724: * @param previousPeriodNumber The previousPeriodNumber to set.
0725: */
0726: public void setPreviousPeriodNumber(Integer previousPeriodNumber) {
0727: this .previousPeriodNumber = previousPeriodNumber;
0728: }
0729:
0730: /**
0731: * Gets the previousTaskNumber attribute.
0732: *
0733: * @return Returns the previousTaskNumber.
0734: */
0735: public Integer getPreviousTaskNumber() {
0736: return previousTaskNumber;
0737: }
0738:
0739: /**
0740: * Sets the previousTaskNumber attribute value.
0741: *
0742: * @param previousTaskNumber The previousTaskNumber to set.
0743: */
0744: public void setPreviousTaskNumber(Integer previousTaskNumber) {
0745: this .previousTaskNumber = previousTaskNumber;
0746: }
0747:
0748: /**
0749: * Gets the appointmentTypeGridMappings attribute.
0750: *
0751: * @return Returns the appointmentTypeGridMappings.
0752: */
0753: public HashMap getAppointmentTypeGridMappings() {
0754: if (this .appointmentTypeGridMappings == null) {
0755: this .appointmentTypeGridMappings = SpringContext.getBean(
0756: BudgetPersonnelService.class)
0757: .getAppointmentTypeMappings();
0758: }
0759: return this .appointmentTypeGridMappings;
0760: }
0761:
0762: /**
0763: * This method sorts collections that are contained within the document/budget. this is only used for the UI, and thus occurs
0764: * vie the form
0765: */
0766: public void sortCollections() {
0767: Collections.sort(this .getBudgetDocument().getBudget()
0768: .getPersonnel());
0769: Collections.sort(this .getBudgetDocument().getBudget()
0770: .getGraduateAssistantRates());
0771:
0772: }
0773:
0774: public String getAcademicYearSubdivisionNamesString() {
0775: StringBuffer sb = new StringBuffer();
0776: for (Iterator iter = getAcademicYearSubdivisionNames()
0777: .iterator(); iter.hasNext();) {
0778: sb.append((String) iter.next());
0779: if (iter.hasNext()) {
0780: sb.append("-");
0781: }
0782: }
0783: return sb.toString();
0784: }
0785:
0786: public void setAcademicYearSubdivisionNamesString(String names) {
0787: setAcademicYearSubdivisionNames(Arrays.asList(names.split("-")));
0788: }
0789:
0790: /**
0791: * Gets the academicYearSubdivisionNames attribute.
0792: *
0793: * @return Returns the academicYearSubdivisionNames.
0794: */
0795: public List getAcademicYearSubdivisionNames() {
0796: return academicYearSubdivisionNames;
0797: }
0798:
0799: /**
0800: * Sets the academicYearSubdivisionNames attribute value.
0801: *
0802: * @param academicYearSubdivisionNames The academicYearSubdivisionNames to set.
0803: */
0804: public void setAcademicYearSubdivisionNames(
0805: List academicYearSubdivisionNames) {
0806: this .academicYearSubdivisionNames = academicYearSubdivisionNames;
0807: }
0808:
0809: /**
0810: * Gets the number of academic year subdivisions.
0811: *
0812: * @return Returns the number of academic year subdivisions.
0813: */
0814: public int getNumberOfAcademicYearSubdivisions() {
0815: return this .numberOfAcademicYearSubdivisions;
0816: }
0817:
0818: /**
0819: * Sets the numberOfAcademicYearSubdivisions attribute value.
0820: *
0821: * @param numberOfAcademicYearSubdivisions The numberOfAcademicYearSubdivisions to set.
0822: */
0823: public void setNumberOfAcademicYearSubdivisions(
0824: int numberOfAcademicYearSubdivisions) {
0825: this .numberOfAcademicYearSubdivisions = numberOfAcademicYearSubdivisions;
0826: }
0827:
0828: /**
0829: * @return Returns the newThirdPartyCostShare.
0830: */
0831: public BudgetThirdPartyCostShare getNewThirdPartyCostShare() {
0832: return newThirdPartyCostShare;
0833: }
0834:
0835: /**
0836: * @param newThirdPartyCostShare The newThirdPartyCostShare to set.
0837: */
0838: public void setNewThirdPartyCostShare(
0839: BudgetThirdPartyCostShare newThirdPartyCostShare) {
0840: this .newThirdPartyCostShare = newThirdPartyCostShare;
0841: }
0842:
0843: /**
0844: * Gets the newPersonnelType attribute.
0845: *
0846: * @return Returns the newPersonnelType.
0847: */
0848: public String getNewPersonnelType() {
0849: return newPersonnelType;
0850: }
0851:
0852: /**
0853: * Sets the newPersonnelType attribute value.
0854: *
0855: * @param newPersonnelType The newPersonnelType to set.
0856: */
0857: public void setNewPersonnelType(String newPersonnelType) {
0858: this .newPersonnelType = newPersonnelType;
0859: }
0860:
0861: public boolean isSupportsModular() {
0862: return supportsModular;
0863: }
0864:
0865: public void setSupportsModular(boolean supportsModular) {
0866: this .supportsModular = supportsModular;
0867: }
0868:
0869: public boolean isAuditActivated() {
0870: return auditActivated;
0871: }
0872:
0873: public void setAuditActivated(boolean auditActivated) {
0874: this .auditActivated = auditActivated;
0875: }
0876:
0877: /**
0878: * @return Returns the budgetIndirectCostFormHelper.
0879: */
0880: public BudgetIndirectCostFormHelper getBudgetIndirectCostFormHelper() {
0881: return budgetIndirectCostFormHelper;
0882: }
0883:
0884: /**
0885: * @param budgetIndirectCostFormHelper The budgetIndirectCostFormHelper to set.
0886: */
0887: public void setBudgetIndirectCostFormHelper(
0888: BudgetIndirectCostFormHelper budgetIndirectCostFormHelper) {
0889: this .budgetIndirectCostFormHelper = budgetIndirectCostFormHelper;
0890: }
0891:
0892: /**
0893: * Gets the currentOutputAgencyType attribute.
0894: *
0895: * @return Returns the currentOutputAgencyType.
0896: */
0897: public String getCurrentOutputAgencyType() {
0898: return currentOutputAgencyType;
0899: }
0900:
0901: /**
0902: * Sets the currentOutputAgencyType attribute value.
0903: *
0904: * @param currentOutputAgencyType The currentOutputAgencyType to set.
0905: */
0906: public void setCurrentOutputAgencyType(
0907: String currentOutputAgencyType) {
0908: this .currentOutputAgencyType = currentOutputAgencyType;
0909: }
0910:
0911: /**
0912: * Gets the currentOutputDetailLevel attribute.
0913: *
0914: * @return Returns the currentOutputDetailLevel.
0915: */
0916: public String getCurrentOutputDetailLevel() {
0917: return currentOutputDetailLevel;
0918: }
0919:
0920: /**
0921: * Sets the currentOutputDetailLevel attribute value.
0922: *
0923: * @param currentOutputDetailLevel The currentOutputDetailLevel to set.
0924: */
0925: public void setCurrentOutputDetailLevel(
0926: String currentOutputDetailLevel) {
0927: this .currentOutputDetailLevel = currentOutputDetailLevel;
0928: }
0929:
0930: /**
0931: * Gets the currentOutputReportType attribute.
0932: *
0933: * @return Returns the currentOutputReportType.
0934: */
0935: public String getCurrentOutputReportType() {
0936: return currentOutputReportType;
0937: }
0938:
0939: /**
0940: * Sets the currentOutputReportType attribute value.
0941: *
0942: * @param currentOutputReportType The currentOutputReportType to set.
0943: */
0944: public void setCurrentOutputReportType(
0945: String currentOutputReportType) {
0946: this .currentOutputReportType = currentOutputReportType;
0947: }
0948:
0949: /**
0950: * Gets the currentOutputAgencyPeriod attribute.
0951: *
0952: * @return Returns the currentOutputAgencyPeriod.
0953: */
0954: public String getCurrentOutputAgencyPeriod() {
0955: return currentOutputAgencyPeriod;
0956: }
0957:
0958: /**
0959: * Sets the currentOutputAgencyPeriod attribute value.
0960: *
0961: * @param currentOutputAgencyPeriod The currentOutputAgencyPeriod to set.
0962: */
0963: public void setCurrentOutputAgencyPeriod(
0964: String currentOutputAgencyPeriod) {
0965: this .currentOutputAgencyPeriod = currentOutputAgencyPeriod;
0966: }
0967:
0968: public boolean isDisplayCostSharePermission() {
0969: return displayCostSharePermission;
0970: }
0971:
0972: public void setDisplayCostSharePermission(
0973: boolean displayCostSharePermission) {
0974: this .displayCostSharePermission = displayCostSharePermission;
0975: }
0976:
0977: /**
0978: * This is a work around for a problem with html:multibox. See KULERA-835 for details. Essentially it appears that in Kuali
0979: * html:multibox doesn't handle string arrays correctly. It only handles the first element of a string array.
0980: *
0981: * @param projectTypeCode
0982: * @return
0983: */
0984: public String[] getSelectedBudgetTypesMultiboxFix(
0985: String budgetTypeCode) {
0986: String[] budgetTypes = this .getBudgetDocument().getBudget()
0987: .getBudgetTypeCodeArray();
0988:
0989: for (int i = 0; i < budgetTypes.length; i++) {
0990: String budgetType = (String) budgetTypes[i];
0991: if (budgetType.equals(budgetTypeCode)) {
0992: return new String[] { budgetTypeCode };
0993: }
0994: }
0995:
0996: // don't pass String[0], JSPs don't like that (exception)
0997: return new String[] { "" };
0998: }
0999:
1000: /**
1001: * @see org.kuali.module.kra.routingform.web.struts.form.RoutingForm#getSelectedBudgetTypesMultiboxFix(String)
1002: */
1003: public void setSelectedBudgetTypesMultiboxFix(String code,
1004: String[] something) {
1005: this.getBudgetDocument().getBudget().addBudgetTypeCode(code);
1006: }
1007: }
|