예제 #1
0
  /**
   * route the document using the document service
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return ActionForward
   * @throws Exception
   */
  @Override
  public ActionForward route(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    AwardBudgetDocument awardBudgetDocument = ((AwardBudgetForm) form).getAwardBudgetDocument();
    Award currentAward =
        getAwardBudgetService()
            .getActiveOrNewestAward(
                ((AwardDocument) awardBudgetDocument.getBudget().getBudgetParent().getDocument())
                    .getAward()
                    .getAwardNumber());
    ScaleTwoDecimal newCostLimit = getAwardBudgetService().getTotalCostLimit(currentAward);
    if (!newCostLimit.equals(awardBudgetDocument.getBudget().getTotalCostLimit())
        || !getAwardBudgetService()
            .limitsMatch(
                currentAward.getAwardBudgetLimits(),
                awardBudgetDocument.getAwardBudget().getAwardBudgetLimits())) {
      Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
      Object buttonClicked = request.getParameter(KRADConstants.QUESTION_CLICKED_BUTTON);
      String methodToCall = ((KualiForm) form).getMethodToCall();
      if (question == null) {
        ConfigurationService kualiConfiguration =
            CoreApiServiceLocator.getKualiConfigurationService();
        return confirm(
            buildParameterizedConfirmationQuestion(
                mapping,
                form,
                request,
                response,
                UPDATE_COST_LIMITS_QUESTION,
                KeyConstants.QUESTION_TOTALCOSTLIMIT_CHANGED),
            methodToCall,
            methodToCall);
      } else if (UPDATE_COST_LIMITS_QUESTION.equals(question)
          && ConfirmationQuestion.YES.equals(buttonClicked)) {
        getAwardBudgetService().setBudgetLimits(awardBudgetDocument, currentAward);
        return mapping.findForward(Constants.MAPPING_AWARD_BASIC);
      } else {
        // do nothing and continue with route
      }
    }
    ((AwardBudgetForm) form).setAuditActivated(true);
    ValidationState state =
        KcServiceLocator.getService(AuditHelper.class)
            .isValidSubmission((AwardBudgetForm) form, true);
    if (state != ValidationState.ERROR) {
      getAwardBudgetService().processSubmision(awardBudgetDocument);
      return super.route(mapping, form, request, response);
    } else {
      GlobalVariables.getMessageMap().clearErrorMessages();
      GlobalVariables.getMessageMap()
          .putError("datavalidation", KeyConstants.ERROR_WORKFLOW_SUBMISSION, new String[] {});

      return mapping.findForward(Constants.MAPPING_AWARD_BASIC);
    }
  }
예제 #2
0
  /**
   * Close the document and take the user back to the index; only after asking the user if they want
   * to save the document first. Only users who have the "canSave()" permission are given this
   * option.
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return ActionForward
   * @throws Exception
   */
  @Override
  public ActionForward close(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    KualiDocumentFormBase docForm = (KualiDocumentFormBase) form;
    // only want to prompt them to save if they already can save
    if (docForm.getDocumentActions().containsKey(KRADConstants.KUALI_ACTION_CAN_SAVE)) {
      Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
      ConfigurationService kualiConfiguration =
          CoreApiServiceLocator.getKualiConfigurationService();

      // logic for close question
      if (question == null) {
        // ask question if not already asked
        return this.performQuestionWithoutInput(
            mapping,
            form,
            request,
            response,
            KRADConstants.DOCUMENT_SAVE_BEFORE_CLOSE_QUESTION,
            kualiConfiguration.getPropertyValueAsString(
                RiceKeyConstants.QUESTION_SAVE_BEFORE_CLOSE),
            KRADConstants.CONFIRMATION_QUESTION,
            KRADConstants.MAPPING_CLOSE,
            "");
      } else {
        BudgetForm budgetForm = (BudgetForm) form;
        Budget budget = budgetForm.getBudgetDocument().getBudget();

        Object buttonClicked = request.getParameter(KRADConstants.QUESTION_CLICKED_BUTTON);
        if ((KRADConstants.DOCUMENT_SAVE_BEFORE_CLOSE_QUESTION.equals(question))
            && ConfirmationQuestion.YES.equals(buttonClicked)) {
          // if yes button clicked - save the doc
          getBudgetJustificationService().preSave(budget, getBudgetJusticationWrapper(form));
        }
        // else go to close logic below
      }
    }

    return super.close(mapping, form, request, response);
  }
예제 #3
0
  /** This method is for 'close' button. Confirmation of 'save' is performed. */
  public ActionForward close(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    MeetingFormBase meetingFormBase = (MeetingFormBase) form;
    MeetingFormBase meetingForm = meetingFormBase;
    Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
    if (question == null && meetingForm.getMeetingHelper().canModifySchedule()) {
      return performQuestionWithoutInput(
          mapping,
          form,
          request,
          response,
          CLOSE_QUESTION_ID,
          CLOSE_QUESTION,
          KRADConstants.CONFIRMATION_QUESTION,
          meetingFormBase.getMethodToCall(),
          "");
    } else if (meetingForm.getMeetingHelper().canModifySchedule()) {
      Object buttonClicked = request.getParameter(KRADConstants.QUESTION_CLICKED_BUTTON);
      if ((CLOSE_QUESTION_ID.equals(question)) && ConfirmationQuestion.YES.equals(buttonClicked)) {
        CommitteeScheduleBase committeeSchedule =
            meetingForm.getMeetingHelper().getCommitteeSchedule();
        if (isValidToSave(meetingFormBase.getMeetingHelper(), meetingFormBase.isReadOnly())) {
          meetingFormBase.getMeetingHelper().populateAttendancePreSave();
          getMeetingService()
              .saveMeetingDetails(
                  committeeSchedule, meetingFormBase.getMeetingHelper().getDeletedBos());
          meetingFormBase.getMeetingHelper().initDeletedList();
        } else {
          return mapping.findForward(Constants.MAPPING_BASIC);
        }
      }
    }

    return mapping.findForward(KRADConstants.MAPPING_PORTAL);
  }
  /**
   * If there are active delegates of an "inactivated" role member, return an ActionForward to
   * prompt the user letting them know that the delegates will be "inactivated" too if they proceed.
   *
   * <p>Also, if the user has already responded to the question and the response was (1) "Yes", then
   * return null, signifying that we can go ahead and take the needed action to "inactivate" the
   * delegates; or (2) "No", then return a basic forward that will cancel further action.
   */
  private ActionForward getAffectedDelegatesQuestionActionForward(
      List<RoleDocumentDelegationMember> activeDelegatesOfInactiveRoleMembers,
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      IdentityManagementRoleDocumentForm roleDocumentForm)
      throws Exception {

    if (activeDelegatesOfInactiveRoleMembers.size() > 0) {
      Object question = getQuestion(request);
      // logic for delegates question
      if (question == null || !REMOVE_AFFECTED_DELEGATES_QUESTION_ID.equals(question)) {
        return performQuestionWithoutInput(
            mapping,
            form,
            request,
            response,
            REMOVE_AFFECTED_DELEGATES_QUESTION_ID,
            getKualiConfigurationService()
                .getPropertyValueAsString(
                    RiceKeyConstants.QUESTION_ACTIVE_DELEGATES_FOR_INACTIVE_MEMBERS),
            KRADConstants.CONFIRMATION_QUESTION,
            roleDocumentForm.getMethodToCall(),
            StringUtils.EMPTY);
      }
      Object buttonClicked = request.getParameter(KRADConstants.QUESTION_CLICKED_BUTTON);
      if ((REMOVE_AFFECTED_DELEGATES_QUESTION_ID.equals(question))
          && ConfirmationQuestion.YES.equals(buttonClicked)) {
        // the question was answered in the affirmative.
        // fall through, no special mapping to return
      } else {
        // NO was clicked ... what to do?  Return basic mapping without "inactivating" anything
        return mapping.findForward(RiceConstants.MAPPING_BASIC);
      }
    }

    return null;
  }