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:
parent
d4d9dee81d
commit
ecf5bb0950
|
@ -306,6 +306,20 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Gets the root shared folder.
|
||||||
*
|
*
|
||||||
|
@ -849,7 +863,7 @@ public class StorageHubClientService {
|
||||||
* @param folderId the folder id
|
* @param folderId the folder id
|
||||||
* @param setPublic the set public
|
* @param setPublic the set public
|
||||||
* @return boolean value of isPublicItem()
|
* @return boolean value of isPublicItem()
|
||||||
* @throws Exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public boolean setFolderAsPublic(String folderId, boolean setPublic) throws Exception {
|
public boolean setFolderAsPublic(String folderId, boolean setPublic) throws Exception {
|
||||||
Validate.notNull(folderId, "Bad request to setFolderAsPublic the folderId is null");
|
Validate.notNull(folderId, "Bad request to setFolderAsPublic the folderId is null");
|
||||||
|
|
|
@ -1073,8 +1073,6 @@ public final class WorkspaceStorageHubClientService implements Workspace{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.common.storagehubwrapper.server.tohl.Workspace#setFolderAsPublic(java.lang.String, boolean)
|
* @see org.gcube.common.storagehubwrapper.server.tohl.Workspace#setFolderAsPublic(java.lang.String, boolean)
|
||||||
*/
|
*/
|
||||||
|
@ -1098,6 +1096,22 @@ public final class WorkspaceStorageHubClientService implements Workspace{
|
||||||
throw new Exception("The item with id '"+folderId+"' is not a folder");
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -489,6 +489,15 @@ public interface Workspace{
|
||||||
InternalErrorException, ItemAlreadyExistException,
|
InternalErrorException, ItemAlreadyExistException,
|
||||||
InsufficientPrivilegesException, Exception;
|
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;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue