mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-01 14:41:46 +00:00
fix precommit
This commit is contained in:
@@ -37,6 +37,10 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.RenditionModel;
|
import org.alfresco.model.RenditionModel;
|
||||||
@@ -76,13 +80,9 @@ import org.alfresco.service.namespace.NamespaceException;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class adds some new behaviour to the standard ActionExecuterAbstractBase
|
* This class adds some new behaviour to the standard ActionExecuterAbstractBase in order to support the RenditionService.
|
||||||
* in order to support the RenditionService.
|
|
||||||
*
|
*
|
||||||
* @author Neil McErlean
|
* @author Neil McErlean
|
||||||
* @author Nick Smith
|
* @author Nick Smith
|
||||||
@@ -112,28 +112,24 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
// for the two params
|
// for the two params
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default default node type for renditions - used if no value
|
* This is the default default node type for renditions - used if no value is injected from spring.
|
||||||
* is injected from spring.
|
|
||||||
*/
|
*/
|
||||||
private static final QName DEFAULT_DEFAULT_RENDITION_NODE_TYPE = ContentModel.TYPE_CONTENT;
|
private static final QName DEFAULT_DEFAULT_RENDITION_NODE_TYPE = ContentModel.TYPE_CONTENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default default property used to specify where rendition
|
* This is the default default property used to specify where rendition content is stored - used if no value is injected from spring.
|
||||||
* content is stored - used if no value is injected from spring.
|
|
||||||
*/
|
*/
|
||||||
private static final QName DEFAULT_DEFAULT_RENDITION_CONTENT_PROP = RenditionService2Impl.DEFAULT_RENDITION_CONTENT_PROP;
|
private static final QName DEFAULT_DEFAULT_RENDITION_CONTENT_PROP = RenditionService2Impl.DEFAULT_RENDITION_CONTENT_PROP;
|
||||||
private static final String DEFAULT_MIMETYPE = RenditionService2Impl.DEFAULT_MIMETYPE;
|
private static final String DEFAULT_MIMETYPE = RenditionService2Impl.DEFAULT_MIMETYPE;
|
||||||
private static final String DEFAULT_ENCODING = RenditionService2Impl.DEFAULT_ENCODING;
|
private static final String DEFAULT_ENCODING = RenditionService2Impl.DEFAULT_ENCODING;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default node type that is used when creating rendition
|
* This is the default node type that is used when creating rendition objects.
|
||||||
* objects.
|
|
||||||
*/
|
*/
|
||||||
private QName defaultRenditionNodeType = DEFAULT_DEFAULT_RENDITION_NODE_TYPE;
|
private QName defaultRenditionNodeType = DEFAULT_DEFAULT_RENDITION_NODE_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default property that is used to store rendition objects'
|
* This is the default property that is used to store rendition objects' content.
|
||||||
* content.
|
|
||||||
*/
|
*/
|
||||||
private QName defaultRenditionContentProp = DEFAULT_DEFAULT_RENDITION_CONTENT_PROP;
|
private QName defaultRenditionContentProp = DEFAULT_DEFAULT_RENDITION_CONTENT_PROP;
|
||||||
|
|
||||||
@@ -150,55 +146,39 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
|
|
||||||
/* Parameter names common to all Rendering Actions */
|
/* Parameter names common to all Rendering Actions */
|
||||||
/**
|
/**
|
||||||
* This optional {@link String} parameter specifies the location of a
|
* This optional {@link String} parameter 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.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
public static final String PARAM_PLACEHOLDER_RESOURCE_PATH = "placeHolderResourcePath";
|
public static final String PARAM_PLACEHOLDER_RESOURCE_PATH = "placeHolderResourcePath";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This optional {@link QName} parameter specifies which property the
|
* This optional {@link QName} parameter 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.
|
||||||
* Rendering Engine uses to read content from the source node in order to
|
|
||||||
* create a rendition. By default this property will be cm:content.
|
|
||||||
*/
|
*/
|
||||||
public static final String PARAM_SOURCE_CONTENT_PROPERTY = "sourceContentProperty";
|
public static final String PARAM_SOURCE_CONTENT_PROPERTY = "sourceContentProperty";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This optional {@link QName} parameter specifies which property the
|
* This optional {@link QName} parameter specifies which property the Rendering Engine uses to write content to the rendition node. By default the property used is cm:content.
|
||||||
* Rendering Engine uses to write content to the rendition node. By default
|
|
||||||
* the property used is cm:content.
|
|
||||||
*/
|
*/
|
||||||
public static final String PARAM_TARGET_CONTENT_PROPERTY = "targetContentProperty";
|
public static final String PARAM_TARGET_CONTENT_PROPERTY = "targetContentProperty";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This optional {@link Boolean} flag property specifies whether a rendition
|
* This optional {@link Boolean} flag property specifies whether a rendition should be updated automatically if the source node changes. If set to <code>true</code> then the rendition will be re-rendered any time any property changes occur on the source node. This parameter defaults to <code>false</code>.
|
||||||
* should be updated automatically if the source node changes. If set to
|
|
||||||
* <code>true</code> then the rendition will be re-rendered any time any
|
|
||||||
* property changes occur on the source node. This parameter defaults to
|
|
||||||
* <code>false</code>.
|
|
||||||
*/
|
*/
|
||||||
public static final String PARAM_UPDATE_RENDITIONS_ON_ANY_PROPERTY_CHANGE = "update-renditions-on-any-property-change";
|
public static final String PARAM_UPDATE_RENDITIONS_ON_ANY_PROPERTY_CHANGE = "update-renditions-on-any-property-change";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This optional {@link String} parameter specifies what user permissions
|
* This optional {@link String} parameter specifies what user permissions are used when creating a rendition. By default the system user is used.
|
||||||
* are used when creating a rendition. By default the system user is used.
|
|
||||||
*/
|
*/
|
||||||
public static final String PARAM_RUN_AS = "runAs";
|
public static final String PARAM_RUN_AS = "runAs";
|
||||||
|
|
||||||
// mime-type is not a common parameter on all Rendering Actions, but it is
|
// mime-type is not a common parameter on all Rendering Actions, but it is
|
||||||
// common to many and is used in some common handling code in this class.
|
// common to many and is used in some common handling code in this class.
|
||||||
/**
|
/**
|
||||||
* This optional {@link String} parameter specifies the mime type of the
|
* This optional {@link String} parameter specifies the mime type of the rendition content. This defaults to the mime type of the source node content.
|
||||||
* rendition content. This defaults to the mime type of the source node
|
|
||||||
* content.
|
|
||||||
*/
|
*/
|
||||||
public static final String PARAM_MIME_TYPE = "mime-type";
|
public static final String PARAM_MIME_TYPE = "mime-type";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This optional {@link String} paramter specifies the encoding used to
|
* This optional {@link String} paramter specifies the encoding used to create the rendition content. The derfault encoding is UTF-8.
|
||||||
* create the rendition content. The derfault encoding is UTF-8.
|
|
||||||
*/
|
*/
|
||||||
public static final String PARAM_ENCODING = "encoding";
|
public static final String PARAM_ENCODING = "encoding";
|
||||||
|
|
||||||
@@ -207,9 +187,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
*/
|
*/
|
||||||
private final static NodeLocator defaultNodeLocator = new SelfNodeLocator();
|
private final static NodeLocator defaultNodeLocator = new SelfNodeLocator();
|
||||||
|
|
||||||
/*
|
/* Injected beans */
|
||||||
* Injected beans
|
|
||||||
*/
|
|
||||||
private RenditionLocationResolver renditionLocationResolver;
|
private RenditionLocationResolver renditionLocationResolver;
|
||||||
protected NodeService nodeService;
|
protected NodeService nodeService;
|
||||||
private RenditionService renditionService;
|
private RenditionService renditionService;
|
||||||
@@ -232,7 +210,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
/**
|
/**
|
||||||
* Injects the renditionService bean.
|
* Injects the renditionService bean.
|
||||||
*
|
*
|
||||||
* @param renditionService RenditionService
|
* @param renditionService
|
||||||
|
* RenditionService
|
||||||
*/
|
*/
|
||||||
public void setRenditionService(RenditionService renditionService)
|
public void setRenditionService(RenditionService renditionService)
|
||||||
{
|
{
|
||||||
@@ -240,7 +219,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param behaviourFilter policy behaviour filter
|
* @param behaviourFilter
|
||||||
|
* policy behaviour filter
|
||||||
*/
|
*/
|
||||||
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
|
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
|
||||||
{
|
{
|
||||||
@@ -271,12 +251,11 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
this(null, null);
|
this(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default rendition-node type.
|
* Sets the default rendition-node type.
|
||||||
*
|
*
|
||||||
* @param type String
|
* @param type
|
||||||
|
* String
|
||||||
*/
|
*/
|
||||||
public void setDefaultRenditionNodeType(String type)
|
public void setDefaultRenditionNodeType(String type)
|
||||||
{
|
{
|
||||||
@@ -304,8 +283,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
/**
|
/**
|
||||||
* This method returns the type of the default rendition node type.
|
* This method returns the type of the default rendition node type.
|
||||||
*
|
*
|
||||||
* @return the QName representing the type of the default rendition node
|
* @return the QName representing the type of the default rendition node type.
|
||||||
* type.
|
|
||||||
*/
|
*/
|
||||||
protected QName getDefaultRenditionNodeType()
|
protected QName getDefaultRenditionNodeType()
|
||||||
{
|
{
|
||||||
@@ -325,7 +303,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
/**
|
/**
|
||||||
* Sets the default rendition content property.
|
* Sets the default rendition content property.
|
||||||
*
|
*
|
||||||
* @param prop String
|
* @param prop
|
||||||
|
* String
|
||||||
*/
|
*/
|
||||||
public void setDefaultRenditionContentProp(String prop)
|
public void setDefaultRenditionContentProp(String prop)
|
||||||
{
|
{
|
||||||
@@ -351,11 +330,9 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the QName of the property that defines the location
|
* This method returns the QName of the property that defines the location of the rendition content. An example would be cm:content.
|
||||||
* of the rendition content. An example would be cm:content.
|
|
||||||
*
|
*
|
||||||
* @return the QName the property defining the location of the rendition
|
* @return the QName the property defining the location of the rendition content.
|
||||||
* content.
|
|
||||||
*/
|
*/
|
||||||
protected QName getDefaultRenditionContentProp()
|
protected QName getDefaultRenditionContentProp()
|
||||||
{
|
{
|
||||||
@@ -365,7 +342,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
/**
|
/**
|
||||||
* Set the content service
|
* Set the content service
|
||||||
*
|
*
|
||||||
* @param contentService the content service
|
* @param contentService
|
||||||
|
* the content service
|
||||||
*/
|
*/
|
||||||
public void setContentService(ContentService contentService)
|
public void setContentService(ContentService contentService)
|
||||||
{
|
{
|
||||||
@@ -391,7 +369,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
@Override
|
@Override
|
||||||
protected void executeImpl(final Action action, final NodeRef sourceNode)
|
protected void executeImpl(final Action action, final NodeRef sourceNode)
|
||||||
{
|
{
|
||||||
executeImpl( (RenditionDefinition)action, sourceNode );
|
executeImpl((RenditionDefinition) action, sourceNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void executeImpl(final RenditionDefinition renditionDef, final NodeRef sourceNode)
|
protected void executeImpl(final RenditionDefinition renditionDef, final NodeRef sourceNode)
|
||||||
@@ -448,8 +426,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
// permissions to create content under that node.
|
// permissions to create content under that node.
|
||||||
// For that reason, we execute all rendition actions as system
|
// For that reason, we execute all rendition actions as system
|
||||||
// by default.
|
// by default.
|
||||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
@@ -483,8 +460,9 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
|
|
||||||
// Grab a link to the rendition node - it's been saved as a parameter for us
|
// Grab a link to the rendition node - it's been saved as a parameter for us
|
||||||
// (Wait until now to fetch in case it was moved)
|
// (Wait until now to fetch in case it was moved)
|
||||||
result = (ChildAssociationRef)renditionDef.getParameterValue(PARAM_RESULT);
|
result = (ChildAssociationRef) renditionDef.getParameterValue(PARAM_RESULT);
|
||||||
} catch (Throwable t)
|
}
|
||||||
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
notifyCallbackOfException(renditionDef, t);
|
notifyCallbackOfException(renditionDef, t);
|
||||||
throwWrappedException(t);
|
throwWrappedException(t);
|
||||||
@@ -499,18 +477,16 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this a standalone rendition, or is it a sub-component of
|
* Is this a standalone rendition, or is it a sub-component of a composite rendition? This is false for standalone renditions, AND ALSO false for the main part of a composite rendition. This only returns true if we're currently processing a component of a composite rendition.
|
||||||
* a composite rendition?
|
*
|
||||||
* This is false for standalone renditions, AND ALSO false for
|
* @param action
|
||||||
* the main part of a composite rendition.
|
* Action
|
||||||
* This only returns true if we're currently processing a
|
|
||||||
* component of a composite rendition.
|
|
||||||
* @param action Action
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private boolean isComponentRendition(Action action) {
|
private boolean isComponentRendition(Action action)
|
||||||
|
{
|
||||||
Serializable s = action.getParameterValue(PARAM_IS_COMPONENT_RENDITION);
|
Serializable s = action.getParameterValue(PARAM_IS_COMPONENT_RENDITION);
|
||||||
boolean result = s == null ? false : (Boolean)s;
|
boolean result = s == null ? false : (Boolean) s;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,10 +517,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method can be overridden by subclasses to provide checking of parameter
|
* 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.
|
||||||
* values.
|
|
||||||
* If a parameter value is illegal or inappropriate, an exception
|
|
||||||
* should be thrown.
|
|
||||||
*/
|
*/
|
||||||
protected void checkParameterValues(Action action)
|
protected void checkParameterValues(Action action)
|
||||||
{
|
{
|
||||||
@@ -552,7 +525,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param renditionDefinition RenditionDefinition
|
* @param renditionDefinition
|
||||||
|
* RenditionDefinition
|
||||||
* @return QName
|
* @return QName
|
||||||
*/
|
*/
|
||||||
protected QName getRenditionContentProperty(RenditionDefinition renditionDefinition)
|
protected QName getRenditionContentProperty(RenditionDefinition renditionDefinition)
|
||||||
@@ -563,7 +537,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
protected abstract void render(RenderingContext context);
|
protected abstract void render(RenderingContext context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param actionedUponNodeRef NodeRef
|
* @param actionedUponNodeRef
|
||||||
|
* NodeRef
|
||||||
*/
|
*/
|
||||||
protected void checkSourceNodeExists(NodeRef actionedUponNodeRef)
|
protected void checkSourceNodeExists(NodeRef actionedUponNodeRef)
|
||||||
{
|
{
|
||||||
@@ -576,13 +551,14 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param action Action
|
* @param action
|
||||||
|
* Action
|
||||||
*/
|
*/
|
||||||
protected RenditionDefinition checkActionIsRenditionDefinition(Action action)
|
protected RenditionDefinition checkActionIsRenditionDefinition(Action action)
|
||||||
{
|
{
|
||||||
if (action instanceof RenditionDefinition)
|
if (action instanceof RenditionDefinition)
|
||||||
{
|
{
|
||||||
return (RenditionDefinition)action;
|
return (RenditionDefinition) action;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -593,7 +569,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
/**
|
/**
|
||||||
* If no rendition node type is specified, then the default is used
|
* If no rendition node type is specified, then the default is used
|
||||||
*
|
*
|
||||||
* @param renditionDefinition RenditionDefinition
|
* @param renditionDefinition
|
||||||
|
* RenditionDefinition
|
||||||
* @return QName
|
* @return QName
|
||||||
*/
|
*/
|
||||||
private QName getRenditionNodeType(RenditionDefinition renditionDefinition)
|
private QName getRenditionNodeType(RenditionDefinition renditionDefinition)
|
||||||
@@ -608,12 +585,10 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method gets the parameter definition display label from the properties file.
|
* 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.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* @param paramName the name of the parameter
|
* @param paramName
|
||||||
|
* the name of the parameter
|
||||||
* @return the display label of the parameter
|
* @return the display label of the parameter
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -712,14 +687,14 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value for the named parameter. Checks the type of the parameter
|
* Gets the value for the named parameter. Checks the type of the parameter is correct and throws a {@link RenditionServiceException} if it isn't. Returns <code>null</code> if the parameter value is <code>null</code>
|
||||||
* is correct and throws a {@link RenditionServiceException} if it isn't.
|
|
||||||
* Returns <code>null</code> if the parameter value is <code>null</code>
|
|
||||||
*
|
*
|
||||||
* @param paramName the name of the parameter being checked.
|
* @param paramName
|
||||||
* @param clazz the expected {@link Class} of the parameter value.
|
* the name of the parameter being checked.
|
||||||
* @param definition the {@link RenditionDefinition} containing the
|
* @param clazz
|
||||||
* parameters.
|
* the expected {@link Class} of the parameter value.
|
||||||
|
* @param definition
|
||||||
|
* the {@link RenditionDefinition} containing the parameters.
|
||||||
* @return the parameter value or <code>null</code>.
|
* @return the parameter value or <code>null</code>.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -730,10 +705,10 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(clazz == null)
|
if (clazz == null)
|
||||||
throw new RenditionServiceException("The class must not be null!", new NullPointerException());
|
throw new RenditionServiceException("The class must not be null!", new NullPointerException());
|
||||||
Class<? extends Serializable> valueClass = value.getClass();
|
Class<? extends Serializable> valueClass = value.getClass();
|
||||||
if ( !clazz.isAssignableFrom(valueClass))
|
if (!clazz.isAssignableFrom(valueClass))
|
||||||
{
|
{
|
||||||
throw new RenditionServiceException("The parameter: " + paramName + " must be of type: "
|
throw new RenditionServiceException("The parameter: " + paramName + " must be of type: "
|
||||||
+ clazz.getName() + "but was of type: " + valueClass.getName());
|
+ clazz.getName() + "but was of type: " + valueClass.getName());
|
||||||
@@ -744,21 +719,22 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value for the named parameter. Checks the type of the parameter
|
* Gets the value for the named parameter. Checks the type of the parameter is the same as the type of <code>defaultValue</code> and throws a {@link RenditionServiceException} if it isn't. Returns <code>defaultValue</code> if the parameter value is <code>null</code>
|
||||||
* is the same as the type of <code>defaultValue</code> and throws a
|
|
||||||
* {@link RenditionServiceException} if it isn't. Returns
|
|
||||||
* <code>defaultValue</code> if the parameter value is <code>null</code>
|
|
||||||
*
|
*
|
||||||
* @param paramName String
|
* @param paramName
|
||||||
* @param defaultValue T
|
* String
|
||||||
* @param definition RenditionDefinition
|
* @param defaultValue
|
||||||
* @param <T> T
|
* T
|
||||||
|
* @param definition
|
||||||
|
* RenditionDefinition
|
||||||
|
* @param <T>
|
||||||
|
* T
|
||||||
* @return T
|
* @return T
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> T getParamWithDefault(String paramName, T defaultValue, RenditionDefinition definition)
|
public static <T> T getParamWithDefault(String paramName, T defaultValue, RenditionDefinition definition)
|
||||||
{
|
{
|
||||||
if(defaultValue == null)
|
if (defaultValue == null)
|
||||||
throw new RenditionServiceException("The defaultValue cannot be null!", new NullPointerException());
|
throw new RenditionServiceException("The defaultValue cannot be null!", new NullPointerException());
|
||||||
Class<? extends T> clazz = (Class<? extends T>) defaultValue.getClass();
|
Class<? extends T> clazz = (Class<? extends T>) defaultValue.getClass();
|
||||||
T result = getCheckedParam(paramName, clazz, definition);
|
T result = getCheckedParam(paramName, clazz, definition);
|
||||||
@@ -776,12 +752,15 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
private ChildAssociationRef caNodeRef;
|
private ChildAssociationRef caNodeRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sourceNode NodeRef
|
* @param sourceNode
|
||||||
* @param definition RenditionDefinition
|
* NodeRef
|
||||||
* @param renditionContentProperty QName
|
* @param definition
|
||||||
|
* RenditionDefinition
|
||||||
|
* @param renditionContentProperty
|
||||||
|
* QName
|
||||||
*/
|
*/
|
||||||
public RenderingContext(NodeRef sourceNode,//
|
public RenderingContext(NodeRef sourceNode, //
|
||||||
RenditionDefinition definition,//
|
RenditionDefinition definition, //
|
||||||
QName renditionContentProperty)
|
QName renditionContentProperty)
|
||||||
{
|
{
|
||||||
this.sourceNode = sourceNode;
|
this.sourceNode = sourceNode;
|
||||||
@@ -799,6 +778,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Lazily instantiation of the ChildAssociationRef
|
* Lazily instantiation of the ChildAssociationRef
|
||||||
|
*
|
||||||
* @return ChildAssociationRef
|
* @return ChildAssociationRef
|
||||||
*/
|
*/
|
||||||
public synchronized ChildAssociationRef getChildAssociationRef()
|
public synchronized ChildAssociationRef getChildAssociationRef()
|
||||||
@@ -870,7 +850,6 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void tagSourceNodeAsRenditioned(final RenditionDefinition renditionDef, final NodeRef actionedUponNodeRef)
|
protected void tagSourceNodeAsRenditioned(final RenditionDefinition renditionDef, final NodeRef actionedUponNodeRef)
|
||||||
{
|
{
|
||||||
// Adds the 'Renditioned' aspect to the source node if it
|
// Adds the 'Renditioned' aspect to the source node if it
|
||||||
@@ -896,7 +875,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
|
|
||||||
protected void switchToFinalRenditionNode(final RenditionDefinition renditionDef, final NodeRef actionedUponNodeRef)
|
protected void switchToFinalRenditionNode(final RenditionDefinition renditionDef, final NodeRef actionedUponNodeRef)
|
||||||
{
|
{
|
||||||
ChildAssociationRef tempRendAssoc = (ChildAssociationRef)renditionDef.getParameterValue(PARAM_RESULT);
|
ChildAssociationRef tempRendAssoc = (ChildAssociationRef) renditionDef.getParameterValue(PARAM_RESULT);
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Switching temporary rendition: " + tempRendAssoc);
|
logger.debug("Switching temporary rendition: " + tempRendAssoc);
|
||||||
@@ -924,7 +903,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
if (t instanceof AlfrescoRuntimeException)
|
if (t instanceof AlfrescoRuntimeException)
|
||||||
{
|
{
|
||||||
throw (AlfrescoRuntimeException) t;
|
throw (AlfrescoRuntimeException) t;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
throw new RenditionServiceException(t.getMessage(), t);
|
throw new RenditionServiceException(t.getMessage(), t);
|
||||||
}
|
}
|
||||||
@@ -944,11 +924,12 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method sets the temporary rendition parent node and the rendition assocType on the
|
* This method sets the temporary rendition parent node and the rendition assocType on the rendition definition.
|
||||||
* rendition definition.
|
|
||||||
*
|
*
|
||||||
* @param sourceNode NodeRef
|
* @param sourceNode
|
||||||
* @param definition the rendition definition.
|
* NodeRef
|
||||||
|
* @param definition
|
||||||
|
* the rendition definition.
|
||||||
*/
|
*/
|
||||||
private void setTemporaryRenditionProperties(NodeRef sourceNode, RenditionDefinition definition)
|
private void setTemporaryRenditionProperties(NodeRef sourceNode, RenditionDefinition definition)
|
||||||
{
|
{
|
||||||
@@ -969,11 +950,12 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param sourceNode The node that has been rendered
|
* @param sourceNode
|
||||||
* @param tempRendition The relationship between the node and its rendition
|
* The node that has been rendered
|
||||||
* @param renditionDefinition The definition of the rendition that has just been performed.
|
* @param tempRendition
|
||||||
* In the case of a composite rendition, this parameter refers
|
* The relationship between the node and its rendition
|
||||||
* to that CompositeRendition and not to any of its component renditions.
|
* @param renditionDefinition
|
||||||
|
* The definition of the rendition that has just been performed. In the case of a composite rendition, this parameter refers to that CompositeRendition and not to any of its component renditions.
|
||||||
* @return ChildAssociationRef
|
* @return ChildAssociationRef
|
||||||
*/
|
*/
|
||||||
private ChildAssociationRef createOrUpdateRendition(NodeRef sourceNode, ChildAssociationRef tempRendition,
|
private ChildAssociationRef createOrUpdateRendition(NodeRef sourceNode, ChildAssociationRef tempRendition,
|
||||||
@@ -1040,9 +1022,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method manages the <code>rn:rendition</code> aspects on the rendition node. It applies the
|
* This method manages the <code>rn:rendition</code> aspects on the rendition node. It applies the correct rendition aspect based on the rendition node's location and removes any out-of-date rendition aspect.
|
||||||
* correct rendition aspect based on the rendition node's location and removes any out-of-date rendition
|
|
||||||
* aspect.
|
|
||||||
*/
|
*/
|
||||||
private void manageRenditionAspects(NodeRef sourceNode, ChildAssociationRef renditionParentAssoc)
|
private void manageRenditionAspects(NodeRef sourceNode, ChildAssociationRef renditionParentAssoc)
|
||||||
{
|
{
|
||||||
@@ -1067,7 +1047,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
// We remove the other aspect to cover the potential case where a
|
// We remove the other aspect to cover the potential case where a
|
||||||
// rendition
|
// rendition
|
||||||
// has been updated in a different location.
|
// has been updated in a different location.
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Renditions stored underneath any node other than their source are
|
// Renditions stored underneath any node other than their source are
|
||||||
// 'visible'.
|
// 'visible'.
|
||||||
@@ -1085,17 +1066,19 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method calculates the name for a rendition node. The following approaches are attempted in
|
* This method calculates the name for a rendition node. The following approaches are attempted in the order given below.
|
||||||
* the order given below.
|
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>If a name is defined in the {@link RenditionLocation} then that is used.</li>
|
* <li>If a name is defined in the {@link RenditionLocation} then that is used.</li>
|
||||||
* <li>If the temporary rendition has a <code>cm:name</code> value, then that is used.</li>
|
* <li>If the temporary rendition has a <code>cm:name</code> value, then that is used.</li>
|
||||||
* <li>Otherwise use the rendition definition's rendition name.</li>
|
* <li>Otherwise use the rendition definition's rendition name.</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* @param tempRenditionNode the temporary rendition node.
|
* @param tempRenditionNode
|
||||||
* @param location a RenditionLocation struct.
|
* the temporary rendition node.
|
||||||
* @param renditionDefinition the rendition definition.
|
* @param location
|
||||||
|
* a RenditionLocation struct.
|
||||||
|
* @param renditionDefinition
|
||||||
|
* the rendition definition.
|
||||||
* @return the name for the rendition.
|
* @return the name for the rendition.
|
||||||
*/
|
*/
|
||||||
private String getRenditionName(NodeRef tempRenditionNode, RenditionLocation location,
|
private String getRenditionName(NodeRef tempRenditionNode, RenditionLocation location,
|
||||||
@@ -1118,8 +1101,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a rendition definition, a source node and a temporary rendition node, this method uses a
|
* Given a rendition definition, a source node and a temporary rendition node, this method uses a {@link RenditionLocationResolver} to calculate the {@link RenditionLocation} of the rendition.
|
||||||
* {@link RenditionLocationResolver} to calculate the {@link RenditionLocation} of the rendition.
|
|
||||||
*/
|
*/
|
||||||
protected RenditionLocation resolveRenditionLocation(NodeRef sourceNode, RenditionDefinition definition,
|
protected RenditionLocation resolveRenditionLocation(NodeRef sourceNode, RenditionDefinition definition,
|
||||||
NodeRef tempRendition)
|
NodeRef tempRendition)
|
||||||
@@ -1128,11 +1110,12 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the <code>ExecutionSummary</code> for the given <code>renderingContext</code>
|
* Gets the <code>ExecutionSummary</code> for the given <code>renderingContext</code> from the {@link ActionTrackingService}.
|
||||||
* from the {@link ActionTrackingService}.
|
|
||||||
* <p>
|
* <p>
|
||||||
* Note that multiple summaries of the same action instance are not currently supported.
|
* Note that multiple summaries of the same action instance are not currently supported.
|
||||||
* @param renderingContext the rendering context
|
*
|
||||||
|
* @param renderingContext
|
||||||
|
* the rendering context
|
||||||
* @return the found summary or null
|
* @return the found summary or null
|
||||||
*/
|
*/
|
||||||
protected ExecutionSummary getExecutionSummary(RenderingContext renderingContext)
|
protected ExecutionSummary getExecutionSummary(RenderingContext renderingContext)
|
||||||
|
Reference in New Issue
Block a user