This commit is contained in:
Lucio Lelii 2018-03-07 17:45:58 +00:00
parent 21c4195640
commit a4b07aa980
2 changed files with 25 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.common.storagehub.client.StreamDescriptor;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.common.storagehub.model.service.ItemList;
import org.gcube.common.storagehub.model.service.ItemWrapper;
public class DefaultItemManager implements ItemManagerClient {
@ -68,4 +69,26 @@ public class DefaultItemManager implements ItemManagerClient {
}
}
@Override
public Item get(String id, String... excludeNodes) {
Call<WebTarget, ItemWrapper<Item>> call = new Call<WebTarget, ItemWrapper<Item>>() {
@Override
public ItemWrapper<Item> call(WebTarget manager) throws Exception {
WebTarget myManager = manager.path(id);
if (excludeNodes !=null && excludeNodes.length>0)
myManager = myManager.queryParam("exclude",excludeNodes);
Invocation.Builder builder = myManager.request(MediaType.APPLICATION_JSON);
ItemWrapper<Item> response = builder.get(ItemWrapper.class);
return response;
}
};
try {
ItemWrapper<Item> result = delegate.make(call);
return result.getItem();
}catch(Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,6 +1,5 @@
package org.gcube.common.storagehub.client.proxies;
import java.io.InputStream;
import java.util.List;
import org.gcube.common.storagehub.client.StreamDescriptor;
@ -13,6 +12,8 @@ public interface ItemManagerClient {
//List<? extends Item> listByPath(String path, String ... excludeNodes);
List<? extends Item> getChildren(String id, String ... excludeNodes);
Item get(String id, String ... excludeNodes);
StreamDescriptor download(String id);