From 3bb6a3155fa5155f52bfc6529972b71ea35791e7 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Wed, 24 May 2017 14:23:32 +0000 Subject: [PATCH] fixed resource copy from workspace to ckan git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@148991 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/utils/WorkspaceUtils.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java index 15c97d6..5c838b0 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java @@ -231,14 +231,12 @@ public class WorkspaceUtils { if(originalItem.isFolder()){ copiedFolder = userCatalogue.addWorkspaceItem(folderOrFileId, userCatalogue.getId()); // add to .catalogue root area copiedFolder.setDescription(bean.getDescription()); + ((WorkspaceFolder)copiedFolder).rename(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime); } else{ copiedFolder = userCatalogue.createFolder(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime, bean.getDescription()); } - // change name of the copied folder to match the title (append the timestamp to avoid ties) - ((WorkspaceFolder)copiedFolder).rename(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime); - // retrieve the children List resourcesToAdd = rootResource.getChildren(); @@ -257,7 +255,7 @@ public class WorkspaceUtils { resources.add(new ResourceBean( copiedFile.getPublicLink(true), - resource.getName(), + resource.getEditableName(), copiedFile.getDescription(), copiedFile.getId(), userName, @@ -265,7 +263,7 @@ public class WorkspaceUtils { ((FolderItem)copiedFile).getMimeType())); // postpone rename operation - copiedFile.rename(resource.getName() + "_" + referenceTime); + copiedFile.rename(resource.getEditableName()); } }