diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java index f7a5d27..df7c417 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java @@ -167,6 +167,20 @@ public class StorageHubClientService { } + + /** + * Checks if is item shared. + * + * @param itemId the item id + * @return true, if is item shared + * @throws Exception the exception + */ + public boolean isItemShared(String itemId) throws Exception { + setContextProviders(scope, authorizationToken); + return shcClient.open(itemId).asItem().get().isShared(); + + } + /** * Gets the root shared folder. * diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java index 18c47c4..762e66c 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java @@ -507,6 +507,25 @@ public final class WorkspaceStorageHubClientService implements Workspace{ } + /** + * Checks if is item shared. + * + * @param itemId the item id + * @return true, if is item shared + * @throws Exception the exception + */ + public boolean isItemShared(String itemId) throws Exception { + Validate.notNull(itemId,"The input itemId is null"); + try{ + return storageHubClientService.isItemShared(itemId); + + }catch(Exception e){ + throw new Exception("Error cheking if the item is shared: "+e.getMessage()); + } + + } + + diff --git a/src/main/java/org/gcube/common/storagehubwrapper/shared/tohl/WorkspaceItemType.java b/src/main/java/org/gcube/common/storagehubwrapper/shared/tohl/WorkspaceItemType.java index 5b7ff74..9cee96b 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/shared/tohl/WorkspaceItemType.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/shared/tohl/WorkspaceItemType.java @@ -43,8 +43,6 @@ public enum WorkspaceItemType { */ TRASH_ITEM, - VRE_FOLDER; - } \ No newline at end of file