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
Modifier and TypeMethodDescriptionCopies the workspace folder or file from the source path to the destination path.createFile(String path, String localFilePath, boolean createParentFolders) Creates a file in the workspace.createFolder(String path, boolean createParentFolders) Creates a folder in the workspace.voidDelete the specified folder or file in the workspace.voiddownloadFile(String path, String outputFilePath) Downloads the contents the workspace file to the specified local file system path.booleanIndicates whether the item exists in the workspace.getCheckoutStatus(String path) Gets an enumeration value that describes thecheckoutstatus of the file.getChildren(String path) Gets the immediate children of the workspace folder.Gets a client representation of the item in the workspace.voidmarkForAdd(String path) Marks a file for addition to the repository.Moves the workspace folder or file from one location to another.Renames the workspace folder or file.updateFileContents(String path, String localFilePath) Replaces the content of the workspace file with the content of the specified local file system file.
-
Method Details
-
createFolder
WorkspaceFolder createFolder(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 whencreateParentFoldersis set toFalseand 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(String path, String localFilePath, boolean createParentFolders) throws WorkspaceItemNotFoundException, WorkspaceItemExistsException, 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 whencreateParentFoldersis set toFalseand a parent folder in the specified path does not exist.WorkspaceItemExistsException- thrown when a folder or file exists at the specified path.IOException- thrown when there is a problem streaming the file contents from disk.
-
rename
WorkspaceItem rename(String path, 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(String sourcePath, 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(String sourcePath, 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
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(String path, String outputFilePath) throws WorkspaceItemNotFoundException, 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.IOException- thrown when there is a problem streaming the file to disk.
-
exists
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,Falseotherwise.
-
getItem
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
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(String path, String localFilePath) throws WorkspaceItemNotFoundException, 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.IOException- thrown when there is a problem streaming the file from disk or to the server.
-
markForAdd
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(String path) throws WorkspaceItemNotFoundException Gets an enumeration value that describes thecheckoutstatus 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.
-