Class AbstractRenderingEngine
- java.lang.Object
-
- org.alfresco.repo.action.CommonResourceAbstractBase
-
- org.alfresco.repo.action.ParameterizedItemAbstractBase
-
- org.alfresco.repo.action.executer.ActionExecuterAbstractBase
-
- org.alfresco.repo.rendition.executer.AbstractRenderingEngine
-
- All Implemented Interfaces:
ActionExecuter,LoggingAwareExecuter,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware
- Direct Known Subclasses:
AbstractTransformationRenderingEngine,BaseTemplateRenderingEngine,CompositeRenderingEngine,HTMLRenderingEngine
public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
This class adds some new behaviour to the standard ActionExecuterAbstractBase in order to support the RenditionService.- Since:
- 3.3
- Author:
- Neil McErlean, Nick Smith
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractRenderingEngine.RenderingContext
-
Field Summary
Fields Modifier and Type Field Description protected ActionTrackingServiceactionTrackingServiceprotected static java.lang.StringCONTENT_READER_NOT_FOUND_MESSAGEprotected ContentServicecontentServiceprotected static java.lang.StringDEFAULT_RUN_AS_NAMEprotected org.alfresco.repo.content.MimetypeMapmimetypeMapprotected org.alfresco.service.namespace.NamespaceServicenamespaceServiceprotected org.alfresco.service.cmr.repository.NodeServicenodeServicestatic java.lang.StringPARAM_ENCODINGThis optionalStringparamter specifies the encoding used to create the rendition content.static java.lang.StringPARAM_MIME_TYPEThis optionalStringparameter specifies the mime type of the rendition content.static java.lang.StringPARAM_PLACEHOLDER_RESOURCE_PATHThis optionalStringparameter specifies the location of a classpath resource which can be used as a placeholder while a rendition is being generated.static java.lang.StringPARAM_RUN_ASThis optionalStringparameter specifies what user permissions are used when creating a rendition.static java.lang.StringPARAM_SOURCE_CONTENT_PROPERTYThis optionalQNameparameter specifies which property the Rendering Engine uses to read content from the source node in order to create a rendition.static java.lang.StringPARAM_TARGET_CONTENT_PROPERTYThis optionalQNameparameter specifies which property the Rendering Engine uses to write content to the rendition node.static java.lang.StringPARAM_UPDATE_RENDITIONS_ON_ANY_PROPERTY_CHANGEThis optionalBooleanflag property specifies whether a rendition should be updated automatically if the source node changes.-
Fields inherited from class org.alfresco.repo.action.executer.ActionExecuterAbstractBase
actionDefinition, applicableTypes, publicAction
-
Fields inherited from class org.alfresco.repo.action.ParameterizedItemAbstractBase
adhocPropertiesAllowed, DISPLAY_LABEL, runtimeActionService
-
Fields inherited from class org.alfresco.repo.action.CommonResourceAbstractBase
name
-
Fields inherited from interface org.alfresco.repo.action.executer.ActionExecuter
PARAM_RESULT
-
-
Constructor Summary
Constructors Constructor Description AbstractRenderingEngine()AbstractRenderingEngine(NodeLocator temporaryParentNodeLocator, org.alfresco.service.namespace.QName temporaryRenditionLinkType)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddParameterDefinitions(java.util.List<ParameterDefinition> paramList)Adds the parameter definitions to the listprotected RenditionDefinitioncheckActionIsRenditionDefinition(Action action)protected voidcheckParameterValues(Action action)This method can be overridden by subclasses to provide checking of parameter values.protected voidcheckSourceNodeExists(org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)protected ActionDefinitioncreateActionDefinition(java.lang.String definitionName)This method returns an instance of an ActionDefinition implementation class.protected voidexecuteImpl(Action action, org.alfresco.service.cmr.repository.NodeRef sourceNode)Execute the action implementationprotected voidexecuteImpl(RenditionDefinition renditionDef, org.alfresco.service.cmr.repository.NodeRef sourceNode)protected voidexecuteRenditionImpl(Action action, org.alfresco.service.cmr.repository.NodeRef sourceNode)static <T> TgetCheckedParam(java.lang.String paramName, java.lang.Class<T> clazz, RenditionDefinition definition)Gets the value for the named parameter.protected org.alfresco.service.namespace.QNamegetDefaultRenditionContentProp()This method returns the QName of the property that defines the location of the rendition content.protected org.alfresco.service.namespace.QNamegetDefaultRenditionNodeType()This method returns the type of the default rendition node type.protected ExecutionSummarygetExecutionSummary(AbstractRenderingEngine.RenderingContext renderingContext)protected java.lang.StringgetParamDisplayLabel(java.lang.String paramName)This method gets the parameter definition display label from the properties file.protected java.util.Collection<ParameterDefinition>getParameterDefinitions()Supplies the list of parameters required by this rendering engine.static <T> TgetParamWithDefault(java.lang.String paramName, T defaultValue, RenditionDefinition definition)Gets the value for the named parameter.protected org.alfresco.service.namespace.QNamegetRenditionContentProperty(RenditionDefinition renditionDefinition)protected java.lang.StringgetTargetEncoding(AbstractRenderingEngine.RenderingContext context)protected java.lang.StringgetTargetMimeType(AbstractRenderingEngine.RenderingContext context)protected voidnotifyCallbackOfException(RenditionDefinition renditionDefinition, java.lang.Throwable t)protected voidnotifyCallbackOfResult(RenditionDefinition renditionDefinition, org.alfresco.service.cmr.repository.ChildAssociationRef result)protected abstract voidrender(AbstractRenderingEngine.RenderingContext context)protected RenditionLocationresolveRenditionLocation(org.alfresco.service.cmr.repository.NodeRef sourceNode, RenditionDefinition definition, org.alfresco.service.cmr.repository.NodeRef tempRendition)Given a rendition definition, a source node and a temporary rendition node, this method uses aRenditionLocationResolverto calculate theRenditionLocationof the rendition.voidsetActionTrackingService(ActionTrackingService actionTrackingService)voidsetBehaviourFilter(BehaviourFilter behaviourFilter)voidsetContentService(ContentService contentService)Set the content servicevoidsetDefaultRenditionContentProp(java.lang.String prop)Sets the default rendition content property.voidsetDefaultRenditionNodeType(java.lang.String type)Sets the default rendition-node type.voidsetMimetypeMap(org.alfresco.repo.content.MimetypeMap mimetypeMap)voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)Injects the nodeService bean.voidsetRenditionLocationResolver(RenditionLocationResolver renditionLocationResolver)voidsetRenditionService(RenditionService renditionService)Injects the renditionService bean.protected voidswitchToFinalRenditionNode(RenditionDefinition renditionDef, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)protected voidtagSourceNodeAsRenditioned(RenditionDefinition renditionDef, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)protected voidthrowWrappedException(java.lang.Throwable t)-
Methods inherited from class org.alfresco.repo.action.executer.ActionExecuterAbstractBase
execute, getActionDefinition, getIgnoreLock, getQueueName, getTrackStatus, init, isApplicableType, onLogException, setApplicableTypes, setBaseNodeService, setDictionaryService, setIgnoreLock, setLockService, setMlAwareNodeService, setPublicAction, setQueueName, setTrackStatus
-
Methods inherited from class org.alfresco.repo.action.ParameterizedItemAbstractBase
checkMandatoryProperties, getAdhocPropertiesAllowed, getDescriptionKey, getLocalizedParameterDefinitions, getParamDisplayLabel, getParameterDefintions, getTitleKey, setAdhocPropertiesAllowed, setLocales, setRuntimeActionService, toString
-
Methods inherited from class org.alfresco.repo.action.CommonResourceAbstractBase
setBeanName
-
-
-
-
Field Detail
-
CONTENT_READER_NOT_FOUND_MESSAGE
protected static final java.lang.String CONTENT_READER_NOT_FOUND_MESSAGE
- See Also:
- Constant Field Values
-
DEFAULT_RUN_AS_NAME
protected static final java.lang.String DEFAULT_RUN_AS_NAME
-
contentService
protected ContentService contentService
-
mimetypeMap
protected org.alfresco.repo.content.MimetypeMap mimetypeMap
-
actionTrackingService
protected ActionTrackingService actionTrackingService
-
namespaceService
protected org.alfresco.service.namespace.NamespaceService namespaceService
-
PARAM_PLACEHOLDER_RESOURCE_PATH
public static final java.lang.String PARAM_PLACEHOLDER_RESOURCE_PATH
This optionalStringparameter specifies the location of a classpath resource which can be used as a placeholder while a rendition is being generated. For example, this might be a simple icon to indicate a rendition is not yet available. This is intended to be used in conjunction with asynchronous generation of renditions.- See Also:
- Constant Field Values
-
PARAM_SOURCE_CONTENT_PROPERTY
public static final java.lang.String PARAM_SOURCE_CONTENT_PROPERTY
This optionalQNameparameter specifies which property the Rendering Engine uses to read content from the source node in order to create a rendition. By default this property will be cm:content.- See Also:
- Constant Field Values
-
PARAM_TARGET_CONTENT_PROPERTY
public static final java.lang.String PARAM_TARGET_CONTENT_PROPERTY
This optionalQNameparameter specifies which property the Rendering Engine uses to write content to the rendition node. By default the property used is cm:content.- See Also:
- Constant Field Values
-
PARAM_UPDATE_RENDITIONS_ON_ANY_PROPERTY_CHANGE
public static final java.lang.String PARAM_UPDATE_RENDITIONS_ON_ANY_PROPERTY_CHANGE
This optionalBooleanflag property specifies whether a rendition should be updated automatically if the source node changes. If set totruethen the rendition will be re-rendered any time any property changes occur on the source node. This parameter defaults tofalse.- See Also:
- Constant Field Values
-
PARAM_RUN_AS
public static final java.lang.String PARAM_RUN_AS
This optionalStringparameter specifies what user permissions are used when creating a rendition. By default the system user is used.- See Also:
- Constant Field Values
-
PARAM_MIME_TYPE
public static final java.lang.String PARAM_MIME_TYPE
This optionalStringparameter specifies the mime type of the rendition content. This defaults to the mime type of the source node content.- See Also:
- Constant Field Values
-
PARAM_ENCODING
public static final java.lang.String PARAM_ENCODING
This optionalStringparamter specifies the encoding used to create the rendition content. The derfault encoding is UTF-8.- See Also:
- Constant Field Values
-
nodeService
protected org.alfresco.service.cmr.repository.NodeService nodeService
-
-
Constructor Detail
-
AbstractRenderingEngine
public AbstractRenderingEngine(NodeLocator temporaryParentNodeLocator, org.alfresco.service.namespace.QName temporaryRenditionLinkType)
-
AbstractRenderingEngine
public AbstractRenderingEngine()
-
-
Method Detail
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Injects the nodeService bean.- Parameters:
nodeService- the nodeService.
-
setRenditionService
public void setRenditionService(RenditionService renditionService)
Injects the renditionService bean.- Parameters:
renditionService- RenditionService
-
setBehaviourFilter
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
- Parameters:
behaviourFilter- policy behaviour filter
-
setRenditionLocationResolver
public void setRenditionLocationResolver(RenditionLocationResolver renditionLocationResolver)
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
-
setDefaultRenditionNodeType
public void setDefaultRenditionNodeType(java.lang.String type)
Sets the default rendition-node type.- Parameters:
type- String
-
getDefaultRenditionNodeType
protected org.alfresco.service.namespace.QName getDefaultRenditionNodeType()
This method returns the type of the default rendition node type.- Returns:
- the QName representing the type of the default rendition node type.
-
getTargetMimeType
protected java.lang.String getTargetMimeType(AbstractRenderingEngine.RenderingContext context)
-
getTargetEncoding
protected java.lang.String getTargetEncoding(AbstractRenderingEngine.RenderingContext context)
-
setDefaultRenditionContentProp
public void setDefaultRenditionContentProp(java.lang.String prop)
Sets the default rendition content property.- Parameters:
prop- String
-
getDefaultRenditionContentProp
protected org.alfresco.service.namespace.QName getDefaultRenditionContentProp()
This method returns the QName of the property that defines the location of the rendition content. An example would be cm:content.- Returns:
- the QName the property defining the location of the rendition content.
-
setContentService
public void setContentService(ContentService contentService)
Set the content service- Parameters:
contentService- the content service
-
setMimetypeMap
public void setMimetypeMap(org.alfresco.repo.content.MimetypeMap mimetypeMap)
-
setActionTrackingService
public void setActionTrackingService(ActionTrackingService actionTrackingService)
-
createActionDefinition
protected ActionDefinition createActionDefinition(java.lang.String definitionName)
Description copied from class:ActionExecuterAbstractBaseThis method returns an instance of an ActionDefinition implementation class. By default this will be anActionDefinitionImpl, but this could be overridden.- Overrides:
createActionDefinitionin classActionExecuterAbstractBase
-
executeImpl
protected void executeImpl(Action action, org.alfresco.service.cmr.repository.NodeRef sourceNode)
Description copied from class:ActionExecuterAbstractBaseExecute the action implementation- Specified by:
executeImplin classActionExecuterAbstractBase- Parameters:
action- the actionsourceNode- the actioned upon node
-
executeImpl
protected void executeImpl(RenditionDefinition renditionDef, org.alfresco.service.cmr.repository.NodeRef sourceNode)
-
executeRenditionImpl
protected void executeRenditionImpl(Action action, org.alfresco.service.cmr.repository.NodeRef sourceNode)
-
checkParameterValues
protected void checkParameterValues(Action action)
This method can be overridden by subclasses to provide checking of parameter values. If a parameter value is illegal or inappropriate, an exception should be thrown.
-
getRenditionContentProperty
protected org.alfresco.service.namespace.QName getRenditionContentProperty(RenditionDefinition renditionDefinition)
- Parameters:
renditionDefinition- RenditionDefinition- Returns:
- QName
-
render
protected abstract void render(AbstractRenderingEngine.RenderingContext context)
-
checkSourceNodeExists
protected void checkSourceNodeExists(org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
- Parameters:
actionedUponNodeRef- NodeRef
-
checkActionIsRenditionDefinition
protected RenditionDefinition checkActionIsRenditionDefinition(Action action)
- Parameters:
action- Action
-
addParameterDefinitions
protected final void addParameterDefinitions(java.util.List<ParameterDefinition> paramList)
Description copied from class:ParameterizedItemAbstractBaseAdds the parameter definitions to the list- Specified by:
addParameterDefinitionsin classParameterizedItemAbstractBase- Parameters:
paramList- the parameter definitions list
-
getParamDisplayLabel
protected java.lang.String getParamDisplayLabel(java.lang.String paramName)
This method gets the parameter definition display label from the properties file. It looks first for a property whose key has a fixed rendition service-specific prefix and if that gets null, it then delegates to the standard bean name-based approach.- Overrides:
getParamDisplayLabelin classParameterizedItemAbstractBase- Parameters:
paramName- the name of the parameter- Returns:
- the display label of the parameter
-
getParameterDefinitions
protected java.util.Collection<ParameterDefinition> getParameterDefinitions()
Supplies the list of parameters required by this rendering engine.
-
getCheckedParam
public static <T> T getCheckedParam(java.lang.String paramName, java.lang.Class<T> clazz, RenditionDefinition definition)Gets the value for the named parameter. Checks the type of the parameter is correct and throws aRenditionServiceExceptionif it isn't. Returnsnullif the parameter value isnull- Parameters:
paramName- the name of the parameter being checked.clazz- the expectedClassof the parameter value.definition- theRenditionDefinitioncontaining the parameters.- Returns:
- the parameter value or
null.
-
getParamWithDefault
public static <T> T getParamWithDefault(java.lang.String paramName, T defaultValue, RenditionDefinition definition)Gets the value for the named parameter. Checks the type of the parameter is the same as the type ofdefaultValueand throws aRenditionServiceExceptionif it isn't. ReturnsdefaultValueif the parameter value isnull- Type Parameters:
T- T- Parameters:
paramName- StringdefaultValue- Tdefinition- RenditionDefinition- Returns:
- T
-
tagSourceNodeAsRenditioned
protected void tagSourceNodeAsRenditioned(RenditionDefinition renditionDef, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
-
switchToFinalRenditionNode
protected void switchToFinalRenditionNode(RenditionDefinition renditionDef, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
-
notifyCallbackOfException
protected void notifyCallbackOfException(RenditionDefinition renditionDefinition, java.lang.Throwable t)
-
throwWrappedException
protected void throwWrappedException(java.lang.Throwable t)
-
notifyCallbackOfResult
protected void notifyCallbackOfResult(RenditionDefinition renditionDefinition, org.alfresco.service.cmr.repository.ChildAssociationRef result)
-
resolveRenditionLocation
protected RenditionLocation resolveRenditionLocation(org.alfresco.service.cmr.repository.NodeRef sourceNode, RenditionDefinition definition, org.alfresco.service.cmr.repository.NodeRef tempRendition)
Given a rendition definition, a source node and a temporary rendition node, this method uses aRenditionLocationResolverto calculate theRenditionLocationof the rendition.
-
getExecutionSummary
protected ExecutionSummary getExecutionSummary(AbstractRenderingEngine.RenderingContext renderingContext)
Gets theExecutionSummaryfor the givenrenderingContextfrom theActionTrackingService.Note that multiple summaries of the same action instance are not currently supported.
- Parameters:
renderingContext- the rendering context- Returns:
- the found summary or null
-
-