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 StringTEMPLATE_APPLICABLE_TYPES_ALLstatic StringTEMPLATE_APPLICABLE_TYPES_PROPstatic StringTEMPLATE_DATA_PROPstatic StringTEMPLATE_FACETstatic StringTEMPLATE_FORCED_TYPES_ITEM_PROPstatic StringTEMPLATE_FORCED_TYPES_NONEstatic StringTEMPLATE_FORCED_TYPES_PROPstatic StringTEMPLATE_NAME_PROPstatic StringTEMPLATE_OUTPUT_PROPstatic StringTEMPLATE_OVERRIDE_PROPstatic StringTEMPLATE_RENDITION_NONEstatic StringTEMPLATE_RENDITION_PROPstatic StringTEMPLATE_TYPE_AUTOstatic StringTEMPLATE_TYPE_PROPstatic StringTEMPLATE_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 aTemplateInputto the list of template parameters.booleanallowInstanceOverride()Return flag to indicate if Documents associated to this template can override parametes valueprotected StringcomputeTemplateName()List<String>getApplicableTypes()Get List of Document Types than can be associated to this Template.StringgetFileName()Shortcut to access the underlyingBlobfilenameList<String>getForcedTypes()Get List of Document Types that must be automatically bound to this template at creation timeStringgetId()Shortcut to access the underlyingDocumentModeluuidStringgetLabel()Return label key used for templateStringgetName()Shortcut to access the underlyingDocumentModelnameStringgetOutputFormat()Return the expected mime-type of the resulting renderingList<TemplateInput>getParams()Retrieve the parameters associated to the Template fileStringgetParamsAsString()Return the String representation of the parameters of the templateStringgetTargetRenditionName()Get the associated Rendition if anyList<TemplateBasedDocument>getTemplateBasedDocuments()Get the list ofTemplateBasedDocuments associated to this templateBlobgetTemplateBlob()Retrieve the Blob holding the template fileprotected StringgetTemplateParamsXPath()protected TemplateProcessorgetTemplateProcessor()StringgetTemplateType()Return the template Type (i.e.StringgetTitle()Shortcut to access the underlyingDocumentModeltitleStringgetVersionLabel()Shortcut to access the underlyingDocumentModelversionLabelbooleanhasEditableParams()Indicate of the associated Template has editable parameters or notbooleanhasInput(String inputName)Returns whether or not theTemplateInputalready exists, based on the name, in the template.voidinitTemplate(boolean save)Initialize the DocumentModel finds associated TemplateProcessor extract Template parametersvoidinitTypesBindings()Initialize the Types2Template bindingvoidremoveForcedType(String type, boolean save)Remove Type mapping for this templateDocumentModelsaveParams(List<TemplateInput> params, boolean save)Save parameters changesvoidsetForcedTypes(String[] forcedTypes, boolean save)Update the Type mapping for this templatevoidsetOutputFormat(String mimetype, boolean save)Sets the expected output mime-type.voidsetTargetRenditioName(String renditionName, boolean save)Associate Template to a RenditionvoidsetTemplateBlob(Blob blob, boolean save)Write accessor to theBlobused to store the templatebooleanuseAsMainContent()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:TemplateSourceDocumentRetrieve the parameters associated to the Template file- Specified by:
getParamsin interfaceTemplateSourceDocument
-
hasEditableParams
public boolean hasEditableParams()
Description copied from interface:TemplateSourceDocumentIndicate of the associated Template has editable parameters or not- Specified by:
hasEditableParamsin interfaceTemplateSourceDocument
-
saveParams
public DocumentModel saveParams(List<TemplateInput> params, boolean save)
Description copied from interface:TemplateSourceDocumentSave parameters changes- Specified by:
saveParamsin 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:TemplateSourceDocumentReturn the String representation of the parameters of the template- Specified by:
getParamsAsStringin interfaceTemplateSourceDocument- Throws:
PropertyException
-
addInput
public List<TemplateInput> addInput(TemplateInput input)
Description copied from interface:TemplateSourceDocumentAdd or update aTemplateInputto the list of template parameters.- Specified by:
addInputin interfaceTemplateSourceDocument
-
hasInput
public boolean hasInput(String inputName)
Description copied from interface:TemplateSourceDocumentReturns whether or not theTemplateInputalready exists, based on the name, in the template.- Specified by:
hasInputin interfaceTemplateSourceDocument
-
getTemplateType
public String getTemplateType()
Description copied from interface:TemplateSourceDocumentReturn the template Type (i.e. the associatedTemplateProcessorname.- Specified by:
getTemplateTypein interfaceTemplateSourceDocument- Returns:
TemplateProcessorname if any, null otherwise
-
initTemplate
public void initTemplate(boolean save)
Description copied from interface:TemplateSourceDocumentInitialize the DocumentModel- finds associated TemplateProcessor
- extract Template parameters
- Specified by:
initTemplatein 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:TemplateSourceDocumentReturn flag to indicate if Documents associated to this template can override parametes value- Specified by:
allowInstanceOverridein interfaceTemplateSourceDocument
-
initTypesBindings
public void initTypesBindings()
Description copied from interface:TemplateSourceDocumentInitialize the Types2Template binding- Specified by:
initTypesBindingsin interfaceTemplateSourceDocument
-
getApplicableTypes
public List<String> getApplicableTypes()
Description copied from interface:TemplateSourceDocumentGet List of Document Types than can be associated to this Template.- Specified by:
getApplicableTypesin interfaceTemplateSourceDocument- Returns:
- List of Document Types or an empty List
-
getForcedTypes
public List<String> getForcedTypes()
Description copied from interface:TemplateSourceDocumentGet List of Document Types that must be automatically bound to this template at creation time- Specified by:
getForcedTypesin interfaceTemplateSourceDocument- Returns:
- List of Document Types or an empty List
-
removeForcedType
public void removeForcedType(String type, boolean save)
Description copied from interface:TemplateSourceDocumentRemove Type mapping for this template- Specified by:
removeForcedTypein interfaceTemplateSourceDocument
-
setForcedTypes
public void setForcedTypes(String[] forcedTypes, boolean save)
Description copied from interface:TemplateSourceDocumentUpdate the Type mapping for this template- Specified by:
setForcedTypesin interfaceTemplateSourceDocument
-
getTemplateBasedDocuments
public List<TemplateBasedDocument> getTemplateBasedDocuments()
Description copied from interface:TemplateSourceDocumentGet the list ofTemplateBasedDocuments associated to this template- Specified by:
getTemplateBasedDocumentsin interfaceTemplateSourceDocument
-
getOutputFormat
public String getOutputFormat()
Description copied from interface:TemplateSourceDocumentReturn the expected mime-type of the resulting rendering- Specified by:
getOutputFormatin interfaceTemplateSourceDocument
-
setOutputFormat
public void setOutputFormat(String mimetype, boolean save)
Description copied from interface:TemplateSourceDocumentSets the expected output mime-type. If the expected mime-type is different from the output of the rendering, converters will be applied.- Specified by:
setOutputFormatin interfaceTemplateSourceDocument
-
useAsMainContent
public boolean useAsMainContent()
Description copied from interface:TemplateSourceDocumentIndicate if the template can be used as main blob in theTemplateBasedDocument(i.e. if the template is editable by the end user)- Specified by:
useAsMainContentin interfaceTemplateSourceDocument
-
getTemplateBlob
public Blob getTemplateBlob()
Description copied from interface:TemplateSourceDocumentRetrieve the Blob holding the template file- Specified by:
getTemplateBlobin interfaceTemplateSourceDocument
-
setTemplateBlob
public void setTemplateBlob(Blob blob, boolean save)
Description copied from interface:TemplateSourceDocumentWrite accessor to theBlobused to store the template- Specified by:
setTemplateBlobin interfaceTemplateSourceDocument
-
getName
public String getName()
Description copied from interface:TemplateSourceDocumentShortcut to access the underlyingDocumentModelname- Specified by:
getNamein interfaceTemplateSourceDocument
-
getFileName
public String getFileName()
Description copied from interface:TemplateSourceDocumentShortcut to access the underlyingBlobfilename- Specified by:
getFileNamein interfaceTemplateSourceDocument- Returns:
- name
-
getTitle
public String getTitle()
Description copied from interface:TemplateSourceDocumentShortcut to access the underlyingDocumentModeltitle- Specified by:
getTitlein interfaceTemplateSourceDocument- Returns:
- template filename
-
getVersionLabel
public String getVersionLabel()
Description copied from interface:TemplateSourceDocumentShortcut to access the underlyingDocumentModelversionLabel- Specified by:
getVersionLabelin interfaceTemplateSourceDocument- Returns:
- versionLabel
-
getId
public String getId()
Description copied from interface:TemplateSourceDocumentShortcut to access the underlyingDocumentModeluuid- Specified by:
getIdin interfaceTemplateSourceDocument- Returns:
- UUID
-
getLabel
public String getLabel()
Description copied from interface:TemplateSourceDocumentReturn label key used for template- Specified by:
getLabelin interfaceTemplateSourceDocument
-
getTargetRenditionName
public String getTargetRenditionName()
Description copied from interface:TemplateSourceDocumentGet the associated Rendition if any- Specified by:
getTargetRenditionNamein interfaceTemplateSourceDocument- Returns:
- Rendition name or null
-
setTargetRenditioName
public void setTargetRenditioName(String renditionName, boolean save)
Description copied from interface:TemplateSourceDocumentAssociate Template to a Rendition- Specified by:
setTargetRenditioNamein interfaceTemplateSourceDocument
-
-