From 27e356be521e779af74814863308bef85ef822e1 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 23 Feb 2021 18:17:53 +0100 Subject: [PATCH] setting title instead of name --- .../server/utils/WorkspaceUtils.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 84fec73..8b35843 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 @@ -114,6 +114,11 @@ public class WorkspaceUtils { WorkspaceItem originalFolderOrFile = workspace.getItem(folderId); logger.debug("Item retrieved is " + originalFolderOrFile); + + String title = originalFolderOrFile.getTitle() != null && !originalFolderOrFile.getTitle().isEmpty() + ? originalFolderOrFile.getTitle() + : originalFolderOrFile.getName(); + title = title.replaceAll(STRIP_NOT_ALPHANUMERIC, " "); if(!originalFolderOrFile.isFolder()){ @@ -124,12 +129,12 @@ public class WorkspaceUtils { resource.setName(originalFolderOrFile.getName()); resource.setOriginalIdInWorkspace(folderId); bean.setResourceRoot(resource); - bean.setTitle(originalFolderOrFile.getName().replaceAll(STRIP_NOT_ALPHANUMERIC, " ")); + bean.setTitle(title); bean.setDescription(originalFolderOrFile.getDescription()); }else{ - String onlyAlphanumericTitle = originalFolderOrFile.getName().replaceAll(STRIP_NOT_ALPHANUMERIC, " "); + String onlyAlphanumericTitle = title; bean.setTitle(onlyAlphanumericTitle); bean.setDescription(originalFolderOrFile.getDescription()); @@ -308,6 +313,7 @@ public class WorkspaceUtils { fullPath = rootElem.getFullPath().substring(0, lastIndex); fullPath = fullPath.replaceAll(pathSeparatorInWs, RESOURCES_NAME_SEPARATOR) + elemName; rootElem.setEditableName(fullPath); + logger.info("Editable name for resource name: "+rootElem.getName()+", is: " + rootElem.getEditableName()); }