Package org.nuxeo.template.adapters.doc
Class TemplateBasedDocumentAdapterImpl
java.lang.Object
org.nuxeo.template.adapters.AbstractTemplateDocument
org.nuxeo.template.adapters.doc.TemplateBasedDocumentAdapterImpl
- All Implemented Interfaces:
Serializable
,TemplateBasedDocument
public class TemplateBasedDocumentAdapterImpl
extends AbstractTemplateDocument
implements Serializable, TemplateBasedDocument
Default implementation of
TemplateBasedDocument
adapter. This adapter mainly expect from the underlying
DocumentModel
to have the "TemplateBased" facet- Author:
- Tiry ([email protected])
- See Also:
-
Field Summary
Fields inherited from class org.nuxeo.template.adapters.AbstractTemplateDocument
adaptedDoc
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doSave()
protected OutputFormatDescriptor
getOutputFormatDescriptor
(String outputFormat) 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 templatesprotected TemplateProcessor
getTemplateProcessor
(String templateName) 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
Indicate of the associated Template requires parameters or notinitializeFromTemplate
(boolean save) initializeFromTemplate
(String templateName, boolean save) Initialize the template parameters from the associated templateprotected OperationContext
initOperationContext
(Blob blob, String templateName) boolean
removeTemplateBinding
(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.protected void
setTemplate
(DocumentModel template, boolean save) Associate the document to a Template.Methods inherited from class org.nuxeo.template.adapters.AbstractTemplateDocument
getAdaptedDoc, getSession, save
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.template.api.adapters.TemplateBasedDocument
getAdaptedDoc
-
Field Details
-
TEMPLATEBASED_FACET
- See Also:
-
bindings
-
-
Constructor Details
-
TemplateBasedDocumentAdapterImpl
-
-
Method Details
-
setTemplate
Description copied from interface:TemplateBasedDocument
Associate the document to a Template.- Specified by:
setTemplate
in interfaceTemplateBasedDocument
- Parameters:
template
- DocumentModel holding the templatesave
- flag to indicate if target DocumentModel must be saved or not- Returns:
- the updated DocumentModel
-
removeTemplateBinding
Description copied from interface:TemplateBasedDocument
Detach a template from the underlyingDocumentModel
- Specified by:
removeTemplateBinding
in interfaceTemplateBasedDocument
-
getSourceTemplate
Description copied from interface:TemplateBasedDocument
Retrieve theTemplateSourceDocument
for a given template name- Specified by:
getSourceTemplate
in interfaceTemplateBasedDocument
- Parameters:
templateName
- name of the template- Returns:
- the
TemplateSourceDocument
-
getSourceTemplateDocRef
Description copied from interface:TemplateBasedDocument
Retrieve the TemplateDocumentRef
for a given template name- Specified by:
getSourceTemplateDocRef
in interfaceTemplateBasedDocument
- Parameters:
templateName
- name of the template- Returns:
- the associated template
DocumentRef
-
getSourceTemplateDoc
Description copied from interface:TemplateBasedDocument
Retrieve the TemplateDocumentModel
for a given template name- Specified by:
getSourceTemplateDoc
in interfaceTemplateBasedDocument
- Parameters:
templateName
- name of the template- Returns:
- the associated template
DocumentModel
-
getSourceTemplates
Description copied from interface:TemplateBasedDocument
List allTemplateSourceDocument
s that are bound to the underlyingDocumentModel
- Specified by:
getSourceTemplates
in interfaceTemplateBasedDocument
-
getTemplateType
Description copied from interface:TemplateBasedDocument
Return the template type for a given template name- Specified by:
getTemplateType
in interfaceTemplateBasedDocument
-
initializeFromTemplate
-
initializeFromTemplate
Description copied from interface:TemplateBasedDocument
Initialize the template parameters from the associated template- Specified by:
initializeFromTemplate
in interfaceTemplateBasedDocument
save
- flag to indicate if target DocumentModel must be saved or not- Returns:
- the updated DocumentModel
-
doSave
protected void doSave()- Overrides:
doSave
in classAbstractTemplateDocument
-
setBlob
-
renderWithTemplate
Description copied from interface:TemplateBasedDocument
Render the named template against the underlying DocumentModel- Specified by:
renderWithTemplate
in interfaceTemplateBasedDocument
- Returns:
- the resulting
Blob
-
initOperationContext
-
renderAndStoreAsAttachment
Description copied from interface:TemplateBasedDocument
Render the named template against the underlying DocumentModel and store the result in the main Blob- Specified by:
renderAndStoreAsAttachment
in interfaceTemplateBasedDocument
save
- flag to indicate if target DocumentModel must be saved or not- Returns:
- the resulting
Blob
-
isBidirectional
public boolean isBidirectional() -
getTemplateBlob
Description copied from interface:TemplateBasedDocument
Return theBlob
of the associated template- Specified by:
getTemplateBlob
in interfaceTemplateBasedDocument
-
hasParams
Description copied from interface:TemplateBasedDocument
Indicate of the associated Template requires parameters or not- Specified by:
hasParams
in interfaceTemplateBasedDocument
-
getParams
Description copied from interface:TemplateBasedDocument
Retrieve parameters for the associated template- Specified by:
getParams
in interfaceTemplateBasedDocument
-
saveParams
Description copied from interface:TemplateBasedDocument
Save parameters changes.- Specified by:
saveParams
in interfaceTemplateBasedDocument
params
- the updated list of parameterssave
- flag to indicate if target DocumentModel must be saved or not
-
getTemplateProcessor
-
getOutputFormatDescriptor
-
hasEditableParams
Description copied from interface:TemplateBasedDocument
Indicate of the associated Template has editable parameters or not- Specified by:
hasEditableParams
in interfaceTemplateBasedDocument
-
getTemplateNameForRendition
Description copied from interface:TemplateBasedDocument
Find the template associated to a given RenditionName- Specified by:
getTemplateNameForRendition
in interfaceTemplateBasedDocument
- Returns:
- the template name if any, null otherwise
-
getTemplateNames
Description copied from interface:TemplateBasedDocument
Get the names of all the associated templates- Specified by:
getTemplateNames
in interfaceTemplateBasedDocument
-