Class RenditionServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.rendition.service.RenditionServiceImpl
-
- All Implemented Interfaces:
RenditionService
,Adaptable
,Component
,Extensible
,TimestampedService
public class RenditionServiceImpl extends DefaultComponent implements RenditionService
Default implementation ofRenditionService
.- Since:
- 5.4.1
- Author:
- Thomas Roger
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_RENDITION_EP
protected static StoredRenditionManager
DEFAULT_STORED_RENDITION_MANAGER
protected List<DefaultRenditionDescriptor>
defaultRenditionDescriptors
static String
RENDITION_DEFINITIONS_EP
protected RenditionDefinitionProviderRegistry
renditionDefinitionProviderRegistry
protected RenditionDefinitionRegistry
renditionDefinitionRegistry
static String
RENDITON_DEFINION_PROVIDERS_EP
protected ScriptEngineManager
scriptEngineManager
static String
STORED_RENDITION_MANAGERS_EP
protected Deque<StoredRenditionManagerDescriptor>
storedRenditionManagerDescriptors
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description RenditionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activate(ComponentContext context)
Activates the component.protected DocumentRef
createVersionIfNeeded(DocumentModel source, CoreSession session)
void
deactivate(ComponentContext context)
Deactivates the component.void
deleteStoredRenditions(String repositoryName)
Query and delete stored renditions where the related version or live document does not exist anymore.RenditionDefinition
getAvailableRenditionDefinition(DocumentModel doc, String renditionName)
Returns theRenditionDefinition
available on the given document for the given rendition definition name.List<RenditionDefinition>
getAvailableRenditionDefinitions(DocumentModel doc)
Returns aList
ofRenditionDefinition
available on the given Document.List<Rendition>
getAvailableRenditions(DocumentModel doc)
Returns aList
ofRendition
available on the given Document.List<Rendition>
getAvailableRenditions(DocumentModel doc, boolean onlyVisible)
Returns aList
ofRendition
available on the given Document.List<RenditionDefinition>
getDeclaredRenditionDefinitions()
Returns aList
of registeredRenditionDefinition
.List<RenditionDefinition>
getDeclaredRenditionDefinitionsForProviderType(String providerType)
Deprecated.since 7.2 because unusedRendition
getDefaultRendition(DocumentModel doc, String reason, boolean store, Map<String,Serializable> extendedInfos)
Return the defaultRendition
object for the givenDocumentModel
.Rendition
getDefaultRendition(DocumentModel doc, String reason, Map<String,Serializable> extendedInfos)
Same asRenditionService.getDefaultRendition(DocumentModel, String, boolean, Map)
with store parameter set to false.Rendition
getRendition(DocumentModel doc, String renditionName)
Return theRendition
object for the givenDocumentModel
and a rendition definition name.Rendition
getRendition(DocumentModel doc, String renditionName, boolean store)
Return theRendition
object for the givenDocumentModel
and a rendition definition name.protected Rendition
getRendition(DocumentModel doc, RenditionDefinition renditionDefinition, boolean store)
RenditionDefinition
getRenditionDefinition(String name)
Deprecated.since 10.10, usegetAvailableRenditionDefinition(DocumentModel, String)
insteadprotected Optional<Rendition>
getRenditionSafe(DocumentModel doc, String defaultRenditionName, boolean store)
StoredRenditionManager
getStoredRenditionManager()
protected RenditionDefinition
mergeRenditions(RenditionDefinition oldRenditionDefinition, RenditionDefinition newRenditionDefinition)
DocumentModel
publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override)
Publish a document's rendition.void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
DocumentRef
storeRendition(DocumentModel source, String renditionDefinitionName)
Render a document based on the given rendition definition name and returns the stored RenditionDocumentRef
.protected StoredRendition
storeRendition(DocumentModel sourceDocument, Rendition rendition)
Deprecated.since 10.10, usestoreRendition(DocumentModel, Rendition, RenditionDefinition)
insteadprotected DocumentModel
storeRendition(DocumentModel sourceDocument, Rendition rendition, String name)
Deprecated.since 8.1protected StoredRendition
storeRendition(DocumentModel sourceDocument, Rendition rendition, RenditionDefinition renditionDefinition)
void
unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
RENDITION_DEFINITIONS_EP
public static final String RENDITION_DEFINITIONS_EP
- See Also:
- Constant Field Values
-
RENDITON_DEFINION_PROVIDERS_EP
public static final String RENDITON_DEFINION_PROVIDERS_EP
- See Also:
- Constant Field Values
-
DEFAULT_RENDITION_EP
public static final String DEFAULT_RENDITION_EP
- See Also:
- Constant Field Values
-
STORED_RENDITION_MANAGERS_EP
public static final String STORED_RENDITION_MANAGERS_EP
- Since:
- 8.1
- See Also:
- Constant Field Values
-
renditionDefinitionRegistry
protected RenditionDefinitionRegistry renditionDefinitionRegistry
- Since:
- 7.3.
-
renditionDefinitionProviderRegistry
protected RenditionDefinitionProviderRegistry renditionDefinitionProviderRegistry
-
defaultRenditionDescriptors
protected List<DefaultRenditionDescriptor> defaultRenditionDescriptors
-
DEFAULT_STORED_RENDITION_MANAGER
protected static final StoredRenditionManager DEFAULT_STORED_RENDITION_MANAGER
-
storedRenditionManagerDescriptors
protected Deque<StoredRenditionManagerDescriptor> storedRenditionManagerDescriptors
- Since:
- 8.1
-
scriptEngineManager
protected final ScriptEngineManager scriptEngineManager
-
-
Method Detail
-
getStoredRenditionManager
public StoredRenditionManager getStoredRenditionManager()
- Since:
- 8.1
-
activate
public void activate(ComponentContext context)
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
getRenditionDefinition
@Deprecated(since="10.10") public RenditionDefinition getRenditionDefinition(String name)
Deprecated.since 10.10, usegetAvailableRenditionDefinition(DocumentModel, String)
insteadShoudn't be used since it doesn't take into account the rendition definitions made available for a given document by the contributedRenditionDefinitionProvider
s.
-
getDeclaredRenditionDefinitions
public List<RenditionDefinition> getDeclaredRenditionDefinitions()
Description copied from interface:RenditionService
Returns aList
of registeredRenditionDefinition
. The order of the List does not depend on the registering order.- Specified by:
getDeclaredRenditionDefinitions
in interfaceRenditionService
-
getDeclaredRenditionDefinitionsForProviderType
@Deprecated(since="7.2") public List<RenditionDefinition> getDeclaredRenditionDefinitionsForProviderType(String providerType)
Deprecated.since 7.2 because unusedDescription copied from interface:RenditionService
Returns aList
of registeredRenditionDefinition
matching a given provider type- Specified by:
getDeclaredRenditionDefinitionsForProviderType
in interfaceRenditionService
-
getAvailableRenditionDefinitions
public List<RenditionDefinition> getAvailableRenditionDefinitions(DocumentModel doc)
Description copied from interface:RenditionService
Returns aList
ofRenditionDefinition
available on the given Document. The order of the List does not depend on the registering order.- Specified by:
getAvailableRenditionDefinitions
in interfaceRenditionService
-
storeRendition
public DocumentRef storeRendition(DocumentModel source, String renditionDefinitionName)
Description copied from interface:RenditionService
Render a document based on the given rendition definition name and returns the stored RenditionDocumentRef
.Only the user launching the render operation has the Read right on the returned document.
- Specified by:
storeRendition
in interfaceRenditionService
- Parameters:
source
- the document to renderrenditionDefinitionName
- the rendition definition to use- Returns:
- the
DocumentRef
of the newly created Rendition document.
-
storeRendition
@Deprecated(since="8.1") protected DocumentModel storeRendition(DocumentModel sourceDocument, Rendition rendition, String name)
Deprecated.since 8.1
-
storeRendition
@Deprecated(since="10.10") protected StoredRendition storeRendition(DocumentModel sourceDocument, Rendition rendition)
Deprecated.since 10.10, usestoreRendition(DocumentModel, Rendition, RenditionDefinition)
instead- Since:
- 8.1
-
storeRendition
protected StoredRendition storeRendition(DocumentModel sourceDocument, Rendition rendition, RenditionDefinition renditionDefinition)
- Since:
- 10.10
-
createVersionIfNeeded
protected DocumentRef createVersionIfNeeded(DocumentModel source, CoreSession session)
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
mergeRenditions
protected RenditionDefinition mergeRenditions(RenditionDefinition oldRenditionDefinition, RenditionDefinition newRenditionDefinition)
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
getRendition
public Rendition getRendition(DocumentModel doc, String renditionName)
Description copied from interface:RenditionService
Return theRendition
object for the givenDocumentModel
and a rendition definition name.A stored rendition is returned if found and up to date, a new Rendition is created otherwise.
- Specified by:
getRendition
in interfaceRenditionService
- Parameters:
doc
- the document to renderrenditionName
- the name of the rendition definition- Returns:
- the
Rendition
object
-
getRendition
public Rendition getRendition(DocumentModel doc, String renditionName, boolean store)
Description copied from interface:RenditionService
Return theRendition
object for the givenDocumentModel
and a rendition definition name.A stored rendition is returned if found and up to date, a new (live) Rendition is created and returned otherwise.
If store parameter is true, the new created rendition is stored too unless it is marked as stale.
- Specified by:
getRendition
in interfaceRenditionService
- Parameters:
doc
- the document to renderrenditionName
- the name of the rendition definitionstore
- indicates if the rendition must be stored- Returns:
- the
Rendition
object
-
getRenditionSafe
protected Optional<Rendition> getRenditionSafe(DocumentModel doc, String defaultRenditionName, boolean store)
- Since:
- 11.1
-
getRendition
protected Rendition getRendition(DocumentModel doc, RenditionDefinition renditionDefinition, boolean store)
-
getAvailableRenditionDefinition
public RenditionDefinition getAvailableRenditionDefinition(DocumentModel doc, String renditionName)
Description copied from interface:RenditionService
Returns theRenditionDefinition
available on the given document for the given rendition definition name.- Specified by:
getAvailableRenditionDefinition
in interfaceRenditionService
-
getAvailableRenditions
public List<Rendition> getAvailableRenditions(DocumentModel doc)
Description copied from interface:RenditionService
Returns aList
ofRendition
available on the given Document.The order of the List does not depend on the registering order.
The returned rendition may be live or stored
- Specified by:
getAvailableRenditions
in interfaceRenditionService
-
getAvailableRenditions
public List<Rendition> getAvailableRenditions(DocumentModel doc, boolean onlyVisible)
Description copied from interface:RenditionService
Returns aList
ofRendition
available on the given Document.If
onlyVisible
is true, returns only the rendition marked as visible.The order of the List does not depend on the registering order.
The returned rendition may be live or stored
- Specified by:
getAvailableRenditions
in interfaceRenditionService
-
deleteStoredRenditions
public void deleteStoredRenditions(String repositoryName)
Description copied from interface:RenditionService
Query and delete stored renditions where the related version or live document does not exist anymore.- Specified by:
deleteStoredRenditions
in interfaceRenditionService
-
getDefaultRendition
public Rendition getDefaultRendition(DocumentModel doc, String reason, Map<String,Serializable> extendedInfos)
Description copied from interface:RenditionService
Same asRenditionService.getDefaultRendition(DocumentModel, String, boolean, Map)
with store parameter set to false.- Specified by:
getDefaultRendition
in interfaceRenditionService
- Parameters:
doc
- the document to renderreason
- the reason the rendition is being rendered (optional)extendedInfos
- map of extended info added in the default rendition computation (optional)- Returns:
- the default
Rendition
object
-
getDefaultRendition
public Rendition getDefaultRendition(DocumentModel doc, String reason, boolean store, Map<String,Serializable> extendedInfos)
Description copied from interface:RenditionService
Return the defaultRendition
object for the givenDocumentModel
.A stored rendition is returned if found and up to date, a new Rendition is created otherwise.
- Specified by:
getDefaultRendition
in interfaceRenditionService
- Parameters:
doc
- the document to renderreason
- the reason the rendition is being rendered (optional)store
- indicates if the rendition must be storedextendedInfos
- map of extended info added in the default rendition computation (optional)- Returns:
- the default
Rendition
object
-
publishRendition
public DocumentModel publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override)
Description copied from interface:RenditionService
Publish a document's rendition. If the rendition name is not given, it publishes its default rendition obtained fromRenditionService.getDefaultRendition(DocumentModel, String, Map)
.- Specified by:
publishRendition
in interfaceRenditionService
- Parameters:
doc
- the document to be publishedtarget
- the location where to publishrenditionName
- the rendition to be publishedoverride
- if true, will remove existing publication of the document- Returns:
- the published document
-
-