diff --git a/.project b/.project
index 123276e..783743b 100644
--- a/.project
+++ b/.project
@@ -16,12 +16,12 @@
- org.eclipse.m2e.core.maven2Builder
+ org.eclipse.wst.validation.validationbuilder
- org.eclipse.wst.validation.validationbuilder
+ org.eclipse.m2e.core.maven2Builder
diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs
new file mode 100644
index 0000000..04cad8c
--- /dev/null
+++ b/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
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 2c7205f..5ef7cea 100644
--- a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java
+++ b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java
@@ -135,23 +135,40 @@ public class StorageHubClientService {
//TODO MAP OF SHARED ROOT ID
+
/**
- * Gets the parents.
+ * Gets the id shared folder.
*
* @param itemId the item id
- * @return the parents
+ * @return the id shared folder
+ * @throws Exception
*/
- public String getIdSharedFolder(String itemId) {
+ public String getIdSharedFolder(String itemId) throws Exception {
setContextProviders(scope, authorizationToken);
- FolderContainer rootSharedFolder = shcClient.open(itemId).asItem().getRootSharedFolder();
- try{
- Validate.notNull(rootSharedFolder, "The root shared folder with id "+itemId+" does not exist");
- return rootSharedFolder.get().getId();
- }catch(Exception e){
+ return getRootSharedFolder(itemId).getId();
+ }
- }
- return null;
+ /**
+ * Gets the root shared folder.
+ *
+ * @param itemId the item id
+ * @return the root shared folder
+ * @throws Exception
+ */
+ public FolderItem getRootSharedFolder(String itemId) throws Exception {
+ setContextProviders(scope, authorizationToken);
+
+ ItemContainer- item = shcClient.open(itemId).asItem();
+ FolderContainer rootSharedFolder = null;
+ if(item.get().isShared()){
+ rootSharedFolder = item.getRootSharedFolder();
+ }else
+ throw new Exception("The item with id: "+itemId +" is not shared");
+
+ Validate.notNull(rootSharedFolder, "The root shared folder with id "+itemId+" does not exist");
+ return rootSharedFolder.get();
+
}
@@ -189,7 +206,8 @@ public class StorageHubClientService {
return null;
}
}catch (Exception e) {
- e.printStackTrace();
+ logger.error("Get VRE Folders Id ",e);
+ //e.printStackTrace();
}
return toReturn;
}