Class WorkspaceStorageHubClientService
- java.lang.Object
-
- org.gcube.common.storagehubwrapper.server.WorkspaceStorageHubClientService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWorkspaceStorageHubClientService.WorkspaceStorageHubClientServiceBuilderThe Class WorkspaceStorageHubClientServiceBuilder.
-
Method Summary
All Methods Instance Methods Concrete 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)Creates the folder.WorkspaceFoldercreateFolder(String name, String description, String destinationFolderId, Map<String,String> properties)Creates the folder.URLItemcreateURL(String fileName, String fileDescription, 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)Exists.List<WorkspaceItem>find(String name, String folderId)Find.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.List<? extends WorkspaceItem>getChildren(String id, boolean includeHidden)Gets the children.longgetDiskUsage()Gets the disk usage.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)Gets the item.WorkspaceItemgetItem(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties)Gets the item.WorkspaceItemgetItemByPath(String folderId, String relativePath)WorkspaceItemgetItemForExplorer(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties)Gets the item.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 for file.URLgetPublicLinkForFile(String fileItemId, String version)Gets the public link for file.WorkspaceFoldergetRoot()Gets the root.WorkspaceItemgetRootSharedFolder(String itemId)Gets the root shared folder.List<Member>getSharedFolderMembers(String folderId)Gets the shared folder members.StorageHubClientServicegetStorageHubClientService()Gets the storage hub client service.ItemStreamDescriptorgetThumbnailData(String itemId)Gets the thumbnail data.longgetTotalItems()Gets the total items.WorkspaceItemgetTrash()Gets the trash.StringgetVREFoldersId()Gets the VRE folders id.booleanisItemShared(String itemId)Checks if is item shared.booleanisWithAccounting()Checks if is with accounting.booleanisWithFileDetails()Checks if is with file details.booleanisWithMapProperties()Checks if is with map properties.WorkspaceItemmoveItem(String itemId, String folderDestinationId)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 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 setPublic)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, Long fileSize)Upload archive.WorkspaceItemuploadFile(String folderId, InputStream is, String fileName, String fileDescription, Long fileSize)Upload file.
-
-
-
Method Detail
-
getStorageHubClientService
public StorageHubClientService getStorageHubClientService()
Gets the storage hub client service.- Returns:
- the storageHubClientService
-
isWithAccounting
public boolean isWithAccounting()
Checks if is with accounting.- Returns:
- the withAccounting
-
isWithFileDetails
public boolean isWithFileDetails()
Checks if is with file details.- Returns:
- the withFileDetails
-
isWithMapProperties
public boolean isWithMapProperties()
Checks if is with map properties.- Returns:
- the withMapProperties
-
getOwner
public String getOwner() throws InternalErrorException, Exception
Gets the owner.- Specified by:
getOwnerin interfaceWorkspace- Returns:
- the owner
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
getRoot
public WorkspaceFolder getRoot() throws InternalErrorException, Exception
Gets the root.- Specified by:
getRootin interfaceWorkspace- Returns:
- the root
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
getChildren
public List<? extends WorkspaceItem> getChildren(String id) throws Exception
Gets the children.- Specified by:
getChildrenin interfaceWorkspace- Parameters:
id- the id- Returns:
- the children
- Throws:
Exception- the exception
-
getChildren
public List<? extends WorkspaceItem> getChildren(String id, boolean includeHidden) throws Exception
Gets the children.- Specified by:
getChildrenin interfaceWorkspace- Parameters:
id- the id- Returns:
- the children
- Throws:
Exception- the exception
-
getFilteredChildren
public List<? extends WorkspaceItem> getFilteredChildren(String id, Class<? extends org.gcube.common.storagehub.model.items.Item> aType) throws Exception
Gets the filtered children.- Specified by:
getFilteredChildrenin interfaceWorkspace- Parameters:
id- the idaType- the a type- Returns:
- the filtered children
- Throws:
Exception- the exception
-
getParentsById
public List<? extends WorkspaceItem> getParentsById(String id) throws InternalErrorException, Exception
Gets the parents by id.- Specified by:
getParentsByIdin interfaceWorkspace- Parameters:
id- the id- Returns:
- the parents by id
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
getParentsForExplorerById
public List<? extends WorkspaceItem> getParentsForExplorerById(String id) throws InternalErrorException, Exception
Gets the parents for explorer by id. This call is the same ofgetParentsById(String)except to getRoot called inside (to check if a parent is root or not).WorkspaceItem.isRoot()returns always false.- Specified by:
getParentsForExplorerByIdin interfaceWorkspace- Parameters:
id- the id- Returns:
- the parents for explorer by id
- Throws:
InternalErrorException- the internal error exceptionException- the exception
-
createFolder
public WorkspaceFolder createFolder(String name, String description, String destinationFolderId) throws InternalErrorException, InsufficientPrivilegesException, ItemAlreadyExistException, WrongDestinationException, ItemNotFoundException, WorkspaceFolderNotFoundException
Creates the folder.- Specified by:
createFolderin interfaceWorkspace- Parameters:
name- the namedescription- the descriptiondestinationFolderId- the destination folder id- Returns:
- the workspace 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
-
getItem
public WorkspaceItem getItem(String itemId) throws ItemNotFoundException, InternalErrorException, Exception
Gets the item.- Specified by:
getItemin interfaceWorkspace- Parameters:
itemId- the item id- Returns:
- the item
- Throws:
ItemNotFoundException- the item not found exceptionInternalErrorException- the internal error exceptionException- the exception
-
getItem
public WorkspaceItem getItem(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties) throws ItemNotFoundException, InternalErrorException, Exception
Gets the item.- Specified by:
getItemin interfaceWorkspace- 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
-
getItemByPath
public WorkspaceItem getItemByPath(String folderId, String relativePath) throws ItemNotFoundException, InternalErrorException, Exception
- Specified by:
getItemByPathin interfaceWorkspace- Returns:
- the item.
- Throws:
ItemNotFoundException- if the item has not been found.InternalErrorException- the internal error exceptionException- the exception
-
getItemForExplorer
public WorkspaceItem getItemForExplorer(String itemId, boolean withAccounting, boolean withFileDetails, boolean withMapProperties) throws ItemNotFoundException, InternalErrorException, Exception
Gets the item. This call is the same ofgetItem(String, boolean, boolean, boolean)except to getRoot called inside (to check if an item is root or not).WorkspaceItem.isRoot()returns always false.- Specified by:
getItemForExplorerin interfaceWorkspace- 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
-
createFolder
public WorkspaceFolder createFolder(String name, String description, String destinationFolderId, Map<String,String> properties) throws InternalErrorException, InsufficientPrivilegesException, ItemAlreadyExistException, WrongDestinationException, ItemNotFoundException, WorkspaceFolderNotFoundException
Creates the folder.- Specified by:
createFolderin interfaceWorkspace- Parameters:
name- the namedescription- the descriptiondestinationFolderId- the destination folder idproperties- the properties- Returns:
- the workspace 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
public WorkspaceItem uploadFile(String folderId, InputStream is, String fileName, String fileDescription, Long fileSize) throws Exception
Upload file.- Specified by:
uploadFilein interfaceWorkspace- Parameters:
folderId- the folder idis- the isfileName- the file namefileDescription- the file descriptionfileSize- the file size- Returns:
- the workspace item
- Throws:
Exception- the exception
-
getSharedFolderMembers
public List<Member> getSharedFolderMembers(String folderId) throws Exception
Gets the shared folder members.- Specified by:
getSharedFolderMembersin interfaceWorkspace- Parameters:
folderId- the folder id- Returns:
- the shared folder members
- Throws:
Exception- the exception
-
exists
public boolean exists(String name, String folderId) throws InternalErrorException, ItemNotFoundException, WrongItemTypeException
Exists.- Specified by:
existsin interfaceWorkspace- Parameters:
name- the namefolderId- the folder id- Returns:
- true, if successful
- Throws:
InternalErrorException- the internal error exceptionItemNotFoundException- the item not found exceptionWrongItemTypeException- the wrong item type exception
-
find
public List<WorkspaceItem> find(String name, String folderId) throws InternalErrorException, ItemNotFoundException, WrongItemTypeException
Find.- Specified by:
findin interfaceWorkspace- Parameters:
name- the namefolderId- the folder id- Returns:
- the list
- Throws:
InternalErrorException- the internal error exceptionItemNotFoundException- the item not found exceptionWrongItemTypeException- the wrong item type exception
-
search
public List<WorkspaceItem> search(String text, String folderId) throws InternalErrorException, ItemNotFoundException, WrongItemTypeException
Search.- Specified by:
searchin interfaceWorkspace- Parameters:
text- the textfolderId- the folder id where searching- Returns:
- the list
- Throws:
InternalErrorException- the internal error exceptionItemNotFoundException- the item not found exceptionWrongItemTypeException- the wrong item type exception
-
getRootSharedFolder
public WorkspaceItem getRootSharedFolder(String itemId) throws Exception
Gets the root shared folder.- Specified by:
getRootSharedFolderin interfaceWorkspace- Parameters:
itemId- the item id- Returns:
- the root shared folder
- Throws:
Exception- the exception
-
deleteItem
public void deleteItem(String itemId) throws Exception
Delete item.- Specified by:
deleteItemin interfaceWorkspace- Parameters:
itemId- the item id- Throws:
Exception- the exception
-
removeItems
public Map<String,String> removeItems(String... id) throws ItemNotFoundException, InternalErrorException, InsufficientPrivilegesException
Removes the items.- Specified by:
removeItemsin interfaceWorkspace- Parameters:
id- the id- Returns:
- the map
- Throws:
ItemNotFoundException- the item not found exceptionInternalErrorException- the internal error exceptionInsufficientPrivilegesException- the insufficient privileges exception
-
uploadArchive
public WorkspaceItem uploadArchive(String folderId, InputStream is, String extractionFolderName, Long fileSize) throws Exception
Upload archive.- Specified by:
uploadArchivein interfaceWorkspace- Parameters:
folderId- the folder idis- the isextractionFolderName- the extraction folder namefileSize- the file size- Returns:
- the workspace item
- Throws:
Exception- the exception
-
isItemShared
public boolean isItemShared(String itemId) throws Exception
Checks if is item shared.- Specified by:
isItemSharedin interfaceWorkspace- Parameters:
itemId- the item id- Returns:
- true, if is item shared
- Throws:
Exception- the exception
-
getVREFoldersId
public String getVREFoldersId() throws Exception
Gets the VRE folders id.- Specified by:
getVREFoldersIdin interfaceWorkspace- Returns:
- the VRE folders id
- Throws:
Exception- the exception
-
getTrash
public WorkspaceItem getTrash() throws Exception
Gets the trash.
-
emptyTrash
public void emptyTrash() throws ExceptionEmpty trash.- Specified by:
emptyTrashin interfaceWorkspace- Throws:
Exception- the exception
-
restoreThrashItem
public WorkspaceItem restoreThrashItem(String itemId, String destinationFolderId) throws Exception
Restore thrash item.- Specified by:
restoreThrashItemin interfaceWorkspace- Parameters:
itemId- the item iddestinationFolderId- the destination folder id- Returns:
- the workspace item
- Throws:
Exception- the exception
-
downloadFile
public ItemStreamDescriptor downloadFile(String itemId, String fileName, String versionName, String nodeIdsToExclude) throws Exception
Download file.- Specified by:
downloadFilein interfaceWorkspace- Parameters:
itemId- the item idfileName- the file nameversionName- the version namenodeIdsToExclude- the node ids to exclude- Returns:
- the file stream descriptor
- Throws:
Exception- the exception
-
downloadFolder
public ItemStreamDescriptor downloadFolder(String folderId, String folderName, String nodeIdsToExclude) throws Exception
Download folder.- Specified by:
downloadFolderin interfaceWorkspace- Parameters:
folderId- the folder idfolderName- the folder namenodeIdsToExclude- the node ids to exclude- Returns:
- the file stream descriptor
- Throws:
Exception- the exception
-
moveItems
public List<WorkspaceItem> moveItems(List<String> itemIds, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, InternalErrorException, ItemAlreadyExistException, Exception
Move items.- Specified by:
moveItemsin interfaceWorkspace- 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
-
copyFileItems
public List<WorkspaceItem> copyFileItems(List<String> itemIds, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception
Copy file items.- Specified by:
copyFileItemsin interfaceWorkspace- 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
-
copyFile
public WorkspaceItem copyFile(String itemId, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception
Copy file.- Specified by:
copyFilein interfaceWorkspace- Parameters:
itemId- the item idfolderDestinationId- the folder destination id- Returns:
- the workspace item
- 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
-
moveItem
public WorkspaceItem moveItem(String itemId, String folderDestinationId) throws ItemNotFoundException, WrongDestinationException, InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, Exception
Move item.- Specified by:
moveItemin interfaceWorkspace- Parameters:
itemId- the item idfolderDestinationId- the folder destination id- Returns:
- the workspace item
- Throws:
ItemNotFoundException- the item not found exceptionWrongDestinationException- the wrong destination exceptionInsufficientPrivilegesException- the insufficient privileges exceptionItemAlreadyExistException- the item already exist exceptionInternalErrorException- the internal error exceptionException- the exception
-
renameItem
public WorkspaceItem renameItem(String itemId, String newName) throws ItemNotFoundException, InternalErrorException, ItemAlreadyExistException, InsufficientPrivilegesException, Exception
Rename item.- Specified by:
renameItemin interfaceWorkspace- Parameters:
itemId- the item idnewName- the new name- Returns:
- the workspace item
- Throws:
ItemNotFoundException- the item not found exceptionInternalErrorException- the internal error exceptionItemAlreadyExistException- the item already exist exceptionInsufficientPrivilegesException- the insufficient privileges exceptionException- the exception
-
getPublicLinkForFile
public URL getPublicLinkForFile(String fileItemId) throws Exception
Gets the public link for file.- Specified by:
getPublicLinkForFilein interfaceWorkspace- Parameters:
fileItemId- the file item id- Returns:
- the public link for file
- Throws:
Exception- the exception
-
getPublicLinkForFile
public URL getPublicLinkForFile(String fileItemId, String version) throws Exception
Gets the public link for file.- Specified by:
getPublicLinkForFilein interfaceWorkspace- Parameters:
fileItemId- the file item idversion- the version- Returns:
- the public link for file
- Throws:
Exception- the exception
-
getListVersionsForFile
public List<WorkspaceFileVersion> getListVersionsForFile(String fileItemId) throws Exception
Gets the list versions for file.- Specified by:
getListVersionsForFilein interfaceWorkspace- Parameters:
fileItemId- the file item id- Returns:
- the list versions for file
- Throws:
Exception- the exception
-
getThumbnailData
public ItemStreamDescriptor getThumbnailData(String itemId) throws Exception
Gets the thumbnail data.- Specified by:
getThumbnailDatain interfaceWorkspace- Parameters:
itemId- the item id- Returns:
- the thumbnail data
- Throws:
Exception- the exception
-
getMetadata
public Map<String,Object> getMetadata(String itemId) throws Exception
Gets the metadata.- Specified by:
getMetadatain interfaceWorkspace- Parameters:
itemId- the item id- Returns:
- the metadata
- Throws:
Exception- the exception
-
getTotalItems
public long getTotalItems() throws ExceptionGets the total items.- Specified by:
getTotalItemsin interfaceWorkspace- Returns:
- the total items
- Throws:
Exception- the exception
-
getDiskUsage
public long getDiskUsage() throws ExceptionGets the disk usage.- Specified by:
getDiskUsagein interfaceWorkspace- Returns:
- the disk usage
- Throws:
Exception- the exception
-
getAccounting
public List<org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry> getAccounting(String itemId) throws Exception
Gets the accounting.- Specified by:
getAccountingin interfaceWorkspace- Parameters:
itemId- the item id- Returns:
- the accounting
- Throws:
Exception- the exception
-
getGcubeItemProperties
public PropertyMap getGcubeItemProperties(String gcubeItemId) throws Exception
Gets the gcube item properties.- Specified by:
getGcubeItemPropertiesin interfaceWorkspace- Parameters:
gcubeItemId- the gcube item id- Returns:
- the gcube item properties
- Throws:
Exception- the exception
-
updateMetadata
public void updateMetadata(String itemId, Map<String,Object> mapObjs) throws Exception
Update metadata.- Specified by:
updateMetadatain interfaceWorkspace- Parameters:
itemId- the item idmapObjs- the map objs- Throws:
Exception- the exception
-
createURL
public URLItem createURL(String fileName, String fileDescription, String url, String destinationFolderId) throws Exception
Creates the URL.
-
setFolderAsPublic
public boolean setFolderAsPublic(String folderId, boolean setPublic) throws Exception
Sets the folder as public.- Specified by:
setFolderAsPublicin interfaceWorkspace- Parameters:
folderId- the folder idsetPublic- the set public- Returns:
- true, if successful
- Throws:
Exception- the exception
-
canUserWriteIntoFolder
public boolean canUserWriteIntoFolder(String folderId) throws Exception
Can user write into folder.- Specified by:
canUserWriteIntoFolderin interfaceWorkspace- Parameters:
folderId- the folder id- Returns:
- true, if successful
- Throws:
Exception- the exception
-
updateDescriptionForItem
public String updateDescriptionForItem(String itemId, String newDescription) throws Exception
Description copied from interface:WorkspaceUpdate description for item.- Specified by:
updateDescriptionForItemin interfaceWorkspace- Parameters:
itemId- the item idnewDescription- the new description- Returns:
- the description updated read by SHUB
- Throws:
Exception- the exception
-
setFolderAsHidden
public void setFolderAsHidden(String folderId, boolean hide) throws Exception
Description copied from interface:WorkspaceSets the Folder As Hidden or visible .- Specified by:
setFolderAsHiddenin interfaceWorkspace- Parameters:
folderId- the folder id to set as hiddenhide- true to set hide, false to set visible- Throws:
Exception- the exception
-
shareFolder
public WorkspaceSharedFolder shareFolder(String folderId, Set<String> users, ACLType type) throws Exception
- Specified by:
shareFolderin interfaceWorkspace- Parameters:
folderId- the folder id to shareusers- the Set of users to sharetype- the permission- Throws:
Exception
-
unshareFolder
public WorkspaceSharedFolder unshareFolder(String folderId, Set<String> users) throws Exception
- Specified by:
unshareFolderin interfaceWorkspace- Parameters:
folderId- the folder id to shareusers- the Set of users to share- Throws:
Exception
-
-