git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@164797 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
21c4195640
commit
a4b07aa980
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue