コード例 #1
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
 public ActionForward delete(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BudgetForm budgetForm = (BudgetForm) form;
   AwardBudgetDocument awardBudgetDocument = budgetForm.getBudgetDocument();
   int selectedLineNumber = getSelectedLine(request);
   BudgetSubAwards subAward =
       awardBudgetDocument.getBudget().getBudgetSubAwards().get(selectedLineNumber);
   for (BudgetPeriod period : awardBudgetDocument.getBudget().getBudgetPeriods()) {
     Iterator<BudgetLineItem> iter = period.getBudgetLineItems().iterator();
     while (iter.hasNext()) {
       BudgetLineItem item = iter.next();
       if (org.apache.commons.lang3.ObjectUtils.equals(
           subAward.getSubAwardNumber(), item.getSubAwardNumber())) {
         iter.remove();
       }
     }
   }
   awardBudgetDocument.getBudget().getBudgetSubAwards().remove(selectedLineNumber);
   Collections.sort(awardBudgetDocument.getBudget().getBudgetSubAwards());
   return mapping.findForward(Constants.MAPPING_BASIC);
 }
コード例 #2
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
 public ActionForward addSubAward(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BudgetForm budgetForm = (BudgetForm) form;
   AwardBudgetDocument awardBudgetDocument = budgetForm.getBudgetDocument();
   BudgetSubAwards newBudgetSubAward = budgetForm.getNewSubAward();
   newBudgetSubAward.setBudgetId(awardBudgetDocument.getBudget().getBudgetId());
   newBudgetSubAward.setSubAwardNumber(generateSubAwardNumber(awardBudgetDocument));
   newBudgetSubAward.setBudgetVersionNumber(
       awardBudgetDocument.getBudget().getBudgetVersionNumber());
   newBudgetSubAward.setSubAwardStatusCode(1);
   newBudgetSubAward.getBudgetSubAwardPeriodDetails().clear();
   for (BudgetPeriod period : awardBudgetDocument.getBudget().getBudgetPeriods()) {
     newBudgetSubAward
         .getBudgetSubAwardPeriodDetails()
         .add(new BudgetSubAwardPeriodDetail(newBudgetSubAward, period));
   }
   boolean success = true;
   if (newBudgetSubAward.getNewSubAwardFile() != null) {
     String fileName = newBudgetSubAward.getNewSubAwardFile().getOriginalFilename();
     byte[] fileData = newBudgetSubAward.getNewSubAwardFile().getBytes();
     success =
         updateBudgetAttachment(
             budgetForm.getBudget(), newBudgetSubAward, fileName, fileData, "newSubAward");
   }
   String contentType = newBudgetSubAward.getNewSubAwardFile().getContentType();
   if (success && contentType.equalsIgnoreCase(Constants.PDF_REPORT_CONTENT_TYPE)) {
     budgetForm.setNewSubAward(new BudgetSubAwards());
     awardBudgetDocument.getBudget().getBudgetSubAwards().add(newBudgetSubAward);
   }
   return mapping.findForward(Constants.MAPPING_BASIC);
 }
コード例 #3
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
  /**
   * 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);
    }
  }
コード例 #4
0
 public boolean isAuthorized(String userId, Task task) {
   AwardBudgetTask budgetTask = (AwardBudgetTask) task;
   AwardBudgetDocument budgetDocument = budgetTask.getAwardBudgetDocument();
   return !budgetDocument.isViewOnly()
       && !kraWorkflowService.isInWorkflow(budgetDocument)
       && hasUnitPermission(
           userId,
           budgetDocument.getLeadUnitNumber(),
           Constants.MODULE_NAMESPACE_AWARD_BUDGET,
           AwardPermissionConstants.MODIFY_AWARD_BUDGET.getAwardPermission());
 }
コード例 #5
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
 public ActionForward deleteSubAwardAttachment(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BudgetForm budgetForm = (BudgetForm) form;
   AwardBudgetDocument awardBudgetDocument = budgetForm.getBudgetDocument();
   int selectedLineNumber = getSelectedLine(request);
   BudgetSubAwards subAward =
       awardBudgetDocument.getBudget().getBudgetSubAwards().get(selectedLineNumber);
   getPropDevBudgetSubAwardService().removeSubAwardAttachment(subAward);
   return mapping.findForward(Constants.MAPPING_BASIC);
 }
コード例 #6
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
 public ActionForward syncFromBudgetAttachment(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BudgetForm budgetForm = (BudgetForm) form;
   AwardBudgetDocument awardBudgetDocument = budgetForm.getBudgetDocument();
   BudgetSubAwards subAward = getSelectedBudgetSubAward(form, request);
   String errorPath =
       SUBAWARD_BUDGET_EDIT_LINE_STARTER
           + getSelectedLine(request)
           + SUBAWARD_BUDGET_EDIT_LINE_ENDER;
   GlobalVariables.getMessageMap().addToErrorPath(errorPath);
   updateSubAwardBudgetDetails(awardBudgetDocument.getBudget(), subAward);
   GlobalVariables.getMessageMap().removeFromErrorPath(errorPath);
   return mapping.findForward(Constants.MAPPING_BASIC);
 }
コード例 #7
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
  /**
   * Cancel that calls superUserCancel if the document is in route and the current user is the
   * routed by user of the document.
   *
   * @see
   *     org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#cancel(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward cancel(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    AwardBudgetDocument awardBudgetDocument = ((AwardBudgetForm) form).getAwardBudgetDocument();
    WorkflowDocument workflowDoc = awardBudgetDocument.getDocumentHeader().getWorkflowDocument();
    if (workflowDoc.isEnroute()
        && StringUtils.equals(
            GlobalVariables.getUserSession().getPrincipalId(),
            workflowDoc.getRoutedByPrincipalId())) {
      workflowDoc.superUserCancel("Cancelled by Routed By User");
      return mapping.findForward(Constants.MAPPING_BASIC);
    } else {
      return super.cancel(mapping, form, request, response);
    }
  }
コード例 #8
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
 public ActionForward updateBudgetAttachment(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BudgetForm budgetForm = (BudgetForm) form;
   AwardBudgetDocument awardBudgetDocument = budgetForm.getBudgetDocument();
   BudgetSubAwards subAward = getSelectedBudgetSubAward(form, request);
   byte[] subAwardData = subAward.getNewSubAwardFile().getBytes();
   String subAwardFileName = subAward.getNewSubAwardFile().getOriginalFilename();
   updateBudgetAttachment(
       budgetForm.getBudget(),
       subAward,
       subAwardFileName,
       subAwardData,
       SUBAWARD_BUDGET_EDIT_LINE_STARTER
           + getSelectedLine(request)
           + SUBAWARD_BUDGET_EDIT_LINE_ENDER);
   Collections.sort(awardBudgetDocument.getBudget().getBudgetSubAwards());
   return mapping.findForward(Constants.MAPPING_BASIC);
 }
コード例 #9
0
ファイル: BudgetActionsAction.java プロジェクト: kuali/kc
 private Integer generateSubAwardNumber(AwardBudgetDocument awardBudgetDocument) {
   return awardBudgetDocument.getHackedDocumentNextValue("subAwardNumber") != null
       ? awardBudgetDocument.getHackedDocumentNextValue("subAwardNumber")
       : 1;
 }