Class RenditionServiceImpl
- All Implemented Interfaces:
RenditionService
,Adaptable
,Component
,Extensible
,TimestampedService
RenditionService
.- Since:
- 5.4.1
- Author:
- Thomas Roger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
protected static final StoredRenditionManager
protected List
<DefaultRenditionDescriptor> static final String
protected Map
<String, RenditionDefinitionProviderDescriptor> protected Map
<String, RenditionDefinition> static final String
protected final ScriptEngineManager
static final String
protected Deque
<StoredRenditionManagerDescriptor> Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canUseRenditionDefinition
(RenditionDefinition renditionDefinition, DocumentModel doc) protected boolean
canUseRenditionDefinitionProvider
(RenditionDefinitionProviderDescriptor renditionDefinitionProviderDescriptor, DocumentModel doc) protected ActionContext
protected DocumentRef
createVersionIfNeeded
(DocumentModel source, CoreSession session) void
deleteStoredRenditions
(String repositoryName) Query and delete stored renditions where the related version or live document does not exist anymore.getAvailableRenditionDefinition
(DocumentModel doc, String renditionName) Returns theRenditionDefinition
available on the given document for the given rendition definition name.Returns aList
ofRenditionDefinition
available on the given Document.Returns aList
ofRendition
available on the given Document.getAvailableRenditions
(DocumentModel doc, boolean onlyVisible) Returns aList
ofRendition
available on the given Document.Returns aList
of registeredRenditionDefinition
.getDefaultRendition
(DocumentModel doc, String reason, boolean store, Map<String, Serializable> extendedInfos) Return the defaultRendition
object 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 theRendition
object for the givenDocumentModel
and a rendition definition name.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) protected RenditionDefinition
protected RenditionDefinition
protected List
<RenditionDefinition> protected List
<RenditionDefinition> getRenditionSafe
(DocumentModel doc, String defaultRenditionName, boolean store) publishRendition
(DocumentModel doc, DocumentModel target, String renditionName, boolean override) Publish a document's rendition.protected void
setupProvider
(RenditionDefinition definition) void
start
(ComponentContext context) Start the component.void
stop
(ComponentContext context) Stop the component.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, RenditionDefinition renditionDefinition) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, 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
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:
-
renditionDefinitions
-
renditionDefinitionProviders
-
defaultRenditionDescriptors
-
DEFAULT_STORED_RENDITION_MANAGER
-
storedRenditionManagerDescriptors
- Since:
- 8.1
-
scriptEngineManager
-
-
Constructor Details
-
RenditionServiceImpl
public RenditionServiceImpl()
-
-
Method Details
-
getStoredRenditionManager
- Since:
- 8.1
-
start
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
setupProvider
-
stop
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
-
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
-
getAvailableRenditionDefinitions
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
-
getRenditionDefinitionsFromDefinition
-
canUseRenditionDefinition
protected boolean canUseRenditionDefinition(RenditionDefinition renditionDefinition, DocumentModel doc) -
getRenditionDefinitionsFromProvider
-
canUseRenditionDefinitionProvider
protected boolean canUseRenditionDefinitionProvider(RenditionDefinitionProviderDescriptor renditionDefinitionProviderDescriptor, DocumentModel doc) -
createActionContext
-
storeRendition
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
protected StoredRendition storeRendition(DocumentModel sourceDocument, Rendition rendition, RenditionDefinition renditionDefinition) - Since:
- 10.10
-
createVersionIfNeeded
-
getRendition
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
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
Description copied from interface:RenditionService
Returns theRenditionDefinition
available on the given document for the given rendition definition name.- Specified by:
getAvailableRenditionDefinition
in interfaceRenditionService
-
getRenditionDefinitionFromDefinition
-
getRenditionDefinitionFromProvider
-
getAvailableRenditions
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
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
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
-