From 5c87d5eb87bee60936ba8f708b10d3df8fa1b580 Mon Sep 17 00:00:00 2001 From: Brian Remmington Date: Fri, 30 Apr 2010 12:11:57 +0000 Subject: [PATCH] Fixed a bug that shows itself when placing a new rendition directly under Company Home, and also tweaked the name of the "companyHome" object on the path template model to be "companyhome" to be consistent with the naming in the script API. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20056 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../StandardRenditionLocationResolverImpl.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java b/source/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java index 0dd5d082f6..d7719f2a69 100644 --- a/source/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java +++ b/source/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java @@ -144,11 +144,16 @@ public class StandardRenditionLocationResolverImpl implements RenditionLocationR { throw new RenditionServiceException("The path must include a valid filename! Path: " + path); } + FileFolderService fileFolderService = serviceRegistry.getFileFolderService(); - FileInfo parentInfo = FileFolderServiceImpl.makeFolders(fileFolderService, - companyHome, folderElements, - ContentModel.TYPE_FOLDER); - NodeRef parent = parentInfo.getNodeRef(); + NodeRef parent = companyHome; + if (!folderElements.isEmpty()) + { + FileInfo parentInfo = FileFolderServiceImpl.makeFolders(fileFolderService, + companyHome, folderElements, + ContentModel.TYPE_FOLDER); + parent = parentInfo.getNodeRef(); + } NodeRef child = fileFolderService.searchSimple(parent, fileName); return new RenditionLocationImpl(parent, child, fileName); } @@ -200,7 +205,9 @@ public class StandardRenditionLocationResolverImpl implements RenditionLocationR root.put("extension", sourceExtension); root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME)); root.put("cwd", cwd); - root.put("companyHome", new TemplateNode(companyHome, serviceRegistry, null)); + TemplateNode companyHomeNode = new TemplateNode(companyHome, serviceRegistry, null); + root.put("companyHome", companyHomeNode); + root.put("companyhome", companyHomeNode); //Added this to be consistent with the script API root.put("sourceNode", new TemplateNode(sourceNode, serviceRegistry, null)); root.put("sourceContentType", nodeService.getType(sourceNode).getLocalName()); root.put("renditionContentType", nodeService.getType(tempRenditionLocation).getLocalName());