Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

57047: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      56514: Merged HEAD-BUG-FIX to V4.2-BUG-FIX (4.2.1)
         56253: Formatting while investigating ALF-20191


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61681 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 18:56:46 +00:00
parent b53b0fedc8
commit 7731e3d01d

View File

@@ -192,21 +192,21 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
*/ */
public static final String PARAM_ENCODING = "encoding"; public static final String PARAM_ENCODING = "encoding";
/** /**
* Default {@link NodeLocator} simply returns the source node. * Default {@link NodeLocator} simply returns the source node.
*/ */
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;
private BehaviourFilter behaviourFilter; private BehaviourFilter behaviourFilter;
private final NodeLocator temporaryParentNodeLocator; private final NodeLocator temporaryParentNodeLocator;
private final QName temporaryRenditionLinkType; private final QName temporaryRenditionLinkType;
/** /**
* Injects the nodeService bean. * Injects the nodeService bean.
@@ -376,9 +376,9 @@ 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)
{ {
if (nodeService.exists(sourceNode) == true) if (nodeService.exists(sourceNode) == true)
@@ -387,18 +387,18 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Rendering node ").append(sourceNode).append(" with rendition definition ").append( msg.append("Rendering node ").append(sourceNode).append(" with rendition definition ").append(
renditionDef.getRenditionName()); renditionDef.getRenditionName());
msg.append("\n").append(" parameters:").append("\n"); msg.append("\n").append(" parameters:").append("\n");
if (renditionDef.getParameterValues().isEmpty() == false) if (renditionDef.getParameterValues().isEmpty() == false)
{ {
for (String paramKey : renditionDef.getParameterValues().keySet()) for (String paramKey : renditionDef.getParameterValues().keySet())
{ {
msg.append(" ").append(paramKey).append("=").append(renditionDef.getParameterValue(paramKey)).append("\n"); msg.append(" ").append(paramKey).append("=").append(renditionDef.getParameterValue(paramKey)).append("\n");
} }
} }
else else
{ {
msg.append(" [None]"); msg.append(" [None]");
} }
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
@@ -419,22 +419,22 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
@Override @Override
public Void doWork() throws Exception public Void doWork() throws Exception
{ {
ChildAssociationRef result = null; ChildAssociationRef result = null;
try try
{ {
// Check whether this rendition is a component of a larger CompositeRendition // Check whether this rendition is a component of a larger CompositeRendition
boolean isComponentRendition = isComponentRendition(renditionDef); boolean isComponentRendition = isComponentRendition(renditionDef);
if (isComponentRendition == false) if (isComponentRendition == false)
{ {
// Request that the rendition is initially created // Request that the rendition is initially created
// as a child of the source node // as a child of the source node
setTemporaryRenditionProperties(sourceNode, renditionDef); setTemporaryRenditionProperties(sourceNode, renditionDef);
} }
// Have the concrete implementation do the actual rendition // Have the concrete implementation do the actual rendition
executeRenditionImpl(renditionDef, sourceNode); executeRenditionImpl(renditionDef, sourceNode);
// //
if (isComponentRendition == false) if (isComponentRendition == false)
{ {
// Add renditioned aspect to the source node // Add renditioned aspect to the source node
@@ -446,21 +446,21 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
// So, have the correct node created, and switch everything to use it // So, have the correct node created, and switch everything to use it
switchToFinalRenditionNode(renditionDef, sourceNode); switchToFinalRenditionNode(renditionDef, sourceNode);
} }
// 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);
} }
if (result != null) if (result != null)
{ {
notifyCallbackOfResult(renditionDef, result); notifyCallbackOfResult(renditionDef, result);
} }
return null; return null;
} }
}, runAsName); }, runAsName);
} }
else else
@@ -482,23 +482,23 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
* @param action * @param action
* @return * @return
*/ */
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;
} }
protected void executeRenditionImpl(Action action, NodeRef sourceNode) protected void executeRenditionImpl(Action action, NodeRef sourceNode)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Executing rendering engine; name:") msg.append("Executing rendering engine; name:")
.append(this.name).append(", class:") .append(this.name).append(", class:")
.append(this.getClass().getName()); .append(this.getClass().getName());
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
checkParameterValues(action); checkParameterValues(action);
RenditionDefinition renditionDefinition = checkActionIsRenditionDefinition(action); RenditionDefinition renditionDefinition = checkActionIsRenditionDefinition(action);
checkSourceNodeExists(sourceNode); checkSourceNodeExists(sourceNode);
@@ -639,13 +639,13 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
getParamDisplayLabel(PARAM_DESTINATION_PATH_TEMPLATE))); getParamDisplayLabel(PARAM_DESTINATION_PATH_TEMPLATE)));
paramList.add(new ParameterDefinitionImpl(PARAM_ORPHAN_EXISTING_RENDITION, DataTypeDefinition.BOOLEAN, false, paramList.add(new ParameterDefinitionImpl(PARAM_ORPHAN_EXISTING_RENDITION, DataTypeDefinition.BOOLEAN, false,
getParamDisplayLabel(PARAM_ORPHAN_EXISTING_RENDITION))); getParamDisplayLabel(PARAM_ORPHAN_EXISTING_RENDITION)));
paramList.add(new ParameterDefinitionImpl(PARAM_RESULT, DataTypeDefinition.CHILD_ASSOC_REF, false, paramList.add(new ParameterDefinitionImpl(PARAM_RESULT, DataTypeDefinition.CHILD_ASSOC_REF, false,
getParamDisplayLabel(PARAM_RESULT))); getParamDisplayLabel(PARAM_RESULT)));
paramList.add(new ParameterDefinitionImpl(PARAM_IS_COMPONENT_RENDITION, DataTypeDefinition.BOOLEAN, false, paramList.add(new ParameterDefinitionImpl(PARAM_IS_COMPONENT_RENDITION, DataTypeDefinition.BOOLEAN, false,
getParamDisplayLabel(PARAM_IS_COMPONENT_RENDITION))); getParamDisplayLabel(PARAM_IS_COMPONENT_RENDITION)));
return paramList; return paramList;
} }
@@ -779,11 +779,11 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
*/ */
public synchronized ChildAssociationRef getChildAssociationRef() public synchronized ChildAssociationRef getChildAssociationRef()
{ {
if (this.caNodeRef == null) if (this.caNodeRef == null)
{ {
this.caNodeRef = createRenditionNodeAssoc(sourceNode, definition); this.caNodeRef = createRenditionNodeAssoc(sourceNode, definition);
} }
return this.caNodeRef; return this.caNodeRef;
} }
/** /**
@@ -883,7 +883,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
protected void notifyCallbackOfException(RenditionDefinition renditionDefinition, Throwable t) protected void notifyCallbackOfException(RenditionDefinition renditionDefinition, Throwable t)
{ {
// Rendition has failed. If there is a callback, it needs to be notified // Rendition has failed. If there is a callback, it needs to be notified
if (renditionDefinition != null) if (renditionDefinition != null)
{ {
RenderCallback callback = renditionDefinition.getCallback(); RenderCallback callback = renditionDefinition.getCallback();
@@ -896,7 +896,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
protected void throwWrappedException(Throwable t) protected void throwWrappedException(Throwable t)
{ {
// and rethrow Exception // and rethrow Exception
if (t instanceof AlfrescoRuntimeException) if (t instanceof AlfrescoRuntimeException)
{ {
throw (AlfrescoRuntimeException) t; throw (AlfrescoRuntimeException) t;
@@ -1097,7 +1097,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
if (executionSummaries.size() > 1) if (executionSummaries.size() > 1)
{ {
throw new ActionServiceException("getExecutionSummary not supported for " + throw new ActionServiceException("getExecutionSummary not supported for " +
"multiple instances of the same action"); "multiple instances of the same action");
} }
return executionSummaries.iterator().next(); return executionSummaries.iterator().next();
} }