718: Workspace: breadcrumb problem on VRE Folders after a two consecutive selection

Task-Url: https://support.d4science.org/issues/718

Fixed method getChildrenSubTreeToRootByIdentifier

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@118956 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-09-18 15:19:09 +00:00
parent b47f382b2a
commit a6be5fbd63
3 changed files with 22 additions and 5 deletions

View File

@ -217,5 +217,7 @@ public class ConstantsExplorer {
//PROPERTY
public static final String SPECIALFOLDERNAME = "SPECIALFOLDERNAME";
public static final String SPECIALFOLDERNAMEPROPERTIESFILE = "specialfoldername.properties";
public static final String MY_SPECIAL_FOLDERS = "MySpecialFolders";
}

View File

@ -94,6 +94,9 @@ import com.thoughtworks.xstream.XStream;
*/
public class GWTWorkspaceBuilder {
/**
*
*/
protected static final String IMAGE_SERVICE_URL = "ImageService";
protected static Logger logger = Logger.getLogger(GWTWorkspaceBuilder.class);
private InfoContactModel userLogged;
@ -1255,7 +1258,7 @@ public class GWTWorkspaceBuilder {
logger.debug("shared.getDisplayName(): "+shared.getDisplayName());
//MANAGEMENT SPECIAL FOLDER
}else if(wsFolder.getName().compareTo("MySpecialFolders")==0 && wsFolder.getParent()!=null && wsFolder.getParent().isRoot()){
}else if(wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS)==0 && wsFolder.getParent()!=null && wsFolder.getParent().isRoot()){
//MANAGEMENT SPECIAL FOLDER
logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: "+specialFolderName);
if(specialFolderName!=null && !specialFolderName.isEmpty())

View File

@ -1003,13 +1003,25 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Collections.reverse(listSubTree); //reverse order of array
//SET THE ROOT
if(listSubTree.size()>0){
workspaceLogger.trace("set: "+listSubTree.get(0).getParent().getName() +" as root");
int lenght = listSubTree.size();
if(lenght>0){
FolderModel firstLevel = listSubTree.get(0).getParent(); //get root
workspaceLogger.trace("set: "+firstLevel.getName() +" as root");
listSubTree.get(0).getParent().setIsRoot(true);
//IF IT CASE - REWRITE SPECIAL FOLDER NAME
if(lenght>1){
FolderModel wsFolder = listSubTree.get(1).getParent(); //get first child
String nameSpecialFolder = getNameForSpecialFolder();
if(wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS)==0 && firstLevel.isRoot()){
//MANAGEMENT SPECIAL FOLDER
workspaceLogger.debug("getChildrenSubTreeToRootByIdentifier MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: "+nameSpecialFolder);
if(nameSpecialFolder!=null && !nameSpecialFolder.isEmpty())
listSubTree.get(1).getParent().setName(nameSpecialFolder);
}
}
}
workspaceLogger.trace("getChildrenSubTreeToRootByIdentifier returning list SubTree: "+listSubTree);
workspaceLogger.trace("getChildrenSubTreeToRootByIdentifier returning list SubTree: "+listSubTree);
} catch (Exception e) {
workspaceLogger.error("Error in server find Item", e);
throw new Exception(e.getMessage());