Class RenditionServiceImpl
- All Implemented Interfaces:
RenditionService,Adaptable,Component,Extensible,TimestampedService
RenditionService.- Since:
- 5.4.1
- Author:
- Thomas Roger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final StoredRenditionManagerprotected List<DefaultRenditionDescriptor>static final Stringprotected RenditionDefinitionProviderRegistryprotected RenditionDefinitionRegistrystatic final Stringprotected final ScriptEngineManagerstatic final Stringprotected Deque<StoredRenditionManagerDescriptor>Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(ComponentContext context) Activates the component.protected DocumentRefcreateVersionIfNeeded(DocumentModel source, CoreSession session) voiddeactivate(ComponentContext context) Deactivates the component.voiddeleteStoredRenditions(String repositoryName) Query and delete stored renditions where the related version or live document does not exist anymore.getAvailableRenditionDefinition(DocumentModel doc, String renditionName) Returns theRenditionDefinitionavailable on the given document for the given rendition definition name.Returns aListofRenditionDefinitionavailable on the given Document.Returns aListofRenditionavailable on the given Document.getAvailableRenditions(DocumentModel doc, boolean onlyVisible) Returns aListofRenditionavailable on the given Document.Returns aListof registeredRenditionDefinition.getDefaultRendition(DocumentModel doc, String reason, boolean store, Map<String, Serializable> extendedInfos) Return the defaultRenditionobject for the givenDocumentModel.getDefaultRendition(DocumentModel doc, String reason, Map<String, Serializable> extendedInfos) Same asRenditionService.getDefaultRendition(DocumentModel, String, boolean, Map)with store parameter set to false.getRendition(DocumentModel doc, String renditionName) Return theRenditionobject for the givenDocumentModeland a rendition definition name.getRendition(DocumentModel doc, String renditionName, boolean store) Return theRenditionobject for the givenDocumentModeland a rendition definition name.protected RenditiongetRendition(DocumentModel doc, RenditionDefinition renditionDefinition, boolean store) getRenditionDefinition(String name) Deprecated.getRenditionSafe(DocumentModel doc, String defaultRenditionName, boolean store) protected RenditionDefinitionmergeRenditions(RenditionDefinition oldRenditionDefinition, RenditionDefinition newRenditionDefinition) publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override) Publish a document's rendition.voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) storeRendition(DocumentModel source, String renditionDefinitionName) Render a document based on the given rendition definition name and returns the stored RenditionDocumentRef.protected StoredRenditionstoreRendition(DocumentModel sourceDocument, Rendition rendition) Deprecated.since 10.10, usestoreRendition(DocumentModel, Rendition, RenditionDefinition)insteadprotected StoredRenditionstoreRendition(DocumentModel sourceDocument, Rendition rendition, RenditionDefinition renditionDefinition) voidunregisterContribution(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, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
RENDITION_DEFINITIONS_EP
- See Also:
-
RENDITON_DEFINION_PROVIDERS_EP
- See Also:
-
DEFAULT_RENDITION_EP
- See Also:
-
STORED_RENDITION_MANAGERS_EP
- Since:
- 8.1
- See Also:
-
renditionDefinitionRegistry
- Since:
- 7.3.
-
renditionDefinitionProviderRegistry
-
defaultRenditionDescriptors
-
DEFAULT_STORED_RENDITION_MANAGER
-
storedRenditionManagerDescriptors
- Since:
- 8.1
-
scriptEngineManager
-
-
Constructor Details
-
RenditionServiceImpl
public RenditionServiceImpl()
-
-
Method Details
-
getStoredRenditionManager
- Since:
- 8.1
-
activate
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
deactivate
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
getRenditionDefinition
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 contributedRenditionDefinitionProviders. -
getDeclaredRenditionDefinitions
Description copied from interface:RenditionServiceReturns aListof registeredRenditionDefinition. The order of the List does not depend on the registering order.- Specified by:
getDeclaredRenditionDefinitionsin interfaceRenditionService
-
getAvailableRenditionDefinitions
Description copied from interface:RenditionServiceReturns aListofRenditionDefinitionavailable on the given Document. The order of the List does not depend on the registering order.- Specified by:
getAvailableRenditionDefinitionsin interfaceRenditionService
-
storeRendition
Description copied from interface:RenditionServiceRender 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:
storeRenditionin interfaceRenditionService- Parameters:
source- the document to renderrenditionDefinitionName- the rendition definition to use- Returns:
- the
DocumentRefof the newly created Rendition document.
-
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
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContributionin classDefaultComponent
-
mergeRenditions
protected RenditionDefinition mergeRenditions(RenditionDefinition oldRenditionDefinition, RenditionDefinition newRenditionDefinition) -
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContributionin classDefaultComponent
-
getRendition
Description copied from interface:RenditionServiceReturn theRenditionobject for the givenDocumentModeland a rendition definition name.A stored rendition is returned if found and up to date, a new Rendition is created otherwise.
- Specified by:
getRenditionin interfaceRenditionService- Parameters:
doc- the document to renderrenditionName- the name of the rendition definition- Returns:
- the
Renditionobject
-
getRendition
Description copied from interface:RenditionServiceReturn theRenditionobject for the givenDocumentModeland 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:
getRenditionin interfaceRenditionService- Parameters:
doc- the document to renderrenditionName- the name of the rendition definitionstore- indicates if the rendition must be stored- Returns:
- the
Renditionobject
-
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
Description copied from interface:RenditionServiceReturns theRenditionDefinitionavailable on the given document for the given rendition definition name.- Specified by:
getAvailableRenditionDefinitionin interfaceRenditionService
-
getAvailableRenditions
Description copied from interface:RenditionServiceReturns aListofRenditionavailable 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:
getAvailableRenditionsin interfaceRenditionService
-
getAvailableRenditions
Description copied from interface:RenditionServiceReturns aListofRenditionavailable on the given Document.If
onlyVisibleis 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:
getAvailableRenditionsin interfaceRenditionService
-
deleteStoredRenditions
Description copied from interface:RenditionServiceQuery and delete stored renditions where the related version or live document does not exist anymore.- Specified by:
deleteStoredRenditionsin interfaceRenditionService
-
getDefaultRendition
public Rendition getDefaultRendition(DocumentModel doc, String reason, Map<String, Serializable> extendedInfos) Description copied from interface:RenditionServiceSame asRenditionService.getDefaultRendition(DocumentModel, String, boolean, Map)with store parameter set to false.- Specified by:
getDefaultRenditionin 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
Renditionobject
-
getDefaultRendition
public Rendition getDefaultRendition(DocumentModel doc, String reason, boolean store, Map<String, Serializable> extendedInfos) Description copied from interface:RenditionServiceReturn the defaultRenditionobject for the givenDocumentModel.A stored rendition is returned if found and up to date, a new Rendition is created otherwise.
- Specified by:
getDefaultRenditionin 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
Renditionobject
-
publishRendition
public DocumentModel publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override) Description copied from interface:RenditionServicePublish a document's rendition. If the rendition name is not given, it publishes its default rendition obtained fromRenditionService.getDefaultRendition(DocumentModel, String, Map).- Specified by:
publishRenditionin 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
-
getAvailableRenditionDefinition(DocumentModel, String)instead