Example #1
0
  /**
   * This method is used for the printing of forms in PDF format. It generates PDF forms and puts it
   * into {@link AttachmentDataSource}
   *
   * @param pdDoc(ProposalDevelopmentDocument)
   * @return {@link AttachmentDataSource} which contains all information related to the generated
   *     PDF
   * @throws
   * @throws S2SException
   * @see
   *     org.kuali.kra.s2s.service.PrintService#printForm(org.kuali.kra.proposaldevelopment.document.ProposalDevelopmentDocument)
   */
  public org.kuali.kra.proposaldevelopment.bo.AttachmentDataSource printForm(
      ProposalDevelopmentDocument pdDoc) throws S2SException, PrintingException {
    List<Printable> printableList = null;
    S2sAppSubmission s2sAppSubmission = getLatestS2SAppSubmission(pdDoc);
    if (s2sAppSubmission != null && s2sAppSubmission.getGgTrackingId() != null) {
      printableList = getSubmittedPDFStream(pdDoc);
    } else {
      printableList = getPDFStream(pdDoc);
    }
    if (pdDoc.getDevelopmentProposal().getGrantsGovSelectFlag()) {

      return null;
    }
    AttachmentDataSource attachmentDataSource = printingService.print(printableList);
    attachmentDataSource.setFileName(getFileNameForFormPrinting(pdDoc));
    return attachmentDataSource;
  }
 /**
  * @see
  *     org.kuali.kra.questionnaire.print.QuestionnairePrintingService#printQuestionnaireAnswer(KewPersistableBusinessObjectBase,
  *     java.util.Map)
  */
 public AttachmentDataSource printQuestionnaireAnswer(
     KraPersistableBusinessObjectBase printableBusinessObject,
     Map<String, Object> reportParameters)
     throws PrintingException {
   AttachmentDataSource source = null;
   AbstractPrint printable = getQuestionnairePrint();
   if (printable != null) {
     printable.setPrintableBusinessObject(printableBusinessObject);
     printable.setReportParameters(reportParameters);
     source = getPrintingService().print(printable);
     source.setFileName(
         "QuestionnaireAnswer"
             + reportParameters.get("questionnaireId")
             + Constants.PDF_FILE_EXTENSION);
     source.setContentType(Constants.PDF_REPORT_CONTENT_TYPE);
   }
   return source;
 }
 /**
  * @see
  *     org.kuali.kra.questionnaire.print.QuestionnairePrintingService#printQuestionnaire(org.kuali.kra.document.ResearchDocumentBase,
  *     java.util.Map)
  */
 public AttachmentDataSource printQuestionnaire(
     KraPersistableBusinessObjectBase printableBusinessObject,
     Map<String, Object> reportParameters)
     throws PrintingException {
   /* TODO : Questionnaire is a maintenance document.  questionnaireId is generated when document is approved and
    *   saved to DB. so, pk is not in doc xml content, and passing questionnaireid will not work.
    *   Therefore, passing documentNumber, questionnaire can be retrieved from xml content by loaddocument.
    *   This is what I think how offshore team can get questionnaire data to generate pdf.
    */
   AttachmentDataSource source = null;
   AbstractPrint printable = getQuestionnairePrint();
   if (printable != null) {
     printable.setPrintableBusinessObject(printableBusinessObject);
     printable.setReportParameters(reportParameters);
     source = getPrintingService().print(printable);
     source.setFileName(
         "Questionnaire-" + reportParameters.get("documentNumber") + Constants.PDF_FILE_EXTENSION);
     source.setContentType(Constants.PDF_REPORT_CONTENT_TYPE);
   }
   return source;
 }