public class TemplateProcessorComponent extends DefaultComponent implements TemplateProcessorService
TemplateProcessorService
interfaceModifier and Type | Field and Description |
---|---|
static String |
CONTEXT_EXTENSION_XP |
static String |
OUTPUT_FORMAT_EXTENSION_XP |
static String |
PROCESSOR_XP |
Constructor and Description |
---|
TemplateProcessorComponent() |
applicationStarted, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, unregisterExtension
public static final String PROCESSOR_XP
public static final String CONTEXT_EXTENSION_XP
public static final String OUTPUT_FORMAT_EXTENSION_XP
public void activate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic void deactivate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception
registerContribution
in class DefaultComponent
Exception
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception
unregisterContribution
in class DefaultComponent
Exception
public TemplateProcessor findProcessor(Blob templateBlob)
TemplateProcessorService
TemplateProcessor
for a given Blob
. The
template processor is found based on mime-types.findProcessor
in interface TemplateProcessorService
TemplateProcessor
public String findProcessorName(Blob templateBlob)
TemplateProcessorService
Blob
. The template
processor is found based on mime-types.findProcessorName
in interface TemplateProcessorService
TemplateProcessor
namepublic TemplateProcessorDescriptor findProcessorDescriptor(Blob templateBlob)
public void addContextExtensions(DocumentModel currentDocument, DocumentWrapper wrapper, Map<String,Object> ctx)
addContextExtensions
in interface TemplateProcessorService
public List<String> getReservedContextKeywords()
getReservedContextKeywords
in interface TemplateProcessorService
public Map<String,ContextExtensionFactoryDescriptor> getRegistredContextExtensions()
getRegistredContextExtensions
in interface TemplateProcessorService
public TemplateProcessorDescriptor getDescriptor(String name)
public TemplateProcessor getProcessor(String name)
TemplateProcessorService
TemplateProcessor
by it's name. Name is defined in the
associated descriptor.getProcessor
in interface TemplateProcessorService
TemplateProcessor
public List<DocumentModel> getAvailableTemplateDocs(CoreSession session, String targetType) throws ClientException
TemplateProcessorService
TemplateSourceDocument
s that can be bound to a given doc
type.getAvailableTemplateDocs
in interface TemplateProcessorService
targetType
- the target Document TypeClientException
public List<TemplateSourceDocument> getAvailableOfficeTemplates(CoreSession session, String targetType) throws ClientException
TemplateProcessorService
TemplateSourceDocument
that can be used as an Office
template (i.e that support to store the template file as main blob of
target DocumentModel)getAvailableOfficeTemplates
in interface TemplateProcessorService
ClientException
public List<TemplateSourceDocument> getAvailableTemplates(CoreSession session, String targetType) throws ClientException
TemplateProcessorService
TemplateSourceDocument
s that can be bound to a given doc
type.getAvailableTemplates
in interface TemplateProcessorService
targetType
- the target Document TypeTemplateSourceDocument
ClientException
public List<TemplateBasedDocument> getLinkedTemplateBasedDocuments(DocumentModel source) throws ClientException
TemplateProcessorService
TemplateSourceDocument
getLinkedTemplateBasedDocuments
in interface TemplateProcessorService
source
- the TemplateSourceDocument
ClientException
public Collection<TemplateProcessorDescriptor> getRegisteredTemplateProcessors()
TemplateProcessorService
TemplateProcessor
sgetRegisteredTemplateProcessors
in interface TemplateProcessorService
TemplateProcessorDescriptor
public Map<String,List<String>> getTypeMapping()
TemplateProcessorService
getTypeMapping
in interface TemplateProcessorService
public void registerTypeMapping(DocumentModel doc) throws ClientException
TemplateProcessorService
registerTypeMapping
in interface TemplateProcessorService
ClientException
public DocumentModel makeTemplateBasedDocument(DocumentModel targetDoc, DocumentModel sourceTemplateDoc, boolean save) throws ClientException
TemplateProcessorService
DocumentModel
to a TemplateSourceDocument
. If
the DocumentModel is not already a TemplateBasedDocument
, the
associated facet will be automatically added.makeTemplateBasedDocument
in interface TemplateProcessorService
targetDoc
- the DocumentModel to associate to a templatesourceTemplateDoc
- the DocumentModel holding the templatesave
- flag to indicate if target DocumentModel must be saved or notClientException
public DocumentModel detachTemplateBasedDocument(DocumentModel targetDoc, String templateName, boolean save) throws ClientException
TemplateProcessorService
DocumentModel
detachTemplateBasedDocument
in interface TemplateProcessorService
targetDoc
- the DocumentModel to detachtemplateName
- the name of the template to detachsave
- save flag to indicate if target DocumentModel must be saved
or notClientException
public Collection<OutputFormatDescriptor> getOutputFormats()
getOutputFormats
in interface TemplateProcessorService
public OutputFormatDescriptor getOutputFormatDescriptor(String outputFormatId)
TemplateProcessorService
OutputFormatDescriptor
contains either an operation
chain or a mime-type use to convert the output of a rendered document.getOutputFormatDescriptor
in interface TemplateProcessorService
OutputFormatDescriptor
Copyright © 2013 Nuxeo SA. All Rights Reserved.