added remove items

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@171650 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-09-24 14:37:58 +00:00
parent 92d465ea8a
commit 34246fa021
2 changed files with 26 additions and 15 deletions

View File

@ -6,6 +6,7 @@ package org.gcube.common.storagehubwrapper.server;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -482,6 +483,27 @@ public final class WorkspaceStorageHubClientService implements Workspace{
}
}
/* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#removeItems(java.lang.String[])
*/
@Override
public Map<String, String> removeItems(String... id)
throws ItemNotFoundException, InternalErrorException,
InsufficientPrivilegesException {
Map<String, String> errors = new HashMap<String, String>();
for (int i = 0; i < id.length; i++) {
try{
deleteItem(id[i]);
}catch(Exception e){
errors.put(id[i], e.getMessage());
}
}
return errors;
}
/* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.server.tohl.Workspace#uploadFile(java.lang.String, java.io.InputStream, java.lang.String, java.lang.String)
*/
@ -567,7 +589,7 @@ public final class WorkspaceStorageHubClientService implements Workspace{
storageHubClientService.emptyTrash();
}catch(Exception e){
throw new Exception("Error emptying the Trash: "+e.getMessage());
throw new Exception("Error emptying the Trash: ",e);
}
}
@ -902,18 +924,6 @@ public final class WorkspaceStorageHubClientService implements Workspace{
return 0;
}
/* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#removeItems(java.lang.String[])
*/
@Override
public Map<String, String> removeItems(String... id)
throws ItemNotFoundException, InternalErrorException,
InsufficientPrivilegesException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#createVREFolder(java.lang.String, java.lang.String, java.lang.String, org.gcube.portal.storagehubwrapper.shared.ACLType)
*/

View File

@ -623,11 +623,12 @@ public interface Workspace{
*/
public int getTotalItems() throws InternalErrorException;
/**
* Remove a list of items identified by ids.
* Removes the items.
*
* @param id the id
* @return a map of errors: Map<id, error>
* @return the map of errors (id,error)
* @throws ItemNotFoundException the item not found exception
* @throws InternalErrorException the internal error exception
* @throws InsufficientPrivilegesException the insufficient privileges exception