Class BoxFoldersManager


  • public class BoxFoldersManager
    extends Object
    Provides operations to manage Box folders.
    • Constructor Summary

      Constructors 
      Constructor Description
      BoxFoldersManager​(com.box.sdk.BoxAPIConnection boxConnection)
      Create folder manager to manage folders of Box connection's authenticated user.
    • Constructor Detail

      • BoxFoldersManager

        public BoxFoldersManager​(com.box.sdk.BoxAPIConnection boxConnection)
        Create folder manager to manage folders of Box connection's authenticated user.
        Parameters:
        boxConnection - - Box connection to authenticated user account.
    • Method Detail

      • getRootFolder

        public com.box.sdk.BoxFolder getRootFolder()
        Return the root folder of authenticated user.
        Returns:
        The root folder of authenticated user.
      • getFolder

        public com.box.sdk.BoxFolder getFolder​(String... path)
        Return the Box folder referenced by path.
        Parameters:
        path - - Sequence of Box folder names from root folder to returned folder.
        Returns:
        The Box folder referenced by path or null if folder is not found.
      • getFolderItems

        public Collection<com.box.sdk.BoxItem.Info> getFolderItems​(String folderId,
                                                                   Long offset,
                                                                   Long limit,
                                                                   String... fields)
        Returns a specific range of child items in folder and specifies which fields of each item to retrieve.
        Parameters:
        folderId - - the id of folder.
        offset - - the index of first child item to retrieve; if null all child items are retrieved.
        limit - - the maximum number of children to retrieve after the offset; if null all child items are retrieved.
        fields - - the item fields to retrieve for each child item; if null all item fields are retrieved.
        Returns:
        The Items in folder
      • createFolder

        public com.box.sdk.BoxFolder createFolder​(String parentFolderId,
                                                  String folderName)
        Create a folder in parent folder with given parentFolderId.
        Parameters:
        parentFolderId - - the id of parent folder.
        folderName - the name of created folder.
        Returns:
        The created folder.
      • createFolder

        public com.box.sdk.BoxFolder createFolder​(String parentFolderId,
                                                  String... path)
        Create a folder specified by path from parent folder with given parentFolderId, creating intermediate directories as required.
        Parameters:
        parentFolderId - - the id of parent folder.
        path - - Sequence of Box folder names from parent folder to returned folder.
        Returns:
        The last folder in path, no fault will be thrown if it already exists.
      • copyFolder

        public com.box.sdk.BoxFolder copyFolder​(String folderId,
                                                String destinationFolderId,
                                                String newName)
        Copy folder to destination folder while optionally giving it a new name.
        Parameters:
        folderId - - the id of folder to copy.
        destinationFolderId - - the id of the destination folder.
        newName - - the new name for copied folder; if newName is null, the copied folder has same name as the original.
        Returns:
        The copied folder.
      • moveFolder

        public com.box.sdk.BoxFolder moveFolder​(String folderId,
                                                String destinationFolderId,
                                                String newName)
        Move folder to destination folder while optionally giving it a new name.
        Parameters:
        folderId - - the id of folder to move.
        destinationFolderId - - the id of the destination folder.
        newName - - the new name of moved folder; if newName is null, the moved folder has same name as the original.
        Returns:
        The moved folder.
      • renameFolder

        public com.box.sdk.BoxFolder renameFolder​(String folderId,
                                                  String newFolderName)
        Rename folder giving it the name newName
        Parameters:
        folderId - - the id of folder to rename.
        newFolderName - - the new name of folder.
        Returns:
        The renamed folder.
      • deleteFolder

        public void deleteFolder​(String folderId)
        Delete folder.
        Parameters:
        folderId - - the id of folder to delete.
      • getFolderInfo

        public com.box.sdk.BoxFolder.Info getFolderInfo​(String folderId,
                                                        String... fields)
        Get folder information.
        Parameters:
        folderId - - the id of folder.
        fields - - the information fields to retrieve; if null all information fields are retrieved.
        Returns:
        The folder information.
      • updateFolderInfo

        public com.box.sdk.BoxFolder updateFolderInfo​(String folderId,
                                                      com.box.sdk.BoxFolder.Info info)
        Update folder information.
        Parameters:
        folderId - - the id of folder to update.
        info - - the updated information
        Returns:
        The updated folder.
      • createFolderSharedLink

        public com.box.sdk.BoxSharedLink createFolderSharedLink​(String folderId,
                                                                com.box.sdk.BoxSharedLink.Access access,
                                                                Date unshareDate,
                                                                com.box.sdk.BoxSharedLink.Permissions permissions)
        Create a shared link to folder.
        Parameters:
        folderId - - the id of folder to create shared link on.
        access - - the access level of the shared link.
        unshareDate - - the date and time at which time the created shared link will expire; if unsharedDate is null then a non-expiring link is created.
        permissions - - the permissions of the created link; if permissions is null then the created shared link is create with default permissions.
        Returns:
        The created shared link.