setting title instead of name

This commit is contained in:
Francesco Mangiacrapa 2021-02-23 18:17:53 +01:00
parent 32b68f5f60
commit 27e356be52
1 changed files with 8 additions and 2 deletions

View File

@ -114,6 +114,11 @@ public class WorkspaceUtils {
WorkspaceItem originalFolderOrFile = workspace.getItem(folderId); WorkspaceItem originalFolderOrFile = workspace.getItem(folderId);
logger.debug("Item retrieved is " + originalFolderOrFile); 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()){ if(!originalFolderOrFile.isFolder()){
@ -124,12 +129,12 @@ public class WorkspaceUtils {
resource.setName(originalFolderOrFile.getName()); resource.setName(originalFolderOrFile.getName());
resource.setOriginalIdInWorkspace(folderId); resource.setOriginalIdInWorkspace(folderId);
bean.setResourceRoot(resource); bean.setResourceRoot(resource);
bean.setTitle(originalFolderOrFile.getName().replaceAll(STRIP_NOT_ALPHANUMERIC, " ")); bean.setTitle(title);
bean.setDescription(originalFolderOrFile.getDescription()); bean.setDescription(originalFolderOrFile.getDescription());
}else{ }else{
String onlyAlphanumericTitle = originalFolderOrFile.getName().replaceAll(STRIP_NOT_ALPHANUMERIC, " "); String onlyAlphanumericTitle = title;
bean.setTitle(onlyAlphanumericTitle); bean.setTitle(onlyAlphanumericTitle);
bean.setDescription(originalFolderOrFile.getDescription()); bean.setDescription(originalFolderOrFile.getDescription());
@ -308,6 +313,7 @@ public class WorkspaceUtils {
fullPath = rootElem.getFullPath().substring(0, lastIndex); fullPath = rootElem.getFullPath().substring(0, lastIndex);
fullPath = fullPath.replaceAll(pathSeparatorInWs, RESOURCES_NAME_SEPARATOR) + elemName; fullPath = fullPath.replaceAll(pathSeparatorInWs, RESOURCES_NAME_SEPARATOR) + elemName;
rootElem.setEditableName(fullPath); rootElem.setEditableName(fullPath);
logger.info("Editable name for resource name: "+rootElem.getName()+", is: " + rootElem.getEditableName());
} }