Class PrintTemplateUtil

java.lang.Object
com.ssgllc.fish.service.util.published.PrintTemplateUtil

@Component public final class PrintTemplateUtil extends Object
  • Constructor Details

    • PrintTemplateUtil

      public PrintTemplateUtil()
  • Method Details

    • generateDocument

      public static com.ssgllc.fish.document.GeneratedDoc generateDocument(String printTemplateName, String entityId, Map<String,Object> formData, String taskInstanceId, String type, Instant asOfDate) throws Exception
      Generates a document based on the specified print template, entity data, and other parameters. Note that the entity and field permissions are not checked for the current user and the document is generated with super user permissions


      Example:
      def formData = [field1: "value1", field2: "value2"]
      def doc = printTemplateUtil.generateDocument("PersonTemplate", "c0a83801-655d-13e2-8191-9067f826208c", [:], null, "docx", dateUtil.startOfToday())
      return bpmUtil.createProcessDocFromGeneratedDoc(doc, execution.processInstanceId)

      Returns:
      A generated DOCX document based on the "PersonTemplate" for the entity with the specified id.
      Parameters:
      printTemplateName - The name of the print template to be used.
      entityId - The ID of the entity for which the document is generated.
      formData - A map of form data used as input for the print template.
      taskInstanceId - The ID of the task instance associated with the document generation.
      type - The type of document to generate ("pdf", "docx", or "report").
      asOfDate - The date for fetching entity data as of a particular moment in time, if applicable.
      Returns:
      A GeneratedDoc object containing the generated document, or null if the document could not be generated.
      Throws:
      NoSuchMethodException - If a required method for document generation is not found.
      IOException - If an I/O error occurs during document generation.
      Exception