added parameters withAccounting, withMapProperties to get filtered list

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@174322 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-11-22 13:35:01 +00:00
parent 657327f6fa
commit 3943333a7c
3 changed files with 26 additions and 12 deletions

View File

@ -125,16 +125,30 @@ public class StorageHubClientService {
return theResolver.getItems(); return theResolver.getItems();
} }
/** /**
* Gets the children. * Gets the filtered children.
* *
* @param id the id * @param id the id
* @param aType the a type * @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<? extends Item> getFilteredChildren(String id, Class<? extends Item> aType){ public List<? extends Item> getFilteredChildren(String id, Class<? extends Item> aType, boolean withAccounting, boolean withMapProperties){
setContextProviders(scope, authorizationToken); 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();
} }

View File

@ -293,7 +293,7 @@ public final class WorkspaceStorageHubClientService implements Workspace{
public List<? extends WorkspaceItem> getFilteredChildren(String id, Class<? extends Item> aType) throws Exception{ public List<? extends WorkspaceItem> getFilteredChildren(String id, Class<? extends Item> aType) throws Exception{
Validate.notNull(id,"The input id is null"); Validate.notNull(id,"The input id is null");
List<? extends Item> children = storageHubClientService.getFilteredChildren(id, aType); List<? extends Item> children = storageHubClientService.getFilteredChildren(id, aType, withAccounting, withMapProperties);
List<WorkspaceItem> toChildren = new ArrayList<WorkspaceItem>(children.size()); List<WorkspaceItem> toChildren = new ArrayList<WorkspaceItem>(children.size());
for (Item item : children) { for (Item item : children) {

View File

@ -91,15 +91,15 @@ public class WorkspaceInstance {
int i = 0; int i = 0;
for (WorkspaceItem workspaceItem : children) { for (WorkspaceItem workspaceItem : children) {
// System.out.println(++i+")"+workspaceItem); System.out.println(++i+")"+workspaceItem);
// System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass()); System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass());
System.out.println(++i+")");
if(workspaceItem.isFolder()){ // System.out.println(++i+")");
WorkspaceFolder folder = (WorkspaceFolder) workspaceItem; // if(workspaceItem.isFolder()){
System.out.println("is public? "+folder.isPublicFolder()); // WorkspaceFolder folder = (WorkspaceFolder) workspaceItem;
} // System.out.println("is public? "+folder.isPublicFolder());
// }
//printMap(workspaceItem); //printMap(workspaceItem);
} }