Class TemplateSourceDocumentAdapterImpl
java.lang.Object
org.nuxeo.template.adapters.AbstractTemplateDocument
org.nuxeo.template.adapters.source.TemplateSourceDocumentAdapterImpl
- All Implemented Interfaces:
Serializable
,TemplateSourceDocument
public class TemplateSourceDocumentAdapterImpl
extends AbstractTemplateDocument
implements Serializable, TemplateSourceDocument
Default implementation of
TemplateSourceDocument
. It mainly expect from the underlying DocumentModel to have
the "Template" facet.- Author:
- Tiry ([email protected])
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.nuxeo.template.adapters.AbstractTemplateDocument
adaptedDoc
Fields inherited from interface org.nuxeo.template.api.adapters.TemplateSourceDocument
INIT_DONE_FLAG
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddInput
(TemplateInput input) Add or update aTemplateInput
to the list of template parameters.boolean
Return flag to indicate if Documents associated to this template can override parametes valueprotected String
Get List of Document Types than can be associated to this Template.Shortcut to access the underlyingBlob
filenameGet List of Document Types that must be automatically bound to this template at creation timegetId()
Shortcut to access the underlyingDocumentModel
uuidgetLabel()
Return label key used for templategetName()
Shortcut to access the underlyingDocumentModel
nameReturn the expected mime-type of the resulting renderingRetrieve the parameters associated to the Template fileReturn the String representation of the parameters of the templateGet the associated Rendition if anyGet the list ofTemplateBasedDocument
s associated to this templateRetrieve the Blob holding the template fileprotected String
protected TemplateProcessor
Return the template Type (i.e. the associatedTemplateProcessor
name.getTitle()
Shortcut to access the underlyingDocumentModel
titleShortcut to access the underlyingDocumentModel
versionLabelboolean
Indicate of the associated Template has editable parameters or notboolean
Returns whether or not theTemplateInput
already exists, based on the name, in the template.void
initTemplate
(boolean save) Initialize the DocumentModel finds associated TemplateProcessor extract Template parametersvoid
Initialize the Types2Template bindingvoid
removeForcedType
(String type, boolean save) Remove Type mapping for this templatesaveParams
(List<TemplateInput> params, boolean save) Save parameters changesvoid
setForcedTypes
(String[] forcedTypes, boolean save) Update the Type mapping for this templatevoid
setOutputFormat
(String mimetype, boolean save) Sets the expected output mime-type.void
setTargetRenditioName
(String renditionName, boolean save) Associate Template to a Renditionvoid
setTemplateBlob
(Blob blob, boolean save) Write accessor to theBlob
used to store the templateboolean
Indicate if the template can be used as main blob in theTemplateBasedDocument
(i.e. if the template is editable by the end user)Methods inherited from class org.nuxeo.template.adapters.AbstractTemplateDocument
doSave, 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.TemplateSourceDocument
getAdaptedDoc, save
-
Field Details
-
TEMPLATE_DATA_PROP
- See Also:
-
TEMPLATE_NAME_PROP
- See Also:
-
TEMPLATE_TYPE_PROP
- See Also:
-
TEMPLATE_TYPE_AUTO
- See Also:
-
TEMPLATE_APPLICABLE_TYPES_PROP
- See Also:
-
TEMPLATE_APPLICABLE_TYPES_ALL
- See Also:
-
TEMPLATE_FORCED_TYPES_PROP
- See Also:
-
TEMPLATE_FORCED_TYPES_ITEM_PROP
- See Also:
-
TEMPLATE_FORCED_TYPES_NONE
- See Also:
-
TEMPLATE_RENDITION_NONE
- See Also:
-
TEMPLATE_OUTPUT_PROP
- See Also:
-
TEMPLATE_OVERRIDE_PROP
- See Also:
-
TEMPLATE_USEASMAIN_PROP
- See Also:
-
TEMPLATE_RENDITION_PROP
- See Also:
-
TEMPLATE_FACET
- See Also:
-
-
Constructor Details
-
TemplateSourceDocumentAdapterImpl
-
-
Method Details
-
getTemplateParamsXPath
-
getParams
Description copied from interface:TemplateSourceDocument
Retrieve the parameters associated to the Template file- Specified by:
getParams
in interfaceTemplateSourceDocument
-
hasEditableParams
public boolean hasEditableParams()Description copied from interface:TemplateSourceDocument
Indicate of the associated Template has editable parameters or not- Specified by:
hasEditableParams
in interfaceTemplateSourceDocument
-
saveParams
Description copied from interface:TemplateSourceDocument
Save parameters changes- Specified by:
saveParams
in interfaceTemplateSourceDocument
- Parameters:
params
- the updated list of parameterssave
- flag to indicate if target DocumentModel must be saved or not- Returns:
- the updated DocumentModel
-
getTemplateProcessor
-
getParamsAsString
Description copied from interface:TemplateSourceDocument
Return the String representation of the parameters of the template- Specified by:
getParamsAsString
in interfaceTemplateSourceDocument
- Throws:
PropertyException
-
addInput
Description copied from interface:TemplateSourceDocument
Add or update aTemplateInput
to the list of template parameters.- Specified by:
addInput
in interfaceTemplateSourceDocument
-
hasInput
Description copied from interface:TemplateSourceDocument
Returns whether or not theTemplateInput
already exists, based on the name, in the template.- Specified by:
hasInput
in interfaceTemplateSourceDocument
-
getTemplateType
Description copied from interface:TemplateSourceDocument
Return the template Type (i.e. the associatedTemplateProcessor
name.- Specified by:
getTemplateType
in interfaceTemplateSourceDocument
- Returns:
TemplateProcessor
name if any, null otherwise
-
initTemplate
public void initTemplate(boolean save) Description copied from interface:TemplateSourceDocument
Initialize the DocumentModel- finds associated TemplateProcessor
- extract Template parameters
- Specified by:
initTemplate
in interfaceTemplateSourceDocument
- Parameters:
save
- flag to indicate if target DocumentModel must be saved or not
-
computeTemplateName
-
allowInstanceOverride
public boolean allowInstanceOverride()Description copied from interface:TemplateSourceDocument
Return flag to indicate if Documents associated to this template can override parametes value- Specified by:
allowInstanceOverride
in interfaceTemplateSourceDocument
-
initTypesBindings
public void initTypesBindings()Description copied from interface:TemplateSourceDocument
Initialize the Types2Template binding- Specified by:
initTypesBindings
in interfaceTemplateSourceDocument
-
getApplicableTypes
Description copied from interface:TemplateSourceDocument
Get List of Document Types than can be associated to this Template.- Specified by:
getApplicableTypes
in interfaceTemplateSourceDocument
- Returns:
- List of Document Types or an empty List
-
getForcedTypes
Description copied from interface:TemplateSourceDocument
Get List of Document Types that must be automatically bound to this template at creation time- Specified by:
getForcedTypes
in interfaceTemplateSourceDocument
- Returns:
- List of Document Types or an empty List
-
removeForcedType
Description copied from interface:TemplateSourceDocument
Remove Type mapping for this template- Specified by:
removeForcedType
in interfaceTemplateSourceDocument
-
setForcedTypes
Description copied from interface:TemplateSourceDocument
Update the Type mapping for this template- Specified by:
setForcedTypes
in interfaceTemplateSourceDocument
-
getTemplateBasedDocuments
Description copied from interface:TemplateSourceDocument
Get the list ofTemplateBasedDocument
s associated to this template- Specified by:
getTemplateBasedDocuments
in interfaceTemplateSourceDocument
-
getOutputFormat
Description copied from interface:TemplateSourceDocument
Return the expected mime-type of the resulting rendering- Specified by:
getOutputFormat
in interfaceTemplateSourceDocument
-
setOutputFormat
Description copied from interface:TemplateSourceDocument
Sets the expected output mime-type. If the expected mime-type is different from the output of the rendering, converters will be applied.- Specified by:
setOutputFormat
in interfaceTemplateSourceDocument
-
useAsMainContent
public boolean useAsMainContent()Description copied from interface:TemplateSourceDocument
Indicate if the template can be used as main blob in theTemplateBasedDocument
(i.e. if the template is editable by the end user)- Specified by:
useAsMainContent
in interfaceTemplateSourceDocument
-
getTemplateBlob
Description copied from interface:TemplateSourceDocument
Retrieve the Blob holding the template file- Specified by:
getTemplateBlob
in interfaceTemplateSourceDocument
-
setTemplateBlob
Description copied from interface:TemplateSourceDocument
Write accessor to theBlob
used to store the template- Specified by:
setTemplateBlob
in interfaceTemplateSourceDocument
-
getName
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
name- Specified by:
getName
in interfaceTemplateSourceDocument
-
getFileName
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingBlob
filename- Specified by:
getFileName
in interfaceTemplateSourceDocument
- Returns:
- name
-
getTitle
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
title- Specified by:
getTitle
in interfaceTemplateSourceDocument
- Returns:
- template filename
-
getVersionLabel
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
versionLabel- Specified by:
getVersionLabel
in interfaceTemplateSourceDocument
- Returns:
- versionLabel
-
getId
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
uuid- Specified by:
getId
in interfaceTemplateSourceDocument
- Returns:
- UUID
-
getLabel
Description copied from interface:TemplateSourceDocument
Return label key used for template- Specified by:
getLabel
in interfaceTemplateSourceDocument
-
getTargetRenditionName
Description copied from interface:TemplateSourceDocument
Get the associated Rendition if any- Specified by:
getTargetRenditionName
in interfaceTemplateSourceDocument
- Returns:
- Rendition name or null
-
setTargetRenditioName
Description copied from interface:TemplateSourceDocument
Associate Template to a Rendition- Specified by:
setTargetRenditioName
in interfaceTemplateSourceDocument
-