This commit is contained in:
Lucio Lelii 2018-06-21 10:08:31 +00:00
parent dc1fdecdf2
commit 6975c5648a
3 changed files with 17 additions and 3 deletions

View File

@ -4,7 +4,6 @@ import java.io.InputStream;
import java.util.List;
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
import org.gcube.common.storagehub.model.items.AbstractFileItem;
import org.gcube.common.storagehub.model.items.FolderItem;
import org.gcube.common.storagehub.model.items.Item;
@ -37,4 +36,9 @@ public class FolderContainer extends ItemContainer<FolderItem>{
return itemclient.uploadFile(stream, this.itemId , filename, description);
}
public FolderContainer newFolder(String name, String description) throws Exception {
String newFolderId = itemclient.createFolder(this.itemId, name, description);
return new FolderContainer(itemclient, newFolderId);
}
}

View File

@ -1,10 +1,13 @@
package org.gcube.common.storagehub.client.dsl;
import java.util.List;
import org.gcube.common.storagehub.client.StreamDescriptor;
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
import org.gcube.common.storagehub.model.NodeConstants;
import org.gcube.common.storagehub.model.items.Item;
public abstract class ItemContainer<I extends Item> {
public class ItemContainer<I extends Item> {
protected ItemManagerClient itemclient;
@ -29,4 +32,8 @@ public abstract class ItemContainer<I extends Item> {
return itemclient.download(this.itemId);
}
public List<? extends Item> getAnchestors() {
return itemclient.getAnchestors(this.itemId, NodeConstants.ACCOUNTING_NAME);
}
}

View File

@ -21,5 +21,8 @@ public class OpenResolver {
else throw new RuntimeException("this item is not a folder");
}
public ItemContainer<Item> asItem() {
return new ItemContainer<Item>(itemclient, item);
}
}