Package org.nuxeo.template.api.adapters
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 Summary
Modifier and TypeMethodDescriptionReturn the underlying adaptedDocumentModel
Retrieve parameters for the associated templategetSourceTemplate
(String templateName) Retrieve theTemplateSourceDocument
for a given template namegetSourceTemplateDoc
(String templateName) Retrieve the TemplateDocumentModel
for a given template namegetSourceTemplateDocRef
(String templateName) Retrieve the TemplateDocumentRef
for a given template nameList allTemplateSourceDocument
s that are bound to the underlyingDocumentModel
getTemplateBlob
(String templateName) Return theBlob
of the associated templategetTemplateNameForRendition
(String renditionName) Find the template associated to a given RenditionNameGet the names of all the associated templatesgetTemplateType
(String templateName) Return the template type for a given template nameboolean
hasEditableParams
(String templateName) Indicate of the associated Template has editable parameters or notboolean
Indicate of the associated Template requires parameters or notinitializeFromTemplate
(String templateName, boolean save) Initialize the template parameters from the associated templateremoveTemplateBinding
(String templateName, boolean save) Detach a template from the underlyingDocumentModel
renderAndStoreAsAttachment
(String templateName, boolean save) Render the named template against the underlying DocumentModel and store the result in the main BlobrenderWithTemplate
(String templateName) Render the named template against the underlying DocumentModelsaveParams
(String templateName, List<TemplateInput> params, boolean save) Save parameters changes.setTemplate
(DocumentModel template, boolean save) Associate the document to a Template.
-
Method Details
-
setTemplate
Associate the document to a Template.- Parameters:
template
- DocumentModel holding the templatesave
- flag to indicate if target DocumentModel must be saved or not- Returns:
- the updated DocumentModel
- Throws:
PropertyException
-
getSourceTemplate
Retrieve theTemplateSourceDocument
for a given template name- Parameters:
templateName
- name of the template- Returns:
- the
TemplateSourceDocument
-
getSourceTemplateDocRef
Retrieve the TemplateDocumentRef
for a given template name- Parameters:
templateName
- name of the template- Returns:
- the associated template
DocumentRef
-
getSourceTemplateDoc
Retrieve the TemplateDocumentModel
for a given template name- Parameters:
templateName
- name of the template- Returns:
- the associated template
DocumentModel
-
getSourceTemplates
List<TemplateSourceDocument> getSourceTemplates()List allTemplateSourceDocument
s that are bound to the underlyingDocumentModel
-
getTemplateType
Return the template type for a given template name -
initializeFromTemplate
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
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
Render the named template against the underlying DocumentModel- Returns:
- the resulting
Blob
-
hasParams
Indicate of the associated Template requires parameters or not -
getParams
Retrieve parameters for the associated template -
saveParams
Save parameters changes.- Parameters:
params
- the updated list of parameterssave
- flag to indicate if target DocumentModel must be saved or not
-
getAdaptedDoc
DocumentModel getAdaptedDoc()Return the underlying adaptedDocumentModel
-
getTemplateBlob
Return theBlob
of the associated template -
hasEditableParams
Indicate of the associated Template has editable parameters or not -
getTemplateNameForRendition
Find the template associated to a given RenditionName- Returns:
- the template name if any, null otherwise
-
getTemplateNames
Get the names of all the associated templates -
removeTemplateBinding
Detach a template from the underlyingDocumentModel
-