diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java index 378dcab..c82132e 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java @@ -125,16 +125,30 @@ public class StorageHubClientService { return theResolver.getItems(); } + /** - * Gets the children. + * Gets the filtered children. * * @param id the id * @param aType the a type - * @return the children + * @param withAccounting the with accounting + * @param withMapProperties the with map properties + * @return the filtered children */ - public List getFilteredChildren(String id, Class aType){ + public List getFilteredChildren(String id, Class aType, boolean withAccounting, boolean withMapProperties){ setContextProviders(scope, authorizationToken); - return shcClient.open(id).asFolder().list().ofType(aType).withContent().getItems(); + + ListResolver resolverTyped = shcClient.open(id).asFolder().list().ofType(aType); + ListResolver theResolver = resolverTyped.withContent(); + + if(withAccounting) + theResolver = theResolver.withAccounting(); + + if(withMapProperties) + theResolver = theResolver.withMetadata(); + + + return theResolver.getItems(); } diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java index 9d9fc3d..51106bb 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java @@ -293,7 +293,7 @@ public final class WorkspaceStorageHubClientService implements Workspace{ public List getFilteredChildren(String id, Class aType) throws Exception{ Validate.notNull(id,"The input id is null"); - List children = storageHubClientService.getFilteredChildren(id, aType); + List children = storageHubClientService.getFilteredChildren(id, aType, withAccounting, withMapProperties); List toChildren = new ArrayList(children.size()); for (Item item : children) { diff --git a/src/test/java/WorkspaceInstance.java b/src/test/java/WorkspaceInstance.java index 9ebac20..4a9155c 100644 --- a/src/test/java/WorkspaceInstance.java +++ b/src/test/java/WorkspaceInstance.java @@ -91,15 +91,15 @@ public class WorkspaceInstance { int i = 0; for (WorkspaceItem workspaceItem : children) { -// System.out.println(++i+")"+workspaceItem); -// System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass()); - System.out.println(++i+")"); + System.out.println(++i+")"+workspaceItem); + System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass()); - if(workspaceItem.isFolder()){ - WorkspaceFolder folder = (WorkspaceFolder) workspaceItem; - System.out.println("is public? "+folder.isPublicFolder()); - } +// System.out.println(++i+")"); +// if(workspaceItem.isFolder()){ +// WorkspaceFolder folder = (WorkspaceFolder) workspaceItem; +// System.out.println("is public? "+folder.isPublicFolder()); +// } //printMap(workspaceItem); }