Content template factories are automatically selected gving a document type or a facet. This is hard-coded inside the content template service. We need to be able to select dedicated content factories giving a document property value.
We're going to introduce a new extension, configuring the service for selecting a content factory as needed. We named that extension "selector".
Selectors will be ordered giving their name. The first selector returning a content factory will gain the rights for providing contents.
Here is the configuration that is backward compatible with oldest version of the service :
<extension
target="org.nuxeo.ecm.platform.content.template.service.ContentTemplateService"
point="factorySelector">
<factorySelector name="10-type" class="org.nuxeo.ecm.platform.content.template.selectors.TypeSelector"/>
<factorySelector name="20-facet" class="org.nuxeo.ecm.platform.content.template.selectors.FacetSelector"/>
</extension>
A selector should implement the interface
public interface FactorySelector
{ String getKeyFor(DocumentModel doc); String getKeyFor(ContentFactoryDescriptor desc, FactoryBindingDescriptor binding); ContentFactory getFactoryFor(DocumentModel doc); String register(ContentFactoryDescriptor desc, FactoryBindingDescriptor binding, ContentFactory factory); }- depends on
-
NXP-6094 Implement per-document facets in core
- Resolved