Migrate Rename facility to StorageHub
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@172102 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5cf7def8e9
commit
6e8f680fb6
|
@ -7,6 +7,7 @@
|
||||||
<Change>[Task #12601] added download folder facility</Change>
|
<Change>[Task #12601] added download folder facility</Change>
|
||||||
<Change>[Task #12604] Migrate Move operation to StorageHub</Change>
|
<Change>[Task #12604] Migrate Move operation to StorageHub</Change>
|
||||||
<Change>[Task #12603] Migrate Copy operation to StorageHub</Change>
|
<Change>[Task #12603] Migrate Copy operation to StorageHub</Change>
|
||||||
|
<Change>[Task #12603] Migrate Rename facility to StorageHub</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.common.storagehubwrapper.0-1-0"
|
<Changeset component="org.gcube.common.storagehubwrapper.0-1-0"
|
||||||
date="2018-06-20">
|
date="2018-06-20">
|
||||||
|
|
|
@ -543,6 +543,25 @@ public class StorageHubClientService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename item.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param newName the new name
|
||||||
|
* @return the item
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public Item renameItem(String itemId, String newName) throws Exception{
|
||||||
|
|
||||||
|
Validate.notNull(itemId, "Bad invoking rename item, the itemId is null");
|
||||||
|
|
||||||
|
OpenResolver resolver = shcClient.open(itemId).asItem().rename(newName);
|
||||||
|
return resolver.asItem().get();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -780,6 +780,35 @@ public final class WorkspaceStorageHubClientService implements Workspace{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#renameItem(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WorkspaceItem renameItem(String itemId, String newName)
|
||||||
|
throws ItemNotFoundException, InternalErrorException,
|
||||||
|
ItemAlreadyExistException, InsufficientPrivilegesException, Exception{
|
||||||
|
|
||||||
|
try{
|
||||||
|
Item item = storageHubClientService.renameItem(itemId, newName);
|
||||||
|
return HLMapper.toWorkspaceItem(item);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("Error on renaming item with id: "+itemId, e);
|
||||||
|
String error = e.getMessage()!=null?e.getMessage():"Operation not allowed";
|
||||||
|
throw new Exception("Error on renaming. "+error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -841,17 +870,7 @@ public final class WorkspaceStorageHubClientService implements Workspace{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#renameItem(java.lang.String, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void renameItem(String itemId, String newName)
|
|
||||||
throws ItemNotFoundException, InternalErrorException,
|
|
||||||
ItemAlreadyExistException, InsufficientPrivilegesException {
|
|
||||||
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#changeDescription(java.lang.String, java.lang.String)
|
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#changeDescription(java.lang.String, java.lang.String)
|
||||||
|
|
|
@ -256,6 +256,20 @@ public interface Workspace{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename an item.
|
||||||
|
*
|
||||||
|
* @param itemId the item id.
|
||||||
|
* @param newName the new name.
|
||||||
|
* @return the workspace item
|
||||||
|
* @throws ItemNotFoundException if the item has not been found.
|
||||||
|
* @throws InternalErrorException if an internal error occurs.
|
||||||
|
* @throws ItemAlreadyExistException if the user don't have sufficient privileges to perform this operation.
|
||||||
|
* @throws InsufficientPrivilegesException the insufficient privileges exception
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public WorkspaceItem renameItem(String itemId, String newName) throws ItemNotFoundException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,17 +386,6 @@ public interface Workspace{
|
||||||
*/
|
*/
|
||||||
public WorkspaceItem moveItem(String itemId, String destinationFolderId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, WorkspaceFolderNotFoundException, Exception;
|
public WorkspaceItem moveItem(String itemId, String destinationFolderId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, WorkspaceFolderNotFoundException, Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* Rename an item.
|
|
||||||
*
|
|
||||||
* @param itemId the item id.
|
|
||||||
* @param newName the new name.
|
|
||||||
* @throws ItemNotFoundException if the item has not been found.
|
|
||||||
* @throws InternalErrorException if an internal error occurs.
|
|
||||||
* @throws ItemAlreadyExistException if the user don't have sufficient privileges to perform this operation.
|
|
||||||
* @throws InsufficientPrivilegesException the insufficient privileges exception
|
|
||||||
*/
|
|
||||||
public void renameItem(String itemId, String newName) throws ItemNotFoundException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change an item description.
|
* Change an item description.
|
||||||
|
|
Loading…
Reference in New Issue