/** * Checks that at least one reason code is selected and stores the selection settings. If no * reason code is selected, an error message is displayed to the user. * * @param reasonCodePickList - List of BudgetConstructionReasonCodePick objects to check * @return boolean - true if there was a selection and the list was saved, otherwise false */ protected boolean storedSelectedReasonCodes( List<BudgetConstructionReasonCodePick> reasonCodePickList) { boolean foundSelected = false; // check to see if at least one pullflag is set and store the selectFlag settings for currently // displayed set of reason // codes for (BudgetConstructionReasonCodePick budgetConstructionReasonCodePick : reasonCodePickList) { if (budgetConstructionReasonCodePick.getSelectFlag() > 0) { foundSelected = true; } } // if selection was found, save the reason code selections, otherwise build error message if (foundSelected) { SpringContext.getBean(BudgetReportsControlListService.class) .updateReasonCodeSelectFlags(reasonCodePickList); } else { GlobalVariables.getMessageMap() .putError( KFSConstants.GLOBAL_ERRORS, BCKeyConstants.ERROR_BUDGET_REASON_CODE_NOT_SELECTED); } return foundSelected; }
/** Unselects all reason codes. */ public ActionForward unselectAllReasonCodes( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { OrganizationReportSelectionForm organizationReportSelectionForm = (OrganizationReportSelectionForm) form; for (BudgetConstructionReasonCodePick budgetConstructionReasonCodePick : organizationReportSelectionForm.getReasonCodePickList()) { budgetConstructionReasonCodePick.setSelectFlag(new Integer(0)); } return mapping.findForward(KFSConstants.MAPPING_BASIC); }