Package org.nuxeo.template.api.adapters
Interface TemplateBasedDocument
-
- All Known Implementing Classes:
TemplateBasedDocumentAdapterImpl
public interface TemplateBasedDocument
Adapter interface for theDocumentModel
that support rendering via a Template. This Document can be associated with aTemplateSourceDocument
that 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 DocumentModel
getAdaptedDoc()
Return the underlying adaptedDocumentModel
List<TemplateInput>
getParams(String templateName)
Retrieve parameters for the associated templateTemplateSourceDocument
getSourceTemplate(String templateName)
Retrieve theTemplateSourceDocument
for a given template nameDocumentModel
getSourceTemplateDoc(String templateName)
Retrieve the TemplateDocumentModel
for a given template nameDocumentRef
getSourceTemplateDocRef(String templateName)
Retrieve the TemplateDocumentRef
for a given template nameList<TemplateSourceDocument>
getSourceTemplates()
List allTemplateSourceDocument
s that are bound to the underlyingDocumentModel
Blob
getTemplateBlob(String templateName)
Return theBlob
of the associated templateString
getTemplateNameForRendition(String renditionName)
Find the template associated to a given RenditionNameList<String>
getTemplateNames()
Get the names of all the associated templatesString
getTemplateType(String templateName)
Return the template type for a given template nameboolean
hasEditableParams(String templateName)
Indicate of the associated Template has editable parameters or notboolean
hasParams(String templateName)
Indicate of the associated Template requires parameters or notDocumentModel
initializeFromTemplate(String templateName, boolean save)
Initialize the template parameters from the associated templateDocumentModel
removeTemplateBinding(String templateName, boolean save)
Detach a template from the underlyingDocumentModel
Blob
renderAndStoreAsAttachment(String templateName, boolean save)
Render the named template against the underlying DocumentModel and store the result in the main BlobBlob
renderWithTemplate(String templateName)
Render the named template against the underlying DocumentModelDocumentModel
saveParams(String templateName, List<TemplateInput> params, boolean save)
Save parameters changes.DocumentModel
setTemplate(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 theTemplateSourceDocument
for a given template name- Parameters:
templateName
- name of the template- Returns:
- the
TemplateSourceDocument
-
getSourceTemplateDocRef
DocumentRef getSourceTemplateDocRef(String templateName)
Retrieve the TemplateDocumentRef
for a given template name- Parameters:
templateName
- name of the template- Returns:
- the associated template
DocumentRef
-
getSourceTemplateDoc
DocumentModel getSourceTemplateDoc(String templateName)
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
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 theBlob
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
-
removeTemplateBinding
DocumentModel removeTemplateBinding(String templateName, boolean save)
Detach a template from the underlyingDocumentModel
-
-