02-20-2013 04:33 PM
NodeRef renderedNode = this.createRendition(node, <path to rendition folder + rendered node name>, <imageMagick command>, "myRendition");
private NodeRef createRendition(NodeRef node, String destination, String command, String rendDefName) {
QName renditionName = QName.createQName(NAMESPACE_URI, rendDefName);
RenditionDefinition renditionDef = renditionService.createRenditionDefinition(QName.createQName(NAMESPACE_URI, rendDefName), ImageRenderingEngine.NAME);
renditionDef.setParameterValue(ImageRenderingEngine.PARAM_COMMAND_OPTIONS, command);
renditionDef.setParameterValue(ImageRenderingEngine.PARAM_ALLOW_ENLARGEMENT, true);
renditionDef.setParameterValue(ImageRenderingEngine.PARAM_AUTO_ORIENTATION, false);
renditionDef.setParameterValue(RenditionService.PARAM_DESTINATION_PATH_TEMPLATE, destination);
renditionDef.setExecuteAsynchronously(false);
// Check for existing rendition for given definition
ChildAssociationRef renNode = renditionService.getRenditionByName(node, renditionName);
if (renNode == null) {
logger.debug("Rendition of type " + renditionName + " does not exist, creating it now.");
logger.debug("Imagemagick command to execute: " + (String) renditionDef.getParameterValue(ImageRenderingEngine.PARAM_COMMAND_OPTIONS));
renNode = renditionService.render(node, renditionDef);
}
return renNode.getChildRef();
}
2013-02-20 22:09:59,348 DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] Existing rendition with name {<NAMESPACE_URI>}myRendition: workspace://SpacesStore/b93c1188-bf8c-45a8-a5b0-becb46aaf4de
2013-02-20 22:09:59,349 DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] Creating/updating rendition based on:
sourceNode: workspace://SpacesStore/361fd807-8666-4fa4-8f6d-ddf1a244bd7d
tempRendition: workspace://SpacesStore/e7e2721b-1853-4dd2-86ce-a87463a4da39
parentNode: workspace://SpacesStore/0679d611-652f-414f-a6eb-03a4c9f83afb
childNode: workspace://SpacesStore/d02aac92-5f4e-475b-834a-f94ae3fd0d15
childName: <renditionImageName>.png
renditionDefinition.name: {<NAMESPACE_URI>}myRendition
2013-02-20 22:09:59,349 DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] The old rendition was not in the correct location
2013-02-20 22:09:59,349 DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] The old rendition does require orphaning.
2013-02-20 22:09:59,349 DEBUG [repo.rendition.RenditionNodeManager] [defaultAsyncAction2] Orphaning old rendition node workspace://SpacesStore/b93c1188-bf8c-45a8-a5b0-becb46aaf4de
2013-02-20 22:09:59,410 ERROR [repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction2] Failed to execute asynchronous action: Action[ id=cce7561e-8795-4d0b-a458-957975a747f7, node=workspace://SpacesStore/cce7561e-8795-4d0b-a458-957975a747f7 ]
org.alfresco.service.cmr.rendition.RenditionServiceException: 01200016 Cannot perform a rendition to an existing rendition node whose source is different.
at org.alfresco.repo.rendition.RenditionNodeManager.checkDestinationNodeIsAcceptable(RenditionNodeManager.java:365)
at org.alfresco.repo.rendition.RenditionNodeManager.getSpecifiedRenditionOrCreateNewRendition(RenditionNodeManager.java:327)
at org.alfresco.repo.rendition.RenditionNodeManager.findOrCreateRenditionNode(RenditionNodeManager.java:157)
at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.createOrUpdateRendition(AbstractRenderingEngine.java:966)
at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.switchToFinalRenditionNode(AbstractRenderingEngine.java:881)
at org.alfresco.repo.rendition.executer.AbstractRenderingEngine$1.doWork(AbstractRenderingEngine.java:437)
at org.alfresco.repo.rendition.executer.AbstractRenderingEngine$1.doWork(AbstractRenderingEngine.java:408)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:516)
at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.executeImpl(AbstractRenderingEngine.java:407)
at org.alfresco.repo.rendition.executer.AbstractRenderingEngine.executeImpl(AbstractRenderingEngine.java:369)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:196)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:790)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:701)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:403)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:259)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:412)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:516)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:415)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
02-20-2013 05:58 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.