Class FolderContainer


  • public class FolderContainer
    extends ItemContainer<org.gcube.common.storagehub.model.items.FolderItem>
    • Constructor Detail

      • FolderContainer

        protected FolderContainer​(ItemManagerClient itemclient,
                                  org.gcube.common.storagehub.model.items.FolderItem item)
    • Method Detail

      • list

        public ListResolverTyped list()
                               throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        returns the children of this 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
        Returns:
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • uploadFile

        public FileContainer uploadFile​(InputStream stream,
                                        String filename,
                                        String description)
                                 throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        creates a inside the folder represented by this FolderContainer
        Parameters:
        stream - the file stream
        filename - the name of the item in the workspace
        description - the description of the item in the workspace
        Returns:
        of the Item created
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • uploadFile

        public FileContainer uploadFile​(InputStream stream,
                                        String filename,
                                        String description,
                                        long size)
                                 throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        creates a inside the folder represented by this FolderContainer
        Parameters:
        stream - the file stream
        filename - the name of the item in the workspace
        description - the description of the item in the workspace
        size - the size of the stream in Bytes
        Returns:
        of the Item created
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • uploadFile

        public FileContainer uploadFile​(File file,
                                        String description)
                                 throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        creates a inside the folder represented by this FolderContainer
        Parameters:
        file - the file
        description - the description of the item in the workspace
        Returns:
        of the Item created
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • uploadFile

        public FileContainer uploadFile​(URI uri,
                                        String name,
                                        String description)
                                 throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        creates a inside the folder represented by this FolderContainer
        Parameters:
        uri - URI of the file
        name - the name of the item in the workspace
        description - the description of the item in the workspace
        Returns:
        of the Item created
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • addUrl

        public URLContainer addUrl​(URL url,
                                   String name,
                                   String description)
                            throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        creates a inside the folder represented by this FolderContainer
        Parameters:
        url - the url
        name - the name of the item in the workspace
        description - the description of the item in the workspace
        Returns:
        of the Item created
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • uploadArchive

        public FolderContainer uploadArchive​(InputStream stream,
                                             String extractionFolderName)
                                      throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        creates a set of in the workspace extracting the Archive
        Parameters:
        stream - the file stream
        extractionFolderName - the root name of the folder where the archive will be extracted (A new folder with this name will be created)
        Returns:
        of the extraction Folder
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • uploadArchive

        public FolderContainer uploadArchive​(InputStream stream,
                                             String extractionFolderName,
                                             long size)
                                      throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        creates a set of in the workspace extracting the Archive
        Parameters:
        stream - the file stream
        extractionFolderName - the root name of the folder where the archive will be extracted (A new folder with this name will be created)
        Returns:
        of the extraction Folder
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • newFolder

        public FolderContainer newFolder​(String name,
                                         String description)
                                  throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        create a new inside the represented by this FolderContainer
        Parameters:
        name - the name of the folder
        description - the description of the folder
        Returns:
        the representing the new folder
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • 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 inside the represented by this FolderContainer
        Parameters:
        name - the name of the folder
        description - the description of the folder
        Returns:
        the representing the new folder
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • newHiddenFolder

        public FolderContainer newHiddenFolder​(String name,
                                               String description)
                                        throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        create a new hidden inside the folder represented by this FolderContainer
        Parameters:
        name - the name of the folder
        description - the description of the folder
        Returns:
        the representing the new folder
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • 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:
        name - the name of the folder
        description - the description of the folder
        Returns:
        the representing the new folder
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • getAcls

        public List<org.gcube.common.storagehub.model.acls.ACL> getAcls()
                                                                 throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        returns the of the {FolderItem} represented by this FolderContainer
        Returns:
        a List of
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • changeAcls

        public FolderContainer changeAcls​(String user,
                                          org.gcube.common.storagehub.model.acls.AccessType accessType)
                                   throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        changes of the {FolderItem} represented by this FolderContainer for a user
        Returns:
        the
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • findByName

        public ListResolver findByName​(String namePattern)
                                throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        returns the children of this that matches the name pattern
        Returns:
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • openByRelativePath

        public OpenResolver openByRelativePath​(String relativePath)
                                        throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        returns the children of this that matches the name pattern
        Returns:
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • 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:
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • 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:
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • share

        public FolderContainer share​(Set<String> users,
                                     org.gcube.common.storagehub.model.acls.AccessType accessType)
                              throws org.gcube.common.storagehub.model.exceptions.StorageHubException
        shares this Folder with a list of users setting the same for everyone in the list. if the folder is already shared it add the users to the share.
        Returns:
        the current updated
        Throws:
        org.gcube.common.storagehub.model.exceptions.StorageHubException
      • unshare

        public FolderContainer unshare​(Set<String> users)
                                throws Exception
        remove share from this Folder for a list of users, for everyone or only for the caller. Is applicable only on . if users is empty or null unshare the entire folder for everyone. if users contains only the caller login the folder is removed only for him.
        Returns:
        the current updated
        Throws:
        Exception
      • info

        public org.gcube.common.storagehub.model.types.FolderInfoType info()
                                                                    throws Exception
        retrieve the folder info (item count and size)
        Returns:
        the
        Throws:
        Exception