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
This commit is contained in:
Costantino Perciante 2017-05-24 14:23:32 +00:00
parent 13b24671a7
commit 3bb6a3155f
1 changed files with 3 additions and 5 deletions

View File

@ -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<ResourceElementBean> 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());
}
}