Added code to fix null value during breadcrumb request

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@120586 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-12-03 16:36:31 +00:00
parent 2e2993b48c
commit feb8e0647f
2 changed files with 23 additions and 13 deletions

View File

@ -1968,8 +1968,18 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
fileModel.setParentFileModel(parent);
}
// workspaceLogger.trace("list parents returning size: "+arrayParents.length);
// return new ArrayList<FileModel>(Arrays.asList(arrayParents));
workspaceLogger.trace("list parents returning size: "+arrayParents.length);
return new ArrayList<FileModel>(Arrays.asList(arrayParents));
if(arrayParents[0]==null){ //EXIT BY BREAK IN CASE OF SPECIAL FOLDER
List<FileModel> breadcrumbs = new ArrayList<FileModel>(arrayParents.length-1);
for (int i=1; i<arrayParents.length; i++) {
breadcrumbs.add(arrayParents[i]);
}
return breadcrumbs;
}else
return new ArrayList<FileModel>(Arrays.asList(arrayParents));
} catch (Exception e) {
workspaceLogger.error("Error in get List Parents By Item Identifier ", e);

View File

@ -24,10 +24,10 @@ import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
public class SizeRetrieving {
// public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps";
public static String TEST_USER = "yann.laurent";
public static String FOLDER_ID = "4f0ff79d-3c1e-4d2a-bc74-6f731edcac98";
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps";
public static String TEST_USER = "francesco.mangiacrapa";
// public static String FOLDER_ID = "4f0ff79d-3c1e-4d2a-bc74-6f731edcac98";
public static void main(String[] args) {
@ -44,22 +44,22 @@ public class SizeRetrieving {
//
// System.out.println("start get root");
// WorkspaceItem root = ws.getRoot();
WorkspaceItem folder = ws.getRoot();
// List<WorkspaceItem> children = (List<WorkspaceItem>) root.getChildren();
System.out.println("start get children");
WorkspaceFolder folder = (WorkspaceFolder) ws.getItem(FOLDER_ID);
// WorkspaceFolder folder = (WorkspaceFolder) ws.getItem(FOLDER_ID);
List<WorkspaceItem> children = (List<WorkspaceItem>) folder.getChildren();
// List<? extends WorkspaceItem> children = root.getChildren();
System.out.println("children size: "+children.size());
GWTWorkspaceBuilder builder = new GWTWorkspaceBuilder();
// GWTWorkspaceBuilder builder = new GWTWorkspaceBuilder();
//
// builder.buildGXTListFileGridModelItem(children, null);
builder.buildGXTListFileGridModelItem(children, null);
/*
int i=0;
for (WorkspaceItem workspaceItem : children) {
@ -67,10 +67,10 @@ public class SizeRetrieving {
if(workspaceItem.getType().equals(WorkspaceItemType.FOLDER) || workspaceItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
WorkspaceFolder folder = (WorkspaceFolder) workspaceItem;
folder = (WorkspaceFolder) workspaceItem;
System.out.println(++i+") folder name: "+folder.getName());
System.out.println(++i+") folder name: "+folder.getName() +", id: "+folder.getId());
}else{
@ -82,7 +82,7 @@ public class SizeRetrieving {
}
}
}*/
}
System.out.println("end");
} catch (Exception e) {
e.printStackTrace();