Interface TemplateBasedDocument

All Known Implementing Classes:
TemplateBasedDocumentAdapterImpl

public interface TemplateBasedDocument
Adapter interface for the DocumentModel that support rendering via a Template. This Document can be associated with a TemplateSourceDocument that provides the rendering template as well as the default inputs used for rendering.
Author:
Tiry ([email protected])
  • Method Details

    • setTemplate

      DocumentModel setTemplate(DocumentModel template, boolean save) throws PropertyException
      Associate the document to a Template.
      Parameters:
      template - DocumentModel holding the template
      save - flag to indicate if target DocumentModel must be saved or not
      Returns:
      the updated DocumentModel
      Throws:
      PropertyException
    • getSourceTemplate

      TemplateSourceDocument getSourceTemplate(String templateName)
      Retrieve the TemplateSourceDocument for a given template name
      Parameters:
      templateName - name of the template
      Returns:
      the TemplateSourceDocument
    • getSourceTemplateDocRef

      DocumentRef getSourceTemplateDocRef(String templateName)
      Retrieve the Template DocumentRef for a given template name
      Parameters:
      templateName - name of the template
      Returns:
      the associated template DocumentRef
    • getSourceTemplateDoc

      DocumentModel getSourceTemplateDoc(String templateName)
      Retrieve the Template DocumentModel for a given template name
      Parameters:
      templateName - name of the template
      Returns:
      the associated template DocumentModel
    • getSourceTemplates

      List<TemplateSourceDocument> getSourceTemplates()
      List all TemplateSourceDocuments that are bound to the underlying DocumentModel
    • getTemplateType

      String getTemplateType(String templateName)
      Return the template type for a given template name
    • initializeFromTemplate

      DocumentModel initializeFromTemplate(String templateName, boolean save)
      Initialize the template parameters from the associated template
      Parameters:
      save - flag to indicate if target DocumentModel must be saved or not
      Returns:
      the updated DocumentModel
    • renderAndStoreAsAttachment

      Blob renderAndStoreAsAttachment(String templateName, boolean save)
      Render the named template against the underlying DocumentModel and store the result in the main Blob
      Parameters:
      save - flag to indicate if target DocumentModel must be saved or not
      Returns:
      the resulting Blob
    • renderWithTemplate

      Blob renderWithTemplate(String templateName)
      Render the named template against the underlying DocumentModel
      Returns:
      the resulting Blob
    • hasParams

      boolean hasParams(String templateName)
      Indicate of the associated Template requires parameters or not
    • getParams

      List<TemplateInput> getParams(String templateName)
      Retrieve parameters for the associated template
    • saveParams

      DocumentModel saveParams(String templateName, List<TemplateInput> params, boolean save)
      Save parameters changes.
      Parameters:
      params - the updated list of parameters
      save - flag to indicate if target DocumentModel must be saved or not
    • getAdaptedDoc

      DocumentModel getAdaptedDoc()
      Return the underlying adapted DocumentModel
    • getTemplateBlob

      Blob getTemplateBlob(String templateName)
      Return the Blob of the associated template
    • hasEditableParams

      boolean hasEditableParams(String templateName)
      Indicate of the associated Template has editable parameters or not
    • getTemplateNameForRendition

      String getTemplateNameForRendition(String renditionName)
      Find the template associated to a given RenditionName
      Returns:
      the template name if any, null otherwise
    • getTemplateNames

      List<String> getTemplateNames()
      Get the names of all the associated templates
    • removeTemplateBinding

      DocumentModel removeTemplateBinding(String templateName, boolean save)
      Detach a template from the underlying DocumentModel