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:
parent
13b24671a7
commit
3bb6a3155f
|
@ -231,14 +231,12 @@ public class WorkspaceUtils {
|
||||||
if(originalItem.isFolder()){
|
if(originalItem.isFolder()){
|
||||||
copiedFolder = userCatalogue.addWorkspaceItem(folderOrFileId, userCatalogue.getId()); // add to .catalogue root area
|
copiedFolder = userCatalogue.addWorkspaceItem(folderOrFileId, userCatalogue.getId()); // add to .catalogue root area
|
||||||
copiedFolder.setDescription(bean.getDescription());
|
copiedFolder.setDescription(bean.getDescription());
|
||||||
|
((WorkspaceFolder)copiedFolder).rename(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
copiedFolder = userCatalogue.createFolder(UtilMethods.fromProductTitleToName(bean.getTitle()) + "_" + referenceTime, bean.getDescription());
|
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
|
// retrieve the children
|
||||||
List<ResourceElementBean> resourcesToAdd = rootResource.getChildren();
|
List<ResourceElementBean> resourcesToAdd = rootResource.getChildren();
|
||||||
|
|
||||||
|
@ -257,7 +255,7 @@ public class WorkspaceUtils {
|
||||||
|
|
||||||
resources.add(new ResourceBean(
|
resources.add(new ResourceBean(
|
||||||
copiedFile.getPublicLink(true),
|
copiedFile.getPublicLink(true),
|
||||||
resource.getName(),
|
resource.getEditableName(),
|
||||||
copiedFile.getDescription(),
|
copiedFile.getDescription(),
|
||||||
copiedFile.getId(),
|
copiedFile.getId(),
|
||||||
userName,
|
userName,
|
||||||
|
@ -265,7 +263,7 @@ public class WorkspaceUtils {
|
||||||
((FolderItem)copiedFile).getMimeType()));
|
((FolderItem)copiedFile).getMimeType()));
|
||||||
|
|
||||||
// postpone rename operation
|
// postpone rename operation
|
||||||
copiedFile.rename(resource.getName() + "_" + referenceTime);
|
copiedFile.rename(resource.getEditableName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue