2018-04-18 15:55:20 +02:00
|
|
|
package org.gcube.common.storagehub.client.dsl;
|
2018-03-29 18:19:01 +02:00
|
|
|
|
2018-06-15 17:33:13 +02:00
|
|
|
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
|
|
|
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
|
|
|
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
|
|
|
|
import org.gcube.common.storagehub.model.items.Item;
|
|
|
|
|
2018-03-29 18:19:01 +02:00
|
|
|
public class StorageHubClient {
|
|
|
|
|
2018-06-15 17:33:13 +02:00
|
|
|
private WorkspaceManagerClient wsClient = AbstractPlugin.workspace().build();
|
|
|
|
private ItemManagerClient itemclient = AbstractPlugin.item().build();
|
2018-03-29 18:19:01 +02:00
|
|
|
|
2018-06-15 17:33:13 +02:00
|
|
|
public FolderContainer getWSRoot(){
|
|
|
|
return new FolderContainer(itemclient, wsClient.getWorkspace());
|
|
|
|
}
|
2018-03-29 18:19:01 +02:00
|
|
|
|
2018-09-20 14:52:23 +02:00
|
|
|
/* public OpenResolver open(Path relativePath) {
|
2018-06-15 17:33:13 +02:00
|
|
|
Item item = wsClient.retieveItemByPath(relativePath.toPath());
|
|
|
|
return new OpenResolver(item, itemclient);
|
2018-09-20 14:52:23 +02:00
|
|
|
}*/
|
2018-03-29 18:19:01 +02:00
|
|
|
|
2018-06-15 17:33:13 +02:00
|
|
|
public OpenResolver open(String id) {
|
|
|
|
Item item = itemclient.get(id);
|
|
|
|
return new OpenResolver(item, itemclient);
|
|
|
|
}
|
|
|
|
|
2018-09-07 17:42:04 +02:00
|
|
|
public FolderContainer openVREFolder() {
|
|
|
|
return new FolderContainer(itemclient, wsClient.getVreFolder());
|
|
|
|
}
|
2018-06-21 17:08:26 +02:00
|
|
|
|
2018-09-18 14:54:11 +02:00
|
|
|
public FolderContainer openTrash() {
|
|
|
|
return new FolderContainer(itemclient, wsClient.getTrashFolder());
|
|
|
|
}
|
|
|
|
|
2018-09-21 15:28:19 +02:00
|
|
|
public void emptyTrash() {
|
|
|
|
wsClient.emptyTrash();
|
|
|
|
}
|
|
|
|
|
2018-09-24 16:00:41 +02:00
|
|
|
public GenericItemContainer restoreThrashItem(String itemId) {
|
|
|
|
return new GenericItemContainer(itemclient, wsClient.restoreFromTrash(itemId));
|
2018-09-21 15:28:19 +02:00
|
|
|
}
|
|
|
|
|
2018-03-29 18:19:01 +02:00
|
|
|
}
|