Beispiel #1
0
 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);
 }
Beispiel #2
0
 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);
 }