コード例 #1
0
 /**
  * This method generates the required report and returns the PDF stream as {@link
  * AttachmentDataSource}. It first identifies the report type to be printed, then fetches the
  * required report generator. The report generator generates XML which is then passed to {@link
  * PrintingService} for transforming into PDF.
  *
  * @param proposalDocument proposal data using which report is generated
  * @param reportName report to be generated
  * @param reportParameters {@link Map} of parameters required for report generation
  * @return {@link AttachmentDataSource} which contains the byte array of the generated PDF
  * @throws PrintingException if any errors occur during report generation
  */
 public AttachmentDataSource printInstitutionalProposalReport(
     KcPersistableBusinessObjectBase institutionalProposal,
     String reportName,
     Map<String, Object> reportParameters)
     throws PrintingException {
   AttachmentDataSource source = null;
   AbstractPrint printable = null;
   if (reportName.equals(
       InstitutionalProposalPrintType.INSTITUTIONAL_PROPOSAL_REPORT
           .getInstitutionalProposalPrintType())) {
     printable = getInstitutionalProposalPrint();
   }
   printable.setPrintableBusinessObject(institutionalProposal);
   printable.setReportParameters(reportParameters);
   source = getPrintingService().print(printable);
   return source;
 }
  @Override
  public List<Printable> getCorrespondencePrintable(
      KcPersistableBusinessObjectBase printableBusinessObject,
      List<CorrespondencePrintOption> correspondenceToPrint) {
    List<Printable> printables = new ArrayList<Printable>();
    for (CorrespondencePrintOption printOption : correspondenceToPrint) {
      if (printOption.isSelected()) {
        AbstractPrint printable = new CorrespondencePrint();
        printable.setXmlStream(getCorrespondencePrint().getXmlStream());
        Map<String, Object> reportParameters = new HashMap<String, Object>();
        if (printOption.getScheduleId() != null) {
          reportParameters.put("scheduleId", printOption.getScheduleId());
        }

        reportParameters.put("correspondenceId", "1");
        if (ObjectUtils.isNotNull(printOption.getProtocolCorrespondenceTemplate())) {
          reportParameters.put(
              "template",
              printOption.getProtocolCorrespondenceTemplate().getCorrespondenceTemplate());
        }
        //  will be used by amendcorrespondence
        reportParameters.put("moduleSubItemCode", printOption.getSubItemCode());
        if (CoeusSubModule.PROTOCOL_SUBMISSION.equals(printOption.getSubItemCode())) {
          reportParameters.put(PROTOCOL_NUMBER, printOption.getItemKey());
          reportParameters.put(SUBMISSION_NUMBER, printOption.getSubItemKey());
        }

        if (printable != null) {
          printable.setPrintableBusinessObject(printableBusinessObject);
          printable.setReportParameters(reportParameters);
          printables.add(printable);
        }
      }
    }
    return printables;
  }
コード例 #3
0
 @Autowired
 @Qualifier("industrialCumBudgetXmlStream")
 @Override
 public void setXmlStream(XmlStream budgetTotalXmlStream) {
   super.setXmlStream(budgetTotalXmlStream);
 }