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 ofTemplateSourceDocument
. It mainly expect from the underlying DocumentModel to have the "Template" facet.- Author:
- Tiry ([email protected])
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
TEMPLATE_APPLICABLE_TYPES_ALL
static String
TEMPLATE_APPLICABLE_TYPES_PROP
static String
TEMPLATE_DATA_PROP
static String
TEMPLATE_FACET
static String
TEMPLATE_FORCED_TYPES_ITEM_PROP
static String
TEMPLATE_FORCED_TYPES_NONE
static String
TEMPLATE_FORCED_TYPES_PROP
static String
TEMPLATE_NAME_PROP
static String
TEMPLATE_OUTPUT_PROP
static String
TEMPLATE_OVERRIDE_PROP
static String
TEMPLATE_RENDITION_NONE
static String
TEMPLATE_RENDITION_PROP
static String
TEMPLATE_TYPE_AUTO
static String
TEMPLATE_TYPE_PROP
static String
TEMPLATE_USEASMAIN_PROP
-
Fields inherited from class org.nuxeo.template.adapters.AbstractTemplateDocument
adaptedDoc, log
-
Fields inherited from interface org.nuxeo.template.api.adapters.TemplateSourceDocument
INIT_DONE_FLAG
-
-
Constructor Summary
Constructors Constructor Description TemplateSourceDocumentAdapterImpl(DocumentModel doc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<TemplateInput>
addInput(TemplateInput input)
Add or update aTemplateInput
to the list of template parameters.boolean
allowInstanceOverride()
Return flag to indicate if Documents associated to this template can override parametes valueprotected String
computeTemplateName()
List<String>
getApplicableTypes()
Get List of Document Types than can be associated to this Template.String
getFileName()
Shortcut to access the underlyingBlob
filenameList<String>
getForcedTypes()
Get List of Document Types that must be automatically bound to this template at creation timeString
getId()
Shortcut to access the underlyingDocumentModel
uuidString
getLabel()
Return label key used for templateString
getName()
Shortcut to access the underlyingDocumentModel
nameString
getOutputFormat()
Return the expected mime-type of the resulting renderingList<TemplateInput>
getParams()
Retrieve the parameters associated to the Template fileString
getParamsAsString()
Return the String representation of the parameters of the templateString
getTargetRenditionName()
Get the associated Rendition if anyList<TemplateBasedDocument>
getTemplateBasedDocuments()
Get the list ofTemplateBasedDocument
s associated to this templateBlob
getTemplateBlob()
Retrieve the Blob holding the template fileprotected String
getTemplateParamsXPath()
protected TemplateProcessor
getTemplateProcessor()
String
getTemplateType()
Return the template Type (i.e.String
getTitle()
Shortcut to access the underlyingDocumentModel
titleString
getVersionLabel()
Shortcut to access the underlyingDocumentModel
versionLabelboolean
hasEditableParams()
Indicate of the associated Template has editable parameters or notboolean
hasInput(String inputName)
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
initTypesBindings()
Initialize the Types2Template bindingvoid
removeForcedType(String type, boolean save)
Remove Type mapping for this templateDocumentModel
saveParams(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
useAsMainContent()
Indicate if the template can be used as main blob in theTemplateBasedDocument
(i.e.-
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 Detail
-
TEMPLATE_DATA_PROP
public static final String TEMPLATE_DATA_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_NAME_PROP
public static final String TEMPLATE_NAME_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_TYPE_PROP
public static final String TEMPLATE_TYPE_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_TYPE_AUTO
public static final String TEMPLATE_TYPE_AUTO
- See Also:
- Constant Field Values
-
TEMPLATE_APPLICABLE_TYPES_PROP
public static final String TEMPLATE_APPLICABLE_TYPES_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_APPLICABLE_TYPES_ALL
public static final String TEMPLATE_APPLICABLE_TYPES_ALL
- See Also:
- Constant Field Values
-
TEMPLATE_FORCED_TYPES_PROP
public static final String TEMPLATE_FORCED_TYPES_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_FORCED_TYPES_ITEM_PROP
public static final String TEMPLATE_FORCED_TYPES_ITEM_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_FORCED_TYPES_NONE
public static final String TEMPLATE_FORCED_TYPES_NONE
- See Also:
- Constant Field Values
-
TEMPLATE_RENDITION_NONE
public static final String TEMPLATE_RENDITION_NONE
- See Also:
- Constant Field Values
-
TEMPLATE_OUTPUT_PROP
public static final String TEMPLATE_OUTPUT_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_OVERRIDE_PROP
public static final String TEMPLATE_OVERRIDE_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_USEASMAIN_PROP
public static final String TEMPLATE_USEASMAIN_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_RENDITION_PROP
public static final String TEMPLATE_RENDITION_PROP
- See Also:
- Constant Field Values
-
TEMPLATE_FACET
public static final String TEMPLATE_FACET
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TemplateSourceDocumentAdapterImpl
public TemplateSourceDocumentAdapterImpl(DocumentModel doc)
-
-
Method Detail
-
getTemplateParamsXPath
protected String getTemplateParamsXPath()
-
getParams
public List<TemplateInput> 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
public DocumentModel saveParams(List<TemplateInput> params, boolean save)
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
protected TemplateProcessor getTemplateProcessor()
-
getParamsAsString
public String getParamsAsString() throws PropertyException
Description copied from interface:TemplateSourceDocument
Return the String representation of the parameters of the template- Specified by:
getParamsAsString
in interfaceTemplateSourceDocument
- Throws:
PropertyException
-
addInput
public List<TemplateInput> addInput(TemplateInput input)
Description copied from interface:TemplateSourceDocument
Add or update aTemplateInput
to the list of template parameters.- Specified by:
addInput
in interfaceTemplateSourceDocument
-
hasInput
public boolean hasInput(String inputName)
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
public String 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
protected String 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
public List<String> 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
public List<String> 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
public void removeForcedType(String type, boolean save)
Description copied from interface:TemplateSourceDocument
Remove Type mapping for this template- Specified by:
removeForcedType
in interfaceTemplateSourceDocument
-
setForcedTypes
public void setForcedTypes(String[] forcedTypes, boolean save)
Description copied from interface:TemplateSourceDocument
Update the Type mapping for this template- Specified by:
setForcedTypes
in interfaceTemplateSourceDocument
-
getTemplateBasedDocuments
public List<TemplateBasedDocument> getTemplateBasedDocuments()
Description copied from interface:TemplateSourceDocument
Get the list ofTemplateBasedDocument
s associated to this template- Specified by:
getTemplateBasedDocuments
in interfaceTemplateSourceDocument
-
getOutputFormat
public String getOutputFormat()
Description copied from interface:TemplateSourceDocument
Return the expected mime-type of the resulting rendering- Specified by:
getOutputFormat
in interfaceTemplateSourceDocument
-
setOutputFormat
public void setOutputFormat(String mimetype, boolean save)
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
public Blob getTemplateBlob()
Description copied from interface:TemplateSourceDocument
Retrieve the Blob holding the template file- Specified by:
getTemplateBlob
in interfaceTemplateSourceDocument
-
setTemplateBlob
public void setTemplateBlob(Blob blob, boolean save)
Description copied from interface:TemplateSourceDocument
Write accessor to theBlob
used to store the template- Specified by:
setTemplateBlob
in interfaceTemplateSourceDocument
-
getName
public String getName()
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
name- Specified by:
getName
in interfaceTemplateSourceDocument
-
getFileName
public String getFileName()
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingBlob
filename- Specified by:
getFileName
in interfaceTemplateSourceDocument
- Returns:
- name
-
getTitle
public String getTitle()
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
title- Specified by:
getTitle
in interfaceTemplateSourceDocument
- Returns:
- template filename
-
getVersionLabel
public String getVersionLabel()
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
versionLabel- Specified by:
getVersionLabel
in interfaceTemplateSourceDocument
- Returns:
- versionLabel
-
getId
public String getId()
Description copied from interface:TemplateSourceDocument
Shortcut to access the underlyingDocumentModel
uuid- Specified by:
getId
in interfaceTemplateSourceDocument
- Returns:
- UUID
-
getLabel
public String getLabel()
Description copied from interface:TemplateSourceDocument
Return label key used for template- Specified by:
getLabel
in interfaceTemplateSourceDocument
-
getTargetRenditionName
public String getTargetRenditionName()
Description copied from interface:TemplateSourceDocument
Get the associated Rendition if any- Specified by:
getTargetRenditionName
in interfaceTemplateSourceDocument
- Returns:
- Rendition name or null
-
setTargetRenditioName
public void setTargetRenditioName(String renditionName, boolean save)
Description copied from interface:TemplateSourceDocument
Associate Template to a Rendition- Specified by:
setTargetRenditioName
in interfaceTemplateSourceDocument
-
-