Package org.nuxeo.template.api.adapters
Interface TemplateBasedDocument
-
- All Known Implementing Classes:
TemplateBasedDocumentAdapterImpl
public interface TemplateBasedDocumentAdapter interface for theDocumentModelthat support rendering via a Template. This Document can be associated with aTemplateSourceDocumentthat provides the rendering template as well as the default inputs used for rendering.- Author:
- Tiry ([email protected])
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DocumentModelgetAdaptedDoc()Return the underlying adaptedDocumentModelList<TemplateInput>getParams(String templateName)Retrieve parameters for the associated templateTemplateSourceDocumentgetSourceTemplate(String templateName)Retrieve theTemplateSourceDocumentfor a given template nameDocumentModelgetSourceTemplateDoc(String templateName)Retrieve the TemplateDocumentModelfor a given template nameDocumentRefgetSourceTemplateDocRef(String templateName)Retrieve the TemplateDocumentReffor a given template nameList<TemplateSourceDocument>getSourceTemplates()List allTemplateSourceDocuments that are bound to the underlyingDocumentModelBlobgetTemplateBlob(String templateName)Return theBlobof the associated templateStringgetTemplateNameForRendition(String renditionName)Find the template associated to a given RenditionNameList<String>getTemplateNames()Get the names of all the associated templatesStringgetTemplateType(String templateName)Return the template type for a given template namebooleanhasEditableParams(String templateName)Indicate of the associated Template has editable parameters or notbooleanhasParams(String templateName)Indicate of the associated Template requires parameters or notDocumentModelinitializeFromTemplate(String templateName, boolean save)Initialize the template parameters from the associated templateDocumentModelremoveTemplateBinding(String templateName, boolean save)Detach a template from the underlyingDocumentModelBlobrenderAndStoreAsAttachment(String templateName, boolean save)Render the named template against the underlying DocumentModel and store the result in the main BlobBlobrenderWithTemplate(String templateName)Render the named template against the underlying DocumentModelDocumentModelsaveParams(String templateName, List<TemplateInput> params, boolean save)Save parameters changes.DocumentModelsetTemplate(DocumentModel template, boolean save)Associate the document to a Template.
-
-
-
Method Detail
-
setTemplate
DocumentModel setTemplate(DocumentModel template, boolean save) throws PropertyException
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
TemplateSourceDocument getSourceTemplate(String templateName)
Retrieve theTemplateSourceDocumentfor a given template name- Parameters:
templateName- name of the template- Returns:
- the
TemplateSourceDocument
-
getSourceTemplateDocRef
DocumentRef getSourceTemplateDocRef(String templateName)
Retrieve the TemplateDocumentReffor a given template name- Parameters:
templateName- name of the template- Returns:
- the associated template
DocumentRef
-
getSourceTemplateDoc
DocumentModel getSourceTemplateDoc(String templateName)
Retrieve the TemplateDocumentModelfor a given template name- Parameters:
templateName- name of the template- Returns:
- the associated template
DocumentModel
-
getSourceTemplates
List<TemplateSourceDocument> getSourceTemplates()
List allTemplateSourceDocuments that are bound to the underlyingDocumentModel
-
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 parameterssave- flag to indicate if target DocumentModel must be saved or not
-
getAdaptedDoc
DocumentModel getAdaptedDoc()
Return the underlying adaptedDocumentModel
-
getTemplateBlob
Blob getTemplateBlob(String templateName)
Return theBlobof 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
-
removeTemplateBinding
DocumentModel removeTemplateBinding(String templateName, boolean save)
Detach a template from the underlyingDocumentModel
-
-