From a6dceeec837e7102699bfeed49ceed1a1c4e1c78 Mon Sep 17 00:00:00 2001 From: Lucio Lelii Date: Tue, 18 Dec 2018 15:24:08 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@175990 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/dsl/FolderContainer.java | 7 ++++++- .../client/proxies/DefaultItemManager.java | 20 +++++++++++++++++-- .../client/proxies/ItemManagerClient.java | 5 ++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java b/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java index 26e2444..1adc9c0 100644 --- a/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java +++ b/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java @@ -39,7 +39,12 @@ public class FolderContainer extends ItemContainer{ } public FolderContainer newFolder(String name, String description) throws Exception { - String newFolderId = itemclient.createFolder(this.itemId, name, description); + String newFolderId = itemclient.createFolder(this.itemId, name, description, false); + return new FolderContainer(itemclient, newFolderId); + } + + public FolderContainer newHiddenFolder(String name, String description) throws Exception { + String newFolderId = itemclient.createFolder(this.itemId, name, description, true); return new FolderContainer(itemclient, newFolderId); } diff --git a/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java b/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java index 107bbd7..906583e 100644 --- a/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java +++ b/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java @@ -491,19 +491,35 @@ public class DefaultItemManager implements ItemManagerClient { } } + @Override + @Deprecated + public String createFolder(String parentId, String name, String description) { + Call call = new Call() { + @Override + public String call(GXWebTargetAdapterRequest manager) throws Exception { + return createFolder(parentId, name, description, false); + } + }; + try { + return delegate.make(call); + }catch(Exception e) { + throw new RuntimeException(e); + } + } @Override - public String createFolder(String parentId, String name, String description) { + public String createFolder(String parentId, String name, String description, boolean hidden) { Call call = new Call() { @Override public String call(GXWebTargetAdapterRequest manager) throws Exception { GXWebTargetAdapterRequest myManager = manager.path(parentId) .path("create").path("FOLDER"); - MultivaluedMap formData = new MultivaluedHashMap(); + MultivaluedMap formData = new MultivaluedHashMap(); formData.add("name", name); formData.add("description", description); + formData.add("hidden", hidden); GXInboundResponse response = myManager.post(Entity.entity(formData, MediaType.APPLICATION_FORM_URLENCODED)); diff --git a/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java b/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java index 87e8394..d3d818c 100644 --- a/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java +++ b/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java @@ -37,8 +37,11 @@ public interface ItemManagerClient { String uploadFile(InputStream stream, String parentId, String fileName, String description); - String createFolder(String parentId, String name, String description); + String createFolder(String parentId, String name, String description, boolean hidden); + @Deprecated + String createFolder(String parentId, String name, String description); + List getACL(String id); void delete(String id);