Added method canWrite to interface

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@181696 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-09-16 10:25:15 +00:00
parent d4d9dee81d
commit ecf5bb0950
3 changed files with 43 additions and 6 deletions

View File

@ -305,7 +305,21 @@ public class StorageHubClientService {
return shcClient.open(itemId).asItem().get().isShared();
}
/**
* Can write.
*
* @param folderContainerId the folder container id
* @return true, if true. Otherwise false.
* @throws Exception the exception
*/
public boolean canWrite(String folderContainerId) throws Exception {
setContextProviders(scope, authorizationToken);
return shcClient.open(folderContainerId).asFolder().canWrite();
}
/**
* Gets the root shared folder.
*
@ -849,7 +863,7 @@ public class StorageHubClientService {
* @param folderId the folder id
* @param setPublic the set public
* @return boolean value of isPublicItem()
* @throws Exception
* @throws Exception the exception
*/
public boolean setFolderAsPublic(String folderId, boolean setPublic) throws Exception {
Validate.notNull(folderId, "Bad request to setFolderAsPublic the folderId is null");

View File

@ -1071,10 +1071,8 @@ public final class WorkspaceStorageHubClientService implements Workspace{
return HLMapper.toURLFile(extLink);
}
/* (non-Javadoc)
* @see org.gcube.common.storagehubwrapper.server.tohl.Workspace#setFolderAsPublic(java.lang.String, boolean)
*/
@ -1097,7 +1095,23 @@ public final class WorkspaceStorageHubClientService implements Workspace{
}else
throw new Exception("The item with id '"+folderId+"' is not a folder");
}
/**
* Can user write into folder.
*
* @param folderId the folder id
* @return true, if successful
* @throws Exception the exception
*/
@Override
public boolean canUserWriteIntoFolder(String folderId) throws Exception{
WorkspaceItem item = getItem(folderId);
if (item.isFolder()) {
return storageHubClientService.canWrite(folderId);
}else
throw new Exception("The item with id '"+folderId+"' is not a folder");
}

View File

@ -489,6 +489,15 @@ public interface Workspace{
InternalErrorException, ItemAlreadyExistException,
InsufficientPrivilegesException, Exception;
/**
* Can user write into folder.
*
* @param folderId the folder id
* @return true, if successful
* @throws Exception the exception
*/
boolean canUserWriteIntoFolder(String folderId) throws Exception;
/*
*
*