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 class ItemContainer { protected ItemManagerClient itemclient; protected String itemId = null; protected I item; protected ItemContainer(ItemManagerClient itemclient, I item) { this.itemclient = itemclient; this.itemId = item.getId(); } protected ItemContainer(ItemManagerClient itemclient, String itemId) { this.itemclient = itemclient; } protected void setItem(I item) { this.item = item; this.itemId = item.getId(); } @SuppressWarnings("unchecked") public I get() throws Exception { if (item==null) return (I)itemclient.get(itemId); else return item; } public StreamDescriptor download() { return itemclient.download(this.itemId); } public List getAnchestors() { return itemclient.getAnchestors(this.itemId, NodeConstants.ACCOUNTING_NAME); } }