git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@169491 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b6824fa421
commit
a95d6b2ccb
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.common.storagehub.client.dsl;
|
||||
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
|
||||
public class GenericItemContainer extends ItemContainer<Item> {
|
||||
|
@ -16,5 +17,9 @@ public class GenericItemContainer extends ItemContainer<Item> {
|
|||
public ContainerType getType() {
|
||||
return ContainerType.GENERIC_ITEM;
|
||||
}
|
||||
|
||||
public FolderContainer getRootSharedFolder() {
|
||||
return new FolderContainer(itemclient, (FolderItem)itemclient.getRootSharedFolder(this.itemId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,6 +100,25 @@ public class DefaultItemManager implements ItemManagerClient {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getRootSharedFolder(String id) {
|
||||
Call<WebTarget, ItemWrapper<Item>> call = new Call<WebTarget, ItemWrapper<Item>>() {
|
||||
@Override
|
||||
public ItemWrapper<Item> call(WebTarget manager) throws Exception {
|
||||
WebTarget myManager = manager.path(id).path("rootSharedFolder");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public URL getPublickLink(String id) {
|
||||
|
|
|
@ -36,6 +36,8 @@ public interface ItemManagerClient {
|
|||
|
||||
URL getPublickLink(String id);
|
||||
|
||||
List<? extends Item> findChildrenByNamePattern(String id, String name, String[] excludeNodes);
|
||||
List<? extends Item> findChildrenByNamePattern(String id, String name, String ... excludeNodes);
|
||||
|
||||
Item getRootSharedFolder(String id);
|
||||
|
||||
}
|
||||
|
|
|
@ -62,6 +62,13 @@ public class Items {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete() throws Exception{
|
||||
StorageHubClient shc = new StorageHubClient();
|
||||
shc.open("8dc6fca2-f0f5-4813-b854-f12e414e3a28").asFile().delete();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void downloadFile() {
|
||||
StorageHubClient shc = new StorageHubClient();
|
||||
|
|
Loading…
Reference in New Issue