public class TemplateProcessorComponent extends DefaultComponent implements TemplateProcessorService
TemplateProcessorService
interfaceModifier and Type | Field and Description |
---|---|
static String |
CONTEXT_EXTENSION_XP |
protected ContextFactoryRegistry |
contextExtensionRegistry |
protected static org.apache.commons.logging.Log |
log |
static String |
OUTPUT_FORMAT_EXTENSION_XP |
protected OutputFormatRegistry |
outputFormatRegistry |
static String |
PROCESSOR_XP |
protected TemplateProcessorRegistry |
processorRegistry |
protected ConcurrentHashMap<String,List<String>> |
type2Template |
lastModified
Constructor and Description |
---|
TemplateProcessorComponent() |
getAdapter, getLastModified, registerExtension, setLastModified, setModifiedNow, start, stop, unregisterExtension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted, getApplicationStartedOrder
protected static final org.apache.commons.logging.Log log
public static final String PROCESSOR_XP
public static final String CONTEXT_EXTENSION_XP
public static final String OUTPUT_FORMAT_EXTENSION_XP
protected ContextFactoryRegistry contextExtensionRegistry
protected TemplateProcessorRegistry processorRegistry
protected OutputFormatRegistry outputFormatRegistry
protected ConcurrentHashMap<String,List<String>> type2Template
public TemplateProcessorComponent()
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
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
protected TemplateProcessorDescriptor findProcessorByMimeType(String mt)
protected TemplateProcessorDescriptor findProcessorByExtension(String extension)
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
protected String buildTemplateSearchQuery(String targetType)
protected String buildTemplateSearchByNameQuery(String name)
public List<DocumentModel> getAvailableTemplateDocs(CoreSession session, String targetType)
TemplateProcessorService
TemplateSourceDocument
s that can be bound to a given doc type.getAvailableTemplateDocs
in interface TemplateProcessorService
targetType
- the target Document Typepublic DocumentModel getTemplateDoc(CoreSession session, String name)
TemplateProcessorService
getTemplateDoc
in interface TemplateProcessorService
name
- the name of the templateprotected <T> List<T> wrap(List<DocumentModel> docs, Class<T> adapter)
public List<TemplateSourceDocument> getAvailableOfficeTemplates(CoreSession session, String targetType)
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
public List<TemplateSourceDocument> getAvailableTemplates(CoreSession session, String targetType)
TemplateProcessorService
TemplateSourceDocument
s that can be bound to a given doc type.getAvailableTemplates
in interface TemplateProcessorService
targetType
- the target Document TypeTemplateSourceDocument
public List<TemplateBasedDocument> getLinkedTemplateBasedDocuments(DocumentModel source)
TemplateProcessorService
TemplateSourceDocument
getLinkedTemplateBasedDocuments
in interface TemplateProcessorService
source
- the TemplateSourceDocument
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)
TemplateProcessorService
registerTypeMapping
in interface TemplateProcessorService
public DocumentModel makeTemplateBasedDocument(DocumentModel targetDoc, DocumentModel sourceTemplateDoc, boolean save)
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 notpublic DocumentModel detachTemplateBasedDocument(DocumentModel targetDoc, String templateName, boolean save)
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 notpublic 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 © 2018 Nuxeo. All rights reserved.