git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@173481 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
715e845187
commit
6d3d9e2faa
|
@ -8,6 +8,7 @@ import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
|||
import org.gcube.common.storagehub.model.acls.ACL;
|
||||
import org.gcube.common.storagehub.model.acls.AccessType;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.GCubeItem;
|
||||
|
||||
public class FolderContainer extends ItemContainer<FolderItem>{
|
||||
|
||||
|
@ -42,6 +43,11 @@ public class FolderContainer extends ItemContainer<FolderItem>{
|
|||
return new FolderContainer(itemclient, newFolderId);
|
||||
}
|
||||
|
||||
public GenericItemContainer newGcubeItem(GCubeItem item) throws Exception {
|
||||
String itemId = itemclient.createGcubeItem(this.itemId, item);
|
||||
return new GenericItemContainer(itemclient, itemId);
|
||||
}
|
||||
|
||||
public List<ACL> getAcls() throws Exception {
|
||||
return itemclient.getACL(this.itemId);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.gcube.common.storagehub.model.acls.ACL;
|
|||
import org.gcube.common.storagehub.model.acls.AccessType;
|
||||
import org.gcube.common.storagehub.model.annotations.RootNode;
|
||||
import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
|
||||
import org.gcube.common.storagehub.model.items.GCubeItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
import org.gcube.common.storagehub.model.service.ItemList;
|
||||
import org.gcube.common.storagehub.model.service.ItemWrapper;
|
||||
|
@ -497,6 +498,34 @@ public class DefaultItemManager implements ItemManagerClient {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createGcubeItem(String parentId, GCubeItem item) {
|
||||
Call<GXWebTargetAdapterRequest, String> call = new Call<GXWebTargetAdapterRequest, String>() {
|
||||
@Override
|
||||
public String call(GXWebTargetAdapterRequest manager) throws Exception {
|
||||
GXWebTargetAdapterRequest myManager = manager.path(parentId)
|
||||
.path("create").path("GCUBEITEM");
|
||||
|
||||
|
||||
GXInboundResponse response = myManager.post(Entity.json(item));
|
||||
|
||||
if (response.isErrorResponse()) {
|
||||
if (response.hasException())
|
||||
throw response.getException();
|
||||
else
|
||||
throw new BackendGenericError();
|
||||
}
|
||||
|
||||
return response.getSource().readEntity(String.class);
|
||||
}
|
||||
};
|
||||
try {
|
||||
return delegate.make(call);
|
||||
}catch(Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String shareFolder(String id, Set<String> users, AccessType accessType) {
|
||||
Call<GXWebTargetAdapterRequest, String> call = new Call<GXWebTargetAdapterRequest, String>() {
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.gcube.common.storagehub.client.StreamDescriptor;
|
|||
import org.gcube.common.storagehub.model.Metadata;
|
||||
import org.gcube.common.storagehub.model.acls.ACL;
|
||||
import org.gcube.common.storagehub.model.acls.AccessType;
|
||||
import org.gcube.common.storagehub.model.items.GCubeItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
import org.gcube.common.storagehub.model.service.Version;
|
||||
|
||||
|
@ -66,4 +67,6 @@ public interface ItemManagerClient {
|
|||
|
||||
String setMetadata(String id,Metadata metadata);
|
||||
|
||||
String createGcubeItem(String parentId, GCubeItem item);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue