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
FieldsFields inherited from class org.nuxeo.template.adapters.AbstractTemplateDocument
adaptedDoc -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoSave()protected OutputFormatDescriptorgetOutputFormatDescriptor(String outputFormat) Retrieve parameters for the associated templategetSourceTemplate(String templateName) Retrieve theTemplateSourceDocumentfor a given template namegetSourceTemplateDoc(String templateName) Retrieve the TemplateDocumentModelfor a given template namegetSourceTemplateDocRef(String templateName) Retrieve the TemplateDocumentReffor a given template nameList allTemplateSourceDocuments that are bound to the underlyingDocumentModelgetTemplateBlob(String templateName) Return theBlobof the associated templategetTemplateNameForRendition(String renditionName) Find the template associated to a given RenditionNameGet the names of all the associated templatesprotected TemplateProcessorgetTemplateProcessor(String templateName) getTemplateType(String templateName) Return the template type for a given template namebooleanhasEditableParams(String templateName) Indicate of the associated Template has editable parameters or notbooleanIndicate of the associated Template requires parameters or notinitializeFromTemplate(boolean save) initializeFromTemplate(String templateName, boolean save) Initialize the template parameters from the associated templateprotected OperationContextinitOperationContext(Blob blob, String templateName) booleanremoveTemplateBinding(String templateName, boolean save) Detach a template from the underlyingDocumentModelrenderAndStoreAsAttachment(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 voidsetTemplate(DocumentModel template, boolean save) Associate the document to a Template.Methods inherited from class org.nuxeo.template.adapters.AbstractTemplateDocument
getAdaptedDoc, getSession, saveMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:TemplateBasedDocumentAssociate the document to a Template.- Specified by:
setTemplatein 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:TemplateBasedDocumentDetach a template from the underlyingDocumentModel- Specified by:
removeTemplateBindingin interfaceTemplateBasedDocument
-
getSourceTemplate
Description copied from interface:TemplateBasedDocumentRetrieve theTemplateSourceDocumentfor a given template name- Specified by:
getSourceTemplatein interfaceTemplateBasedDocument- Parameters:
templateName- name of the template- Returns:
- the
TemplateSourceDocument
-
getSourceTemplateDocRef
Description copied from interface:TemplateBasedDocumentRetrieve the TemplateDocumentReffor a given template name- Specified by:
getSourceTemplateDocRefin interfaceTemplateBasedDocument- Parameters:
templateName- name of the template- Returns:
- the associated template
DocumentRef
-
getSourceTemplateDoc
Description copied from interface:TemplateBasedDocumentRetrieve the TemplateDocumentModelfor a given template name- Specified by:
getSourceTemplateDocin interfaceTemplateBasedDocument- Parameters:
templateName- name of the template- Returns:
- the associated template
DocumentModel
-
getSourceTemplates
Description copied from interface:TemplateBasedDocumentList allTemplateSourceDocuments that are bound to the underlyingDocumentModel- Specified by:
getSourceTemplatesin interfaceTemplateBasedDocument
-
getTemplateType
Description copied from interface:TemplateBasedDocumentReturn the template type for a given template name- Specified by:
getTemplateTypein interfaceTemplateBasedDocument
-
initializeFromTemplate
-
initializeFromTemplate
Description copied from interface:TemplateBasedDocumentInitialize the template parameters from the associated template- Specified by:
initializeFromTemplatein interfaceTemplateBasedDocument- Parameters:
save- flag to indicate if target DocumentModel must be saved or not- Returns:
- the updated DocumentModel
-
doSave
protected void doSave()- Overrides:
doSavein classAbstractTemplateDocument
-
setBlob
-
renderWithTemplate
Description copied from interface:TemplateBasedDocumentRender the named template against the underlying DocumentModel- Specified by:
renderWithTemplatein interfaceTemplateBasedDocument- Returns:
- the resulting
Blob
-
initOperationContext
-
renderAndStoreAsAttachment
Description copied from interface:TemplateBasedDocumentRender the named template against the underlying DocumentModel and store the result in the main Blob- Specified by:
renderAndStoreAsAttachmentin interfaceTemplateBasedDocument- Parameters:
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:TemplateBasedDocumentReturn theBlobof the associated template- Specified by:
getTemplateBlobin interfaceTemplateBasedDocument
-
hasParams
Description copied from interface:TemplateBasedDocumentIndicate of the associated Template requires parameters or not- Specified by:
hasParamsin interfaceTemplateBasedDocument
-
getParams
Description copied from interface:TemplateBasedDocumentRetrieve parameters for the associated template- Specified by:
getParamsin interfaceTemplateBasedDocument
-
saveParams
Description copied from interface:TemplateBasedDocumentSave parameters changes.- Specified by:
saveParamsin interfaceTemplateBasedDocument- Parameters:
params- the updated list of parameterssave- flag to indicate if target DocumentModel must be saved or not
-
getTemplateProcessor
-
getOutputFormatDescriptor
-
hasEditableParams
Description copied from interface:TemplateBasedDocumentIndicate of the associated Template has editable parameters or not- Specified by:
hasEditableParamsin interfaceTemplateBasedDocument
-
getTemplateNameForRendition
Description copied from interface:TemplateBasedDocumentFind the template associated to a given RenditionName- Specified by:
getTemplateNameForRenditionin interfaceTemplateBasedDocument- Returns:
- the template name if any, null otherwise
-
getTemplateNames
Description copied from interface:TemplateBasedDocumentGet the names of all the associated templates- Specified by:
getTemplateNamesin interfaceTemplateBasedDocument
-