Class FolderContainer
java.lang.Object
org.gcube.common.storagehub.client.dsl.ItemContainer<org.gcube.common.storagehub.model.items.FolderItem>
org.gcube.common.storagehub.client.dsl.FolderContainer
public class FolderContainer
extends ItemContainer<org.gcube.common.storagehub.model.items.FolderItem>
-
Field Summary
Fields inherited from class org.gcube.common.storagehub.client.dsl.ItemContainer
item, itemclient, itemId -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFolderContainer(ItemManagerClient itemclient, String folderId) protectedFolderContainer(ItemManagerClient itemclient, org.gcube.common.storagehub.model.items.FolderItem item) -
Method Summary
Modifier and TypeMethodDescriptioncreates an ExternalLink inside the folder represented by this FolderContainerbooleancanWrite()changeAcls(String user, org.gcube.common.storagehub.model.acls.AccessType accessType) changes ACL of the FolderItem represented by this FolderContainer for a userfindByName(String namePattern) returns the children of this FolderContainer that matches the name patternList<org.gcube.common.storagehub.model.acls.ACL>getAcls()returns the ACL of the FolderItem represented by this FolderContainergetType()org.gcube.common.storagehub.model.types.FolderInfoTypeinfo()retrieve the folder info (item count and size)list()returns the children of this FolderContainer By default this method return all FolderContainers (asContainers) or Items (asItems) without accounting data, content data and metadata of the item to add these information see ListResolverTypednewExternalFolder(String name, String description, boolean hidden, String storageName, org.gcube.common.storagehub.model.plugins.PluginParameters storageParameters) create a new FolderItem inside the FolderItem represented by this FolderContainercreate a new FolderItem inside the FolderItem represented by this FolderContainernewGcubeItem(org.gcube.common.storagehub.model.items.GCubeItem item) create a new hidden Folder inside the folder represented by this FolderContainernewHiddenFolder(String name, String description) create a new hidden FolderItem inside the folder represented by this FolderContaineropenByRelativePath(String relativePath) returns the children of this FolderContainer that matches the name patternpublish()makes this Folder public.returns the items that matches the name pattern searching recursively on all subfoldersreturns the items that matches the name pattern searching recursively on all subfolders filtering the trashed Itemsshares this Folder with a list of users setting the same AccessType for everyone in the list.unpublish this Folder.remove share from this Folder for a list of users, for everyone or only for the caller.uploadArchive(InputStream stream, String extractionFolderName) creates a set of Items in the workspace extracting the ArchiveuploadArchive(InputStream stream, String extractionFolderName, long size) creates a set of Items in the workspace extracting the ArchiveuploadFile(File file, String description) creates a AbstractFileItem inside the folder represented by this FolderContaineruploadFile(InputStream stream, String filename, String description) creates a AbstractFileItem inside the folder represented by this FolderContaineruploadFile(InputStream stream, String filename, String description, long size) creates a AbstractFileItem inside the folder represented by this FolderContaineruploadFile(URI uri, String name, String description) creates a AbstractFileItem inside the folder represented by this FolderContainerMethods inherited from class org.gcube.common.storagehub.client.dsl.ItemContainer
delete, download, forceDelete, get, getAnchestors, getId, getRootSharedFolder, invalidateItem, move, rename, setDescription, setHidden, setItem, setMetadata, setVisible
-
Constructor Details
-
FolderContainer
protected FolderContainer(ItemManagerClient itemclient, org.gcube.common.storagehub.model.items.FolderItem item) -
FolderContainer
-
-
Method Details
-
getType
- Specified by:
getTypein classItemContainer<org.gcube.common.storagehub.model.items.FolderItem>
-
list
public ListResolverTyped list() throws org.gcube.common.storagehub.model.exceptions.StorageHubExceptionreturns the children of this FolderContainer By default this method return all FolderContainers (asContainers) or Items (asItems) without accounting data, content data and metadata of the item to add these information see ListResolverTyped- Returns:
- ListResolverTyped
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to read this folder or the item is invalid
-
uploadFile
public FileContainer uploadFile(InputStream stream, String filename, String description) throws org.gcube.common.storagehub.model.exceptions.StorageHubException creates a AbstractFileItem inside the folder represented by this FolderContainer- Parameters:
stream- the file streamfilename- the name of the item in the workspacedescription- the description of the item in the workspace- Returns:
- FileContainer of the Item created
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
uploadFile
public FileContainer uploadFile(InputStream stream, String filename, String description, long size) throws org.gcube.common.storagehub.model.exceptions.StorageHubException creates a AbstractFileItem inside the folder represented by this FolderContainer- Parameters:
stream- the file streamfilename- the name of the item in the workspacedescription- the description of the item in the workspacesize- the size of the stream in Bytes- Returns:
- FileContainer of the Item created
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
uploadFile
public FileContainer uploadFile(File file, String description) throws org.gcube.common.storagehub.model.exceptions.StorageHubException creates a AbstractFileItem inside the folder represented by this FolderContainer- Parameters:
file- the filedescription- the description of the item in the workspace- Returns:
- FileContainer of the Item created
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
uploadFile
public FileContainer uploadFile(URI uri, String name, String description) throws org.gcube.common.storagehub.model.exceptions.StorageHubException creates a AbstractFileItem inside the folder represented by this FolderContainer- Parameters:
uri- URI of the filename- the name of the item in the workspacedescription- the description of the item in the workspace- Returns:
- FileContainer of the Item created
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
addUrl
public URLContainer addUrl(URL url, String name, String description) throws org.gcube.common.storagehub.model.exceptions.StorageHubException creates an ExternalLink inside the folder represented by this FolderContainer- Parameters:
url- the urlname- the name of the item in the workspacedescription- the description of the item in the workspace- Returns:
- URLContainer of the Item created
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
uploadArchive
public FolderContainer uploadArchive(InputStream stream, String extractionFolderName) throws org.gcube.common.storagehub.model.exceptions.StorageHubException creates a set of Items in the workspace extracting the Archive- Parameters:
stream- the file streamextractionFolderName- the root name of the folder where the archive will be extracted (A new folder with this name will be created)- Returns:
- FolderContainer of the extraction Folder
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
uploadArchive
public FolderContainer uploadArchive(InputStream stream, String extractionFolderName, long size) throws org.gcube.common.storagehub.model.exceptions.StorageHubException creates a set of Items in the workspace extracting the Archive- Parameters:
stream- the file streamextractionFolderName- the root name of the folder where the archive will be extracted (A new folder with this name will be created)- Returns:
- FolderContainer of the extraction Folder
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
newFolder
public FolderContainer newFolder(String name, String description) throws org.gcube.common.storagehub.model.exceptions.StorageHubException create a new FolderItem inside the FolderItem represented by this FolderContainer- Parameters:
name- the name of the folderdescription- the description of the folder- Returns:
- the FolderContainer representing the new folder
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
newExternalFolder
public FolderContainer newExternalFolder(String name, String description, boolean hidden, String storageName, org.gcube.common.storagehub.model.plugins.PluginParameters storageParameters) throws org.gcube.common.storagehub.model.exceptions.StorageHubException create a new FolderItem inside the FolderItem represented by this FolderContainer- Parameters:
name- the name of the folderdescription- the description of the folder- Returns:
- the FolderContainer representing the new folder
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
newHiddenFolder
public FolderContainer newHiddenFolder(String name, String description) throws org.gcube.common.storagehub.model.exceptions.StorageHubException create a new hidden FolderItem inside the folder represented by this FolderContainer- Parameters:
name- the name of the folderdescription- the description of the folder- Returns:
- the FolderContainer representing the new folder
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
newGcubeItem
public GenericItemContainer newGcubeItem(org.gcube.common.storagehub.model.items.GCubeItem item) throws org.gcube.common.storagehub.model.exceptions.StorageHubException create a new hidden Folder inside the folder represented by this FolderContainer- Parameters:
item- the GCubeItem to create- Returns:
- the FolderContainer representing the new folder
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to write in this folder or the item is invalid
-
getAcls
public List<org.gcube.common.storagehub.model.acls.ACL> getAcls() throws org.gcube.common.storagehub.model.exceptions.StorageHubExceptionreturns the ACL of the FolderItem represented by this FolderContainer- Returns:
- a List of ACL
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if retrieval fails
-
changeAcls
public FolderContainer changeAcls(String user, org.gcube.common.storagehub.model.acls.AccessType accessType) throws org.gcube.common.storagehub.model.exceptions.StorageHubException changes ACL of the FolderItem represented by this FolderContainer for a user- Returns:
- the FolderContainer
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not administrator of this folder or the item is invalid
-
canWrite
- Throws:
Exception
-
findByName
public ListResolver findByName(String namePattern) throws org.gcube.common.storagehub.model.exceptions.StorageHubException returns the children of this FolderContainer that matches the name pattern- Returns:
- ListResolver
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to read this folder or the item is invalid
-
openByRelativePath
public OpenResolver openByRelativePath(String relativePath) throws org.gcube.common.storagehub.model.exceptions.StorageHubException returns the children of this FolderContainer that matches the name pattern- Returns:
- ListResolver
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to read this folder or the item is invalid
-
search
public ListResolver search(String nameTomatch, boolean excludeTrashed) throws org.gcube.common.storagehub.model.exceptions.StorageHubException returns the items that matches the name pattern searching recursively on all subfolders filtering the trashed Items- Returns:
- ListResolver
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to read this folder or the item is invalid
-
search
public ListResolver search(String nameTomatch) throws org.gcube.common.storagehub.model.exceptions.StorageHubException returns the items that matches the name pattern searching recursively on all subfolders- Returns:
- ListResolver
- Throws:
org.gcube.common.storagehub.model.exceptions.StorageHubException- if user is not authorized to read this folder or the item is invalid
-
unpublish
unpublish this Folder.- Returns:
- the current FolderContainer updated
- Throws:
Exception- if this is not a Folder or the user is not authorized to unpublish this folder
-
publish
makes this Folder public.- Returns:
- the current FolderContainer updated
- Throws:
Exception- if this is not a Folder or the user is not authorized to publish this folder
-
info
public org.gcube.common.storagehub.model.types.FolderInfoType info() throws Exception, org.gcube.common.storagehub.model.exceptions.InvalidCallParameters, org.gcube.common.storagehub.model.exceptions.UserNotAuthorizedExceptionretrieve the folder info (item count and size)- Returns:
- the FolderInfoType
- Throws:
Exception- if this is not a Folder or the user is not authorized to get the infoorg.gcube.common.storagehub.model.exceptions.InvalidCallParametersorg.gcube.common.storagehub.model.exceptions.UserNotAuthorizedException
-