Returning property map in case of folder in order to avoid multiple calls to load sync status

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@174303 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-11-21 10:49:19 +00:00
parent 6eeca6b24d
commit 53b60d3e11
2 changed files with 28 additions and 10 deletions

View File

@ -113,6 +113,10 @@ public class HLMapper {
if(metadata!=null)
pm = new PropertyMap(metadata.getValues());
//IN CASE OF EMPTY MAP RETURNS NULL
if(pm!=null && pm.getValues()!=null && pm.getValues().isEmpty())
pm = null;
return pm;
}
@ -247,7 +251,8 @@ public class HLMapper {
//ADDING (GCUBE) PROPERTIES
PropertyMap pm = null;
if(withMapProperties){
if(withMapProperties || isFolder){
//System.out.println("Setting map: "+item.getPropertyMap().getValues());
pm = toPropertyMap(item.getPropertyMap());
}

View File

@ -31,7 +31,11 @@ public class WorkspaceInstance {
public static String USERNAME = "francesco.mangiacrapa";
public static String SCOPE = "/gcube";
public static String TOKEN = "0e2c7963-8d3e-4ea6-a56d-ffda530dd0fa-98187548";
//public static String SCOPE = "/d4science.research-infrastructures.eu";
//public static String TOKEN = "0e2c7963-8d3e-4ea6-a56d-ffda530dd0fa-98187548";
//public static String TOKEN = "bdc2e70f-36c3-4db4-8b03-829a973b3095-98187548"; //PREVRE
public static String TOKEN = "57b42a99-6239-44c4-9a68-591c18363222-843339462"; //BiodiversityLab
public static String FIND_FILE_NAME = "francesco";
@ -56,14 +60,14 @@ public class WorkspaceInstance {
// build();
}
@Test
//@Test
public void getRoot() {
System.out.println("Get Root test");
WorkspaceFolder root;
try {
root = storageHubWrapper.getWorkspace().getRoot();
rootId = root.getId();
System.out.println(root);
System.out.println("The root is:"+root);
}
catch (Exception e) {
// TODO Auto-generated catch block
@ -72,7 +76,7 @@ public class WorkspaceInstance {
}
//@Test
@Test
public void getChildren() throws Exception{
System.out.println("Get children test");
@ -81,13 +85,22 @@ public class WorkspaceInstance {
List<? extends WorkspaceItem> children = storageHubWrapper.getWorkspace().getChildren(root.getId());
int i = 0;
for (WorkspaceItem workspaceItem : children) {
System.out.println(++i+")"+workspaceItem);
System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass());
// System.out.println(++i+")"+workspaceItem);
// System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass());
System.out.println(++i+")");
printMap(workspaceItem);
}
}
@Test
public static void printMap(WorkspaceItem workspaceItem){
if(workspaceItem.getPropertyMap()!=null){
System.out.println(workspaceItem.getId() + " name: "+workspaceItem.getName() + " isFolder: "+workspaceItem.isFolder());
System.out.println("Property Map: "+workspaceItem.getPropertyMap().getValues().toString());
}
}
//@Test
public void getWorkspaceId() {
System.out.println("Getting the workspaceId test");
try {
@ -101,7 +114,7 @@ public class WorkspaceInstance {
}
}
@Test
//@Test
public void getChildrenPerWorkspaceItem() throws InternalErrorException{
System.out.println("Get children test per workspace item");
@ -159,7 +172,7 @@ public class WorkspaceInstance {
}
@Test
//@Test
public void findFileName() throws InternalErrorException{
System.out.println("Find file name test");
getRoot();