Package com.sas.lsaf.content.workspace

## Interface WorkspaceService

-     public interface WorkspaceService

  he service to manage files and folders in the current user's workspace.
  Since:
    1.1

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `WorkspaceItem` | `copy​(java.lang.String sourcePath, java.lang.String destinationPath)` | Copies the workspace folder or file from the source path to the destination path.
    `WorkspaceFile` | `createFile​(java.lang.String path, java.lang.String localFilePath, boolean createParentFolders)` | Creates a file in the workspace.
    `WorkspaceFolder` | `createFolder​(java.lang.String path, boolean createParentFolders)` | Creates a folder in the workspace.
    `void` | `delete​(java.lang.String path)` | Delete the specified folder or file in the workspace.
    `void` | `downloadFile​(java.lang.String path, java.lang.String outputFilePath)` | Downloads the contents the workspace file to the specified local file system path.
    `boolean` | `exists​(java.lang.String path)` | Indicates whether the item exists in the workspace.
    `SynchronizationInfo.CheckoutStatus` | `getCheckoutStatus​(java.lang.String path)` | Gets an enumeration value that describes the `checkout` status of the file.
    `java.util.List<WorkspaceItem>` | `getChildren​(java.lang.String path)` | Gets the immediate children of the workspace folder.
    `WorkspaceItem` | `getItem​(java.lang.String path)` | Gets a client representation of the item in the workspace.
    `void` | `markForAdd​(java.lang.String path)` | Marks a file for addition to the repository.
    `WorkspaceItem` | `move​(java.lang.String sourcePath, java.lang.String destinationPath)` | Moves the workspace folder or file from one location to another.
    `WorkspaceItem` | `rename​(java.lang.String path, java.lang.String name)` | Renames the workspace folder or file.
    `WorkspaceFile` | `updateFileContents​(java.lang.String path, java.lang.String localFilePath)` | Replaces the content of the workspace file with the content of the specified local file system file.

- - ### Method Detail

    - #### createFolder

          WorkspaceFolder createFolder​(java.lang.String path,
                                       boolean createParentFolders)
                                throws WorkspaceItemNotFoundException,
                                       WorkspaceItemExistsException

      Creates a folder in the workspace.
      Parameters:
        `path` - the full path of the workspace folder to create.
        `createParentFolders` - flag that indicates that missing parent folders are automatically created.
      Returns:
        The created workspace folder.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when `createParentFolders` is set to `False` and a parent folder in the specified path does not exist.
        `WorkspaceItemExistsException` - thrown when a folder or file exists at the specified path.

    - #### createFile

          WorkspaceFile createFile​(java.lang.String path,
                                   java.lang.String localFilePath,
                                   boolean createParentFolders)
                            throws WorkspaceItemNotFoundException,
                                   WorkspaceItemExistsException,
                                   java.io.IOException

      Creates a file in the workspace.

      Use `updateFileContents(String, String)` to replace the content of a workspace file.

      Parameters:
        `path` - the full path of the workspace file to create.
        `localFilePath` - the local file with the contents for the new workspace file.
        `createParentFolders` - flag that indicates that missing parent folders are automatically created.
      Returns:
        The created workspace file.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when `createParentFolders` is set to `False` and a parent folder in the specified path does not exist.
        `WorkspaceItemExistsException` - thrown when a folder or file exists at the specified path.
        `java.io.IOException` - thrown when there is a problem streaming the file contents from disk.

    - #### rename

          WorkspaceItem rename​(java.lang.String path,
                               java.lang.String name)
                        throws WorkspaceItemNotFoundException,
                               WorkspaceItemExistsException

      Renames the workspace folder or file.
      Parameters:
        `path` - the path of the workspace item to rename.
        `name` - the new name.
      Returns:
        the workspace item with the new name.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the workspace item is not found at the specified location.
        `WorkspaceItemExistsException` - thrown when a workspace item exists in the same folder with the new name.

    - #### move

          WorkspaceItem move​(java.lang.String sourcePath,
                             java.lang.String destinationPath)
                      throws WorkspaceItemNotFoundException,
                             WorkspaceItemExistsException,
                             WorkspaceItemMoveException

      Moves the workspace folder or file from one location to another.
      Parameters:
        `sourcePath` - the path of the folder or file to move.
        `destinationPath` - the path of the destination in which to move the file or folder. This includes the name of the item.
      Returns:
        The moved workspace item.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the specified source folder or file is not found.
        `WorkspaceItemExistsException` - thrown when a workspace item exists at the destination path.
        `WorkspaceItemMoveException` - thrown when the move request is not possible.

    - #### copy

          WorkspaceItem copy​(java.lang.String sourcePath,
                             java.lang.String destinationPath)
                      throws WorkspaceItemNotFoundException,
                             WorkspaceItemCopyException,
                             WorkspaceItemExistsException

      Copies the workspace folder or file from the source path to the destination path. The destination path is the full path of the copy, which includes the name of the new object.
      Parameters:
        `sourcePath` - the path of the folder or file to copy.
        `destinationPath` - the path of the destination in which to copy the folder or file. This includes the name of the copy.
      Returns:
        The created workspace folder or file.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the specified source item or destination parent folder is not found.
        `WorkspaceItemCopyException` - thrown when the copy request is not possible. Typically, the destination path is a child of the source path.
        `WorkspaceItemExistsException` - thrown when a folder or file exists at the destination path.

    - #### delete

          void delete​(java.lang.String path)
               throws WorkspaceItemNotFoundException,
                      WorkspaceItemDeleteException

      Delete the specified folder or file in the workspace. This operation is permanent and cannot be undone.
      Parameters:
        `path` - the path of the folder or file to delete.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the folder or file does not exist.
        `WorkspaceItemDeleteException` - thrown when the specified folder or file could not be deleted.

    - #### downloadFile

          void downloadFile​(java.lang.String path,
                            java.lang.String outputFilePath)
                     throws WorkspaceItemNotFoundException,
                            java.io.IOException

      Downloads the contents the workspace file to the specified local file system path.
      Parameters:
        `path` - the workspace file to download.
        `outputFilePath` - the local file system location in which to store the workspace file.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the specified file is not found in the workspace.
        `java.io.IOException` - thrown when there is a problem streaming the file to disk.

    - #### exists

          boolean exists​(java.lang.String path)

      Indicates whether the item exists in the workspace.
      Parameters:
        `path` - the path of the workspace folder or file.
      Returns:
        `True`, if an item exists at the specified path, `False` otherwise.

    - #### getItem

          WorkspaceItem getItem​(java.lang.String path)
                         throws WorkspaceItemNotFoundException

      Gets a client representation of the item in the workspace.
      Parameters:
        `path` - the path of the folder or file in the workspace.
      Returns:
        The workspace folder or file that is located at the specified path.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when a folder or file is not found at the location.

    - #### getChildren

          java.util.List<WorkspaceItem> getChildren​(java.lang.String path)
                                             throws WorkspaceItemNotFoundException

      Gets the immediate children of the workspace folder.
      Parameters:
        `path` - the workspace folder path to retrieve.
      Returns:
        the immediate children of the workspace folder.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the folder specified is not be found in the workspace.

    - #### updateFileContents

          WorkspaceFile updateFileContents​(java.lang.String path,
                                           java.lang.String localFilePath)
                                    throws WorkspaceItemNotFoundException,
                                           java.io.IOException

      Replaces the content of the workspace file with the content of the specified local file system file.

      Use `createFile(String, String, boolean)` to put content into a file that does not yet exist in the workspace.

      Parameters:
        `path` - the full path of the workspace file to update.
        `localFilePath` - the full path of the local file system file with the new content replace the workspace file.
      Returns:
        The updated workspace file.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the workspace file is not found at the specified location.
        `java.io.IOException` - thrown when there is a problem streaming the file from disk or to the server.

    - #### markForAdd

          void markForAdd​(java.lang.String path)
                   throws WorkspaceItemNotFoundException,
                          WorkspaceMarkForAddException

      Marks a file for addition to the repository.
      Parameters:
        `path` - the path of file to mark for addition. Only file paths are supported.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the workspace file is not found at the specified location.
        `WorkspaceMarkForAddException` - Thrown when the specified workspace file could not be marked for addition.

    - #### getCheckoutStatus

          SynchronizationInfo.CheckoutStatus getCheckoutStatus​(java.lang.String path)
                                                        throws WorkspaceItemNotFoundException

      Gets an enumeration value that describes the `checkout` status of the file. If the file exists in the repository, it can be checked-out or not checked-out. If the file exists in the workspace, it can be marked for addition in the repository.
      Parameters:
        `path` - the path of the workspace file.
      Returns:
        The checkout status of the file.
      Throws:
        `WorkspaceItemNotFoundException` - thrown when the workspace file is not found at the specified location.