Adde moveItem copyFiles

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@171961 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-10-05 10:41:45 +00:00
parent 8926b422fa
commit 9d92f3617a
2 changed files with 89 additions and 91 deletions

View File

@ -6,6 +6,7 @@ package org.gcube.common.storagehubwrapper.server;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -680,14 +681,9 @@ public final class WorkspaceStorageHubClientService implements Workspace{
} }
/**
* Move items. @Override
* public void moveItems(List<String> itemIds, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, Exception {
* @param itemIds the item ids
* @param folderDestinationId the folder destination id
* @throws Exception the exception
*/
public void moveItems(List<String> itemIds, String folderDestinationId) throws Exception{
FolderContainer destFolderContainer = null; FolderContainer destFolderContainer = null;
@ -718,15 +714,8 @@ public final class WorkspaceStorageHubClientService implements Workspace{
} }
/** @Override
* Copy file items. public List<WorkspaceItem> copyFileItems(List<String> itemIds, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception {
*
* @param itemIds the item ids
* @param folderDestinationId the folder destination id
* @return the list
* @throws Exception the exception
*/
public List<WorkspaceItem> copyFileItems(List<String> itemIds, String folderDestinationId) throws Exception{
FolderContainer destFolderContainer = null; FolderContainer destFolderContainer = null;
@ -763,6 +752,30 @@ public final class WorkspaceStorageHubClientService implements Workspace{
} }
/* (non-Javadoc)
* @see org.gcube.common.storagehubwrapper.server.tohl.Workspace#copyFile(java.lang.String, java.lang.String)
*/
@Override
public WorkspaceItem copyFile(String itemId, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception {
List<WorkspaceItem> list = copyFileItems(Arrays.asList(itemId), folderDestinationId);
return list==null||list.isEmpty()?null:list.get(0);
}
/* (non-Javadoc)
* @see org.gcube.common.storagehubwrapper.server.tohl.Workspace#moveItem(java.lang.String, java.lang.String)
*/
public void moveItem(String itemId, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, Exception{
moveItems(Arrays.asList(itemId), folderDestinationId);
}
@ -823,19 +836,6 @@ public final class WorkspaceStorageHubClientService implements Workspace{
} }
/* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#moveItem(java.lang.String, java.lang.String)
*/
@Override
public WorkspaceItem moveItem(String itemId, String destinationFolderId)
throws ItemNotFoundException, WrongDestinationException,
InsufficientPrivilegesException, InternalErrorException,
ItemAlreadyExistException, WorkspaceFolderNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#renameItem(java.lang.String, java.lang.String) * @see org.gcube.portal.storagehubwrapper.shared.Workspace#renameItem(java.lang.String, java.lang.String)
*/ */
@ -883,33 +883,6 @@ public final class WorkspaceStorageHubClientService implements Workspace{
} }
/* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#copy(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public WorkspaceItem copy(
String itemId, String newName, String destinationFolderId)
throws ItemNotFoundException, WrongDestinationException,
InternalErrorException, ItemAlreadyExistException,
InsufficientPrivilegesException, WorkspaceFolderNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#copy(java.lang.String, java.lang.String)
*/
@Override
public WorkspaceItem copy(String itemId, String destinationFolderId)
throws ItemNotFoundException, WrongDestinationException,
InternalErrorException, ItemAlreadyExistException,
InsufficientPrivilegesException, WorkspaceFolderNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#searchByName(java.lang.String, java.lang.String) * @see org.gcube.portal.storagehubwrapper.shared.Workspace#searchByName(java.lang.String, java.lang.String)
*/ */

View File

@ -355,19 +355,21 @@ public interface Workspace{
*/ */
public void deleteItem(String itemId) throws ItemNotFoundException, InternalErrorException, InsufficientPrivilegesException, Exception; public void deleteItem(String itemId) throws ItemNotFoundException, InternalErrorException, InsufficientPrivilegesException, Exception;
/** /**
* Move a workspaceItem to a specified destination. * Move item.
* @param itemId the item to move. *
* @param destinationFolderId the destination folder. * @param itemId the item id
* @return the moved workspaceItem * @param destinationFolderId the destination folder id
* @throws ItemNotFoundException if the specified item has not been found. * @throws ItemNotFoundException the item not found exception
* @throws WrongDestinationException if the specified destination has not been found. * @throws WrongDestinationException the wrong destination exception
* @throws InsufficientPrivilegesException if the user don't have sufficient privileges to perform this operation. * @throws InsufficientPrivilegesException the insufficient privileges exception
* @throws InternalErrorException if an internal error occurs. * @throws InternalErrorException the internal error exception
* @throws ItemAlreadyExistException if the destination folder have a children with same name. * @throws ItemAlreadyExistException the item already exist exception
* @throws WorkspaceFolderNotFoundException if the destination folder is not found. * @throws WorkspaceFolderNotFoundException the workspace folder not found exception
* @throws Exception the exception
*/ */
public WorkspaceItem moveItem(String itemId, String destinationFolderId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, WorkspaceFolderNotFoundException; public void moveItem(String itemId, String destinationFolderId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, WorkspaceFolderNotFoundException, Exception;
/** /**
* Rename an item. * Rename an item.
@ -412,36 +414,58 @@ public interface Workspace{
public void remove(String itemName, String folderId) throws ItemNotFoundException, InternalErrorException, InsufficientPrivilegesException, WrongItemTypeException; public void remove(String itemName, String folderId) throws ItemNotFoundException, InternalErrorException, InsufficientPrivilegesException, WrongItemTypeException;
/** /**
* Copy an item from a folder to another folder. * Copy file.
* *
* @param itemId the item to copy. * @param itemId the item id
* @param newName the item new name. * @param folderDestinationId the folder destination id
* @param destinationFolderId the destination folder id. * @return the list
* @return the item copy. * @throws ItemNotFoundException the item not found exception
* @throws ItemNotFoundException if the item has not been found. * @throws WrongDestinationException the wrong destination exception
* @throws WrongDestinationException if the destination have a wrong type. * @throws InternalErrorException the internal error exception
* @throws InternalErrorException if an internal error occurs. * @throws ItemAlreadyExistException the item already exist exception
* @throws ItemAlreadyExistException if an item with same name already exist in the destination folder. * @throws InsufficientPrivilegesException the insufficient privileges exception
* @throws InsufficientPrivilegesException if the user don't have sufficient privileges to perform this operation. * @throws Exception the exception
* @throws WorkspaceFolderNotFoundException if the destination folder has not been found.
*/ */
public WorkspaceItem copy(String itemId, String newName, String destinationFolderId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, WorkspaceFolderNotFoundException; WorkspaceItem copyFile(String itemId, String folderDestinationId)
throws ItemNotFoundException, WrongDestinationException,
InternalErrorException, ItemAlreadyExistException,
InsufficientPrivilegesException, Exception;
/** /**
* Copy an item from a folder to another folder. The item copy have the same name of the original. * Copy file items.
* *
* @param itemId the item to copy. * @param itemIds the item ids
* @param destinationFolderId the destination folder id, can't be the same of the item (can't have the same name). * @param folderDestinationId the folder destination id
* @return the item copy. * @return the list
* @throws ItemNotFoundException if the item has not been found. * @throws ItemNotFoundException the item not found exception
* @throws WrongDestinationException if the destination have a wrong type. * @throws WrongDestinationException the wrong destination exception
* @throws InternalErrorException if an internal error occurs. * @throws InternalErrorException the internal error exception
* @throws ItemAlreadyExistException if an item with same name already exist in the destination folder. * @throws ItemAlreadyExistException the item already exist exception
* @throws InsufficientPrivilegesException if the user don't have sufficient privileges to perform this operation. * @throws InsufficientPrivilegesException the insufficient privileges exception
* @throws WorkspaceFolderNotFoundException if the destination folder has not been found. * @throws Exception the exception
*/ */
public WorkspaceItem copy(String itemId, String destinationFolderId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, WorkspaceFolderNotFoundException; List<WorkspaceItem> copyFileItems(
List<String> itemIds, String folderDestinationId)
throws ItemNotFoundException, WrongDestinationException,
InternalErrorException, ItemAlreadyExistException,
InsufficientPrivilegesException, Exception;
/**
* Move items.
*
* @param itemIds the item ids
* @param folderDestinationId the folder destination id
* @throws ItemNotFoundException the item not found exception
* @throws WrongDestinationException the wrong destination exception
* @throws InsufficientPrivilegesException the insufficient privileges exception
* @throws InternalErrorException the internal error exception
* @throws ItemAlreadyExistException the item already exist exception
* @throws Exception the exception
*/
void moveItems(List<String> itemIds, String folderDestinationId)
throws ItemNotFoundException, WrongDestinationException,
InsufficientPrivilegesException, InternalErrorException,
ItemAlreadyExistException, Exception;
/** /**
* Search by Name. * Search by Name.
@ -738,4 +762,5 @@ public interface Workspace{
String folderId, String folderName, String nodeIdsToExclude) String folderId, String folderName, String nodeIdsToExclude)
throws Exception; throws Exception;
} }