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 TypeMethodDescriptionvoidaddContextExtensions(DocumentModel currentDocument, DocumentWrapper wrapper, Map<String, Object> ctx) detachTemplateBasedDocument(DocumentModel targetDoc, String templateName, boolean save) Detach a Template from aDocumentModelfindProcessor(Blob templateBlob) Finds theTemplateProcessorfor a givenBlob.findProcessorName(Blob templateBlob) Finds the template processor name for a givenBlob.getAvailableOfficeTemplates(CoreSession session, String targetType) Retrieve theTemplateSourceDocumentthat 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) FindTemplateSourceDocuments that can be bound to a given doc type.getAvailableTemplates(CoreSession session, String targetType) FindTemplateSourceDocuments that can be bound to a given doc type.Retrieve the DocumentModels using a givenTemplateSourceDocumentgetOutputFormatDescriptor(String outputFormatId) The returnedOutputFormatDescriptorcontains either an operation chain or a mime-type use to convert the output of a rendered document.getProcessor(String name) Get aTemplateProcessorby it's name.Returns all registeredTemplateProcessorsgetTemplateDoc(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 aDocumentModelto aTemplateSourceDocument.voidUpdate 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
TemplateProcessorname
-
findProcessor
Finds theTemplateProcessorfor a givenBlob. The template processor is found based on mime-types.- Returns:
- the
TemplateProcessor
-
getProcessor
Get aTemplateProcessorby it's name. Name is defined in the associated descriptor.- Returns:
- the
TemplateProcessor
-
getRegisteredTemplateProcessors
Collection<TemplateProcessorDescriptor> getRegisteredTemplateProcessors()Returns all registeredTemplateProcessors- Returns:
- collection of registered
TemplateProcessorDescriptor
-
getAvailableTemplateDocs
FindTemplateSourceDocuments that can be bound to a given doc type.- Parameters:
targetType- the target Document Type- Returns:
- List of applicable DocumentModel
-
getAvailableTemplates
FindTemplateSourceDocuments 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 theTemplateSourceDocumentthat 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 aDocumentModelto 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 returnedOutputFormatDescriptorcontains either an operation chain or a mime-type use to convert the output of a rendered document.- Returns:
OutputFormatDescriptor
-