Interface Workspace
-
- All Known Implementing Classes:
WorkspaceStorageHubClientService
public interface WorkspaceThe Interface Workspace.- Author:
- Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) Jun 15, 2018 Represents a HL user workspace.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanUserWriteIntoFolder(String folderId)Can user write into folder.WorkspaceItemcopyFile(String itemId, String folderDestinationId)Copy file.List<WorkspaceItem>copyFileItems(List<String> itemIds, String folderDestinationId)Copy file items.WorkspaceFoldercreateFolder(String name, String description, String destinationFolderId)Create a new folder with specified name.WorkspaceFoldercreateFolder(String name, String description, String destinationFolderId, Map<String,String> properties)Create a new folder with properties.URLItemcreateURL(String name, String description, String url, String destinationFolderId)Creates the URL.voiddeleteItem(String itemId)Delete item.ItemStreamDescriptordownloadFile(String itemId, String fileName, String versionName, String nodeIdsToExclude)Download file.ItemStreamDescriptordownloadFolder(String folderId, String folderName, String nodeIdsToExclude)Download folder.voidemptyTrash()Empty trash.booleanexists(String name, String folderId)Check if an item with the specified name exists in the specified folder.List<WorkspaceItem>find(String name, String folderId)Get an item with the specified name in the specified folder.List<org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry>getAccounting(String itemId)Gets the accounting.List<? extends WorkspaceItem>getChildren(String id)Gets the children not including the ones marked as hidden.List<? extends WorkspaceItem>getChildren(String id, boolean includeHidden)Gets the children including the ones marked as hidden if the bool param is true.longgetDiskUsage()Get the disk usage of a worskpace.List<? extends WorkspaceItem>getFilteredChildren(String id, Class<? extends org.gcube.common.storagehub.model.items.Item> aType)Gets the filtered children.PropertyMapgetGcubeItemProperties(String gcubeItemId)Gets the gcube item properties.WorkspaceItemgetItem(String itemId)Return the item with the specified id.WorkspaceItemgetItem(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties)Return the item with the specified id.WorkspaceItemgetItemByPath(String idFolder, String relativePath)WorkspaceItemgetItemForExplorer(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties)Gets the item for Explorer.List<WorkspaceFileVersion>getListVersionsForFile(String fileItemId)Gets the list versions for file.Map<String,Object>getMetadata(String itemId)Gets the metadata.StringgetOwner()Gets the owner.List<? extends WorkspaceItem>getParentsById(String id)Gets the parents by id.List<? extends WorkspaceItem>getParentsForExplorerById(String id)Gets the parents for explorer by id.URLgetPublicLinkForFile(String fileItemId)Gets the public link to the latest version of file item.URLgetPublicLinkForFile(String fileItemId, String version)Gets the public link of the file at the input version.WorkspaceFoldergetRoot()Returns the workspace root.WorkspaceItemgetRootSharedFolder(String itemId)Gets the root shared folder.List<Member>getSharedFolderMembers(String folderid)Gets the shared folder members.ItemStreamDescriptorgetThumbnailData(String itemId)Gets the thumbnail data.longgetTotalItems()Get the total number of items in a workspace.WorkspaceItemgetTrash()Get Trash Folder.StringgetVREFoldersId()Gets the VRE folders id.booleanisItemShared(String itemId)Checks if is item shared.WorkspaceItemmoveItem(String itemId, String destinationFolderId)Move item.List<WorkspaceItem>moveItems(List<String> itemIds, String folderDestinationId)Move items.Map<String,String>removeItems(String... id)Removes the items.WorkspaceItemrenameItem(String itemId, String newName)Rename an item.WorkspaceItemrestoreThrashItem(String itemId, String destinationFolderId)Restore thrash item.List<WorkspaceItem>search(String text, String folderId)Search.voidsetFolderAsHidden(String folderId, boolean hide)Sets the Folder As Hidden or visible .booleansetFolderAsPublic(String folderId, boolean bool)Sets the folder as public.WorkspaceSharedFoldershareFolder(String folderId, Set<String> users, ACLType type)WorkspaceSharedFolderunshareFolder(String folderId, Set<String> users)StringupdateDescriptionForItem(String itemId, String newDescription)Update description for item.voidupdateMetadata(String itemId, Map<String,Object> mapObjs)Update metadata.WorkspaceItemuploadArchive(String folderId, InputStream is, String extractionFolderName)Upload archive.WorkspaceItemuploadFile(String folderId, InputStream inputStream, String fileName, String fileDescription)Upload file.
-
-
-
Method Detail
-
getOwner
String getOwner() throws InternalErrorException, Exception
Gets the owner.- Returns:
- the owner
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
getRoot
WorkspaceFolder getRoot() throws InternalErrorException, Exception
Returns the workspace root.- Returns:
- the root.
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
getChildren
List<? extends WorkspaceItem> getChildren(String id) throws Exception
Gets the children not including the ones marked as hidden.- Parameters:
id- the id- Returns:
- the children
- Throws:
Exception- the exception
-
getChildren
List<? extends WorkspaceItem> getChildren(String id, boolean includeHidden) throws Exception
Gets the children including the ones marked as hidden if the bool param is true.- Parameters:
id- the idhidden- true to return also the hidden ones- Returns:
- the children
- Throws:
Exception- the exception
-
getParentsById
List<? extends WorkspaceItem> getParentsById(String id) throws InternalErrorException, Exception
Gets the parents by id.- Parameters:
id- the id- Returns:
- the parents by id
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
getItem
WorkspaceItem getItem(String itemId) throws ItemNotFoundException, InternalErrorException, Exception
Return the item with the specified id.- Parameters:
itemId- the item id.- Returns:
- the item.
- Throws:
ItemNotFoundException- if the item has not been found.InternalErrorException- the internal error exceptionException- the exception
-
getItem
WorkspaceItem getItem(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties) throws ItemNotFoundException, InternalErrorException, Exception
Return the item with the specified id.- Parameters:
itemId- the item id.withAccounting- the with accountingwithFileDetails- the with file detailswithMapProperties- the with map properties- Returns:
- the item.
- Throws:
ItemNotFoundException- if the item has not been found.InternalErrorException- the internal error exceptionException- the exception
-
getItemByPath
WorkspaceItem getItemByPath(String idFolder, String relativePath) throws ItemNotFoundException, InternalErrorException, Exception
- Parameters:
idFolder-relativePath-- Returns:
- the item.
- Throws:
ItemNotFoundException- if the item has not been found.InternalErrorException- the internal error exceptionException- the exception
-
createFolder
WorkspaceFolder createFolder(String name, String description, String destinationFolderId) throws InternalErrorException, InsufficientPrivilegesException, ItemAlreadyExistException, WrongDestinationException, ItemNotFoundException, WorkspaceFolderNotFoundException, Exception
Create a new folder with specified name. The new folder is created into the specified folder.- Parameters:
name- the folder name.description- the folder description.destinationFolderId- the destination folder.- Returns:
- the new folder.
- Throws:
InternalErrorException- if an internal error occurs.InsufficientPrivilegesException- if the user don't have sufficient privileges to perform this operation.ItemAlreadyExistException- if an item with the same exist in the destination folder.WrongDestinationException- if the destination item is not a folder.ItemNotFoundException- if the destination folder has not been found.WorkspaceFolderNotFoundException- if the destination folder has not been found.Exception- the exception
-
createFolder
WorkspaceFolder createFolder(String name, String description, String destinationFolderId, Map<String,String> properties) throws InternalErrorException, InsufficientPrivilegesException, ItemAlreadyExistException, WrongDestinationException, ItemNotFoundException, WorkspaceFolderNotFoundException
Create a new folder with properties.- Parameters:
name- the namedescription- the descriptiondestinationFolderId- the destination folder idproperties- the properties- Returns:
- the new folder
- Throws:
InternalErrorException- the internal error exceptionInsufficientPrivilegesException- the insufficient privileges exceptionItemAlreadyExistException- the item already exist exceptionWrongDestinationException- the wrong destination exceptionItemNotFoundException- the item not found exceptionWorkspaceFolderNotFoundException- the workspace folder not found exception
-
uploadFile
WorkspaceItem uploadFile(String folderId, InputStream inputStream, String fileName, String fileDescription) throws Exception
Upload file.- Parameters:
folderId- the folder idinputStream- the input streamfileName- the file namefileDescription- the file description- Returns:
- the workspace item
- Throws:
Exception- the exception
-
getSharedFolderMembers
List<Member> getSharedFolderMembers(String folderid) throws Exception
Gets the shared folder members.- Parameters:
folderid- the folderid- Returns:
- the shared folder members
- Throws:
Exception- the exception
-
exists
boolean exists(String name, String folderId) throws InternalErrorException, ItemNotFoundException, WrongItemTypeException
Check if an item with the specified name exists in the specified folder.- Parameters:
name- the name to check.folderId- the folder where to search the item.- Returns:
trueif the item exists,falseotherwise.- Throws:
InternalErrorException- if an error occurs.ItemNotFoundException- if the folder has not been found.WrongItemTypeException- if the folderId referrer to an item with type different from Workspace or folder.
-
find
List<WorkspaceItem> find(String name, String folderId) throws InternalErrorException, ItemNotFoundException, WrongItemTypeException
Get an item with the specified name in the specified folder.- Parameters:
name- the item name to find.folderId- the folder where to search the item.- Returns:
- the item if the item is found,
nullotherwise. - Throws:
InternalErrorException- if an error occurs.ItemNotFoundException- if the folder has not been found.WrongItemTypeException- if the folderId referrer to an item with type different from Workspace or folder.
-
getRootSharedFolder
WorkspaceItem getRootSharedFolder(String itemId) throws Exception
Gets the root shared folder.- Parameters:
itemId- the item id- Returns:
- the root shared folder
- Throws:
Exception- the exception
-
isItemShared
boolean isItemShared(String itemId) throws Exception
Checks if is item shared.- Parameters:
itemId- the item id- Returns:
- true, if is item shared
- Throws:
Exception- the exception
-
getVREFoldersId
String getVREFoldersId() throws Exception
Gets the VRE folders id.- Returns:
- the VRE folders id
- Throws:
Exception- the exception
-
getTrash
WorkspaceItem getTrash() throws InternalErrorException, ItemNotFoundException, Exception
Get Trash Folder.- Returns:
- the trash folder
- Throws:
InternalErrorException- the internal error exceptionItemNotFoundException- the item not found exceptionException- the exception
-
restoreThrashItem
WorkspaceItem restoreThrashItem(String itemId, String destinationFolderId) throws Exception
Restore thrash item.- Parameters:
itemId- the item iddestinationFolderId- the destination folder id- Returns:
- the workspace item
- Throws:
Exception- the exception
-
getFilteredChildren
List<? extends WorkspaceItem> getFilteredChildren(String id, Class<? extends org.gcube.common.storagehub.model.items.Item> aType) throws Exception
Gets the filtered children.- Parameters:
id- the idaType- the a type- Returns:
- the filtered children
- Throws:
Exception- the exception
-
renameItem
WorkspaceItem renameItem(String itemId, String newName) throws ItemNotFoundException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception
Rename an item.- Parameters:
itemId- the item id.newName- the new name.- Returns:
- the workspace item
- Throws:
ItemNotFoundException- if the item has not been found.InternalErrorException- if an internal error occurs.ItemAlreadyExistException- if the user don't have sufficient privileges to perform this operation.InsufficientPrivilegesException- the insufficient privileges exceptionException- the exception
-
getPublicLinkForFile
URL getPublicLinkForFile(String fileItemId) throws Exception
Gets the public link to the latest version of file item.- Parameters:
fileItemId- the file item id- Returns:
- the public link for file
- Throws:
Exception- the exception
-
getPublicLinkForFile
URL getPublicLinkForFile(String fileItemId, String version) throws Exception
Gets the public link of the file at the input version.- Parameters:
fileItemId- the file item idversion- the version- Returns:
- the public link for file
- Throws:
Exception- the exception
-
getListVersionsForFile
List<WorkspaceFileVersion> getListVersionsForFile(String fileItemId) throws Exception
Gets the list versions for file.- Parameters:
fileItemId- the file item id- Returns:
- the list versions for file
- Throws:
Exception- the exception
-
getThumbnailData
ItemStreamDescriptor getThumbnailData(String itemId) throws Exception
Gets the thumbnail data.- Parameters:
itemId- the item id- Returns:
- the thumbnail data
- Throws:
Exception- the exception
-
getMetadata
Map<String,Object> getMetadata(String itemId) throws Exception
Gets the metadata.- Parameters:
itemId- the item id- Returns:
- the metadata
- Throws:
Exception- the exception
-
getDiskUsage
long getDiskUsage() throws ExceptionGet the disk usage of a worskpace.- Returns:
- the disk usage
- Throws:
Exception- the exception
-
getTotalItems
long getTotalItems() throws ExceptionGet the total number of items in a workspace.- Returns:
- the numer of total Items
- Throws:
Exception- the exception
-
getAccounting
List<org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry> getAccounting(String itemId) throws Exception
Gets the accounting.- Parameters:
itemId- the item id- Returns:
- the accounting
- Throws:
Exception- the exception
-
getGcubeItemProperties
PropertyMap getGcubeItemProperties(String gcubeItemId) throws Exception
Gets the gcube item properties.- Parameters:
gcubeItemId- the gcube item id- Returns:
- the gcube item properties
- Throws:
Exception- the exception
-
updateMetadata
void updateMetadata(String itemId, Map<String,Object> mapObjs) throws Exception
Update metadata.- Parameters:
itemId- the item idmapObjs- the map objs- Throws:
Exception- the exception
-
createURL
URLItem createURL(String name, String description, String url, String destinationFolderId) throws Exception
Creates the URL.- Parameters:
name- the namedescription- the descriptionurl- the urldestinationFolderId- the destination folder id- Returns:
- the URL file item
- Throws:
Exception- the exception
-
setFolderAsPublic
boolean setFolderAsPublic(String folderId, boolean bool) throws Exception
Sets the folder as public.- Parameters:
folderId- the folder idbool- the bool- Returns:
- the new folder status (public or private)
- Throws:
Exception- the exception
-
moveItems
List<WorkspaceItem> moveItems(List<String> itemIds, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, Exception
Move items.- Parameters:
itemIds- the item idsfolderDestinationId- the folder destination id- Returns:
- the list
- Throws:
ItemNotFoundException- the item not found exceptionWrongDestinationException- the wrong destination exceptionInsufficientPrivilegesException- the insufficient privileges exceptionInternalErrorException- the internal error exceptionItemAlreadyExistException- the item already exist exceptionException- the exception
-
deleteItem
void deleteItem(String itemId) throws ItemNotFoundException, InternalErrorException, InsufficientPrivilegesException, Exception
Delete item.- Parameters:
itemId- the item id- Throws:
ItemNotFoundException- the item not found exceptionInternalErrorException- the internal error exceptionInsufficientPrivilegesException- the insufficient privileges exceptionException- the exception
-
moveItem
WorkspaceItem moveItem(String itemId, String destinationFolderId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, WorkspaceFolderNotFoundException, Exception
Move item.- Parameters:
itemId- the item iddestinationFolderId- the destination folder id- Returns:
- the workspace item
- Throws:
ItemNotFoundException- the item not found exceptionWrongDestinationException- the wrong destination exceptionInsufficientPrivilegesException- the insufficient privileges exceptionInternalErrorException- the internal error exceptionItemAlreadyExistException- the item already exist exceptionWorkspaceFolderNotFoundException- the workspace folder not found exceptionException- the exception
-
copyFile
WorkspaceItem copyFile(String itemId, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception
Copy file.- Parameters:
itemId- the item idfolderDestinationId- the folder destination id- Returns:
- the list
- Throws:
ItemNotFoundException- the item not found exceptionWrongDestinationException- the wrong destination exceptionInternalErrorException- the internal error exceptionItemAlreadyExistException- the item already exist exceptionInsufficientPrivilegesException- the insufficient privileges exceptionException- the exception
-
copyFileItems
List<WorkspaceItem> copyFileItems(List<String> itemIds, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception
Copy file items.- Parameters:
itemIds- the item idsfolderDestinationId- the folder destination id- Returns:
- the list
- Throws:
ItemNotFoundException- the item not found exceptionWrongDestinationException- the wrong destination exceptionInternalErrorException- the internal error exceptionItemAlreadyExistException- the item already exist exceptionInsufficientPrivilegesException- the insufficient privileges exceptionException- the exception
-
canUserWriteIntoFolder
boolean canUserWriteIntoFolder(String folderId) throws Exception
Can user write into folder.- Parameters:
folderId- the folder id- Returns:
- true, if successful
- Throws:
Exception- the exception
-
search
List<WorkspaceItem> search(String text, String folderId) throws InternalErrorException, ItemNotFoundException, WrongItemTypeException
Search.- Parameters:
text- the textfolderId- the folder id- Returns:
- the list
- Throws:
InternalErrorException- the internal error exceptionItemNotFoundException- the item not found exceptionWrongItemTypeException- the wrong item type exception
-
getItemForExplorer
WorkspaceItem getItemForExplorer(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties) throws ItemNotFoundException, InternalErrorException, Exception
Gets the item for Explorer.- Parameters:
itemId- the item idwithAccounting- the with accountingwithFileDetails- the with file detailswithMapProperties- the with map properties- Returns:
- the item
- Throws:
ItemNotFoundException- the item not found exceptionInternalErrorException- the internal error exceptionException- the exception
-
getParentsForExplorerById
List<? extends WorkspaceItem> getParentsForExplorerById(String id) throws InternalErrorException, Exception
Gets the parents for explorer by id. This call is the same ofWorkspaceStorageHubClientService.getParentsById(String)except to getRoot called inside (to check if a parent is root or not).WorkspaceItem.isRoot()returns always false.- Parameters:
id- the id- Returns:
- the parents for explorer by id
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
downloadFile
ItemStreamDescriptor downloadFile(String itemId, String fileName, String versionName, String nodeIdsToExclude) throws Exception
Download file.- Parameters:
itemId- the item idfileName- the file nameversionName- the version name. If is null or empty returns the latest version of filenodeIdsToExclude- the node ids to exclude- Returns:
- the item stream descriptor
- Throws:
Exception- the exception
-
uploadArchive
WorkspaceItem uploadArchive(String folderId, InputStream is, String extractionFolderName) throws Exception
Upload archive.- Parameters:
folderId- the folder idis- the isextractionFolderName- the extraction folder name- Returns:
- the workspace item
- Throws:
Exception- the exception
-
downloadFolder
ItemStreamDescriptor downloadFolder(String folderId, String folderName, String nodeIdsToExclude) throws Exception
Download folder.- Parameters:
folderId- the folder idfolderName- the folder namenodeIdsToExclude- the node ids to exclude- Returns:
- the item stream descriptor
- Throws:
Exception- the exception
-
removeItems
Map<String,String> removeItems(String... id) throws ItemNotFoundException, InternalErrorException, InsufficientPrivilegesException
Removes the items.- Parameters:
id- the id- Returns:
- the map of errors (id,error)
- Throws:
ItemNotFoundException- the item not found exceptionInternalErrorException- the internal error exceptionInsufficientPrivilegesException- the insufficient privileges exception
-
updateDescriptionForItem
String updateDescriptionForItem(String itemId, String newDescription) throws Exception
Update description for item.- Parameters:
itemId- the item idnewDescription- the new description- Returns:
- the description updated read by SHUB
- Throws:
Exception- the exception
-
setFolderAsHidden
void setFolderAsHidden(String folderId, boolean hide) throws Exception
Sets the Folder As Hidden or visible .- Parameters:
folderId- the folder id to set as hiddenhide- true to set hide, false to set visible- Throws:
Exception- the exception
-
shareFolder
WorkspaceSharedFolder shareFolder(String folderId, Set<String> users, ACLType type) throws Exception
- Parameters:
folderId- the folder id to shareusers- the Set of users to sharetype- the permission- Throws:
Exception
-
-