Package org.nuxeo.template.api
Interface TemplateProcessorService
- All Known Implementing Classes:
TemplateProcessorComponent
public interface TemplateProcessorService
This is the service interface to manage
TemplateProcessor
and associated templates.- Author:
- Tiry
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addContextExtensions
(DocumentModel currentDocument, DocumentWrapper wrapper, Map<String, Object> ctx) detachTemplateBasedDocument
(DocumentModel targetDoc, String templateName, boolean save) Detach a Template from aDocumentModel
findProcessor
(Blob templateBlob) Finds theTemplateProcessor
for a givenBlob
.findProcessorName
(Blob templateBlob) Finds the template processor name for a givenBlob
.getAvailableOfficeTemplates
(CoreSession session, String targetType) Retrieve theTemplateSourceDocument
that can be used as an Office template (i.e that support to store the template file as main blob of target DocumentModel)getAvailableTemplateDocs
(CoreSession session, String targetType) FindTemplateSourceDocument
s that can be bound to a given doc type.getAvailableTemplates
(CoreSession session, String targetType) FindTemplateSourceDocument
s that can be bound to a given doc type.Retrieve the DocumentModels using a givenTemplateSourceDocument
getOutputFormatDescriptor
(String outputFormatId) The returnedOutputFormatDescriptor
contains either an operation chain or a mime-type use to convert the output of a rendered document.getProcessor
(String name) Get aTemplateProcessor
by it's name.Returns all registeredTemplateProcessor
sgetTemplateDoc
(CoreSession session, String name) Returns a template with a given templateName.Retrieve the Map used for mapping Document Types to Template Names.makeTemplateBasedDocument
(DocumentModel targetDoc, DocumentModel sourceTemplateDoc, boolean save) Associate aDocumentModel
to aTemplateSourceDocument
.void
Update Type2Template Mapping from the data contained in the source DocumentModel.
-
Method Details
-
findProcessorName
Finds the template processor name for a givenBlob
. The template processor is found based on mime-types.- Returns:
- the
TemplateProcessor
name
-
findProcessor
Finds theTemplateProcessor
for a givenBlob
. The template processor is found based on mime-types.- Returns:
- the
TemplateProcessor
-
getProcessor
Get aTemplateProcessor
by it's name. Name is defined in the associated descriptor.- Returns:
- the
TemplateProcessor
-
getRegisteredTemplateProcessors
Collection<TemplateProcessorDescriptor> getRegisteredTemplateProcessors()Returns all registeredTemplateProcessor
s- Returns:
- collection of registered
TemplateProcessorDescriptor
-
getAvailableTemplateDocs
FindTemplateSourceDocument
s that can be bound to a given doc type.- Parameters:
targetType
- the target Document Type- Returns:
- List of applicable DocumentModel
-
getAvailableTemplates
FindTemplateSourceDocument
s that can be bound to a given doc type.- Parameters:
targetType
- the target Document Type- Returns:
- List of applicable
TemplateSourceDocument
-
getTemplateDoc
Returns a template with a given templateName.- Parameters:
name
- the name of the template- Since:
- 9.1
-
getAvailableOfficeTemplates
Retrieve theTemplateSourceDocument
that can be used as an Office template (i.e that support to store the template file as main blob of target DocumentModel) -
getLinkedTemplateBasedDocuments
Retrieve the DocumentModels using a givenTemplateSourceDocument
- Parameters:
source
- theTemplateSourceDocument
-
getTypeMapping
Retrieve the Map used for mapping Document Types to Template Names. This Map represent the Templates that must be automatically bound at creation time for each Document Type.- Returns:
- the Type2Template mapping
-
registerTypeMapping
Update Type2Template Mapping from the data contained in the source DocumentModel. -
makeTemplateBasedDocument
DocumentModel makeTemplateBasedDocument(DocumentModel targetDoc, DocumentModel sourceTemplateDoc, boolean save) Associate aDocumentModel
to aTemplateSourceDocument
. If the DocumentModel is not already aTemplateBasedDocument
, the associated facet will be automatically added.- Parameters:
targetDoc
- the DocumentModel to associate to a templatesourceTemplateDoc
- the DocumentModel holding the templatesave
- flag to indicate if target DocumentModel must be saved or not- Returns:
- the updated DocumentModel
-
detachTemplateBasedDocument
DocumentModel detachTemplateBasedDocument(DocumentModel targetDoc, String templateName, boolean save) Detach a Template from aDocumentModel
- Parameters:
targetDoc
- the DocumentModel to detachtemplateName
- the name of the template to detachsave
- save flag to indicate if target DocumentModel must be saved or not- Returns:
- the updated DocumentModel
-
addContextExtensions
void addContextExtensions(DocumentModel currentDocument, DocumentWrapper wrapper, Map<String, Object> ctx) -
getRegistredContextExtensions
Map<String,ContextExtensionFactoryDescriptor> getRegistredContextExtensions() -
getReservedContextKeywords
-
getOutputFormats
Collection<OutputFormatDescriptor> getOutputFormats()- Returns:
- the list of registered Ouput formats used to convert output of a rendered document.
-
getOutputFormatDescriptor
The returnedOutputFormatDescriptor
contains either an operation chain or a mime-type use to convert the output of a rendered document.- Returns:
OutputFormatDescriptor
-