|
|
|
@ -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> 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;
|
|
|
|
|
}
|
|
|
|
|