public interface RepositoryService
A repository file is typically modified by checking it out into a user's workspace, modifying the file in the workspace, and then checking the modified files into the repository.
The repository file can be versioned or unversioned.
When an unversioned file is updated, its content is replaced by the new content. When a versioned file is updated, a
new version of the file is created with the new version number that is specified by
RepositoryCheckinSpecification
. RepositoryCheckinSpecification specifies that the major or minor number field
is incremented or specifies the exact version label to use for the update. New version number must always be an
increase of the previous number.
Modifier and Type | Method and Description |
---|---|
RepositoryFile |
checkin(String path,
RepositoryCheckinSpecification checkinSpecification)
Checks in the file from the current user's workspace to the repository.
|
RepositoryFile |
checkout(String path)
Checks out the file from the repository.
|
void |
clearCheckedOutFilesSearchResults()
Releases any cached information about the query that is associated with the current search.
|
RepositoryItem |
copy(String sourcePath,
String destinationPath)
Copies the repository object from the source path to the destination path.
|
void |
copyLatestFileVersionToWorkspace(String path)
Copies the latest version of the repository file to your workspace.
|
void |
copySpecificFileVersionToWorkspace(String path,
String version)
Copies the version of the repository file to your workspace.
|
RepositoryContext |
createContext(String path,
String typeId)
Creates a context in the repository.
|
RepositoryFile |
createFile(String path,
String localFilePath,
String comment,
boolean createParentFolders)
Creates an unversioned file in the repository.
|
RepositoryFolder |
createFolder(String path,
boolean createParentFolders)
Creates a folder in the repository.
|
RepositoryFile |
createVersionedFile(String path,
String localFilePath,
String comment,
String startingVersion,
boolean createParentFolders)
Creates a versioned file in the repository.
|
List<String> |
delete(String path)
Logically deletes the object (moves it to the recycle bin).
|
List<VersionDeleteInfo> |
deleteVersions(String path,
Set<String> versions)
Permanently deletes the versions of the file at the specified path.
|
RepositoryFile |
disableVersioning(String path,
String comment)
Disables versioning support for the repository file.
|
void |
downloadFile(String path,
String version,
String outputFilePath)
Downloads the file to a local file.
|
RepositoryFile |
enableVersioning(String path,
String startingVersion,
String comment)
Enables versioning for the repository file.
|
boolean |
exists(String path)
Indicates whether the path exists in the repository.
|
List<SynchronizationInfo> |
getCheckedOutFilesSearchResults(int fromRow,
int toRow)
Gets a range of results after calling
searchCheckedOutFiles(CheckedOutFilesQuery) . |
List<RepositoryItem> |
getChildren(String path)
Gets the children of the container path.
|
List<RepositoryItem> |
getChildrenByType(String path,
String typeId)
Gets the children of the container path.
|
RepositoryContext |
getContext(String path)
Gets the repository context at the path.
|
RepositoryContext |
getContextById(String id)
Gets the repository context by its unique identifier.
|
RepositoryFile |
getFile(String path)
Gets the repository file at the path.
|
RepositoryFile |
getFileVersion(String path,
String version)
Gets the specific version of a versioned file.
|
List<RepositoryFileVersionInfo> |
getFileVersionInfos(String path)
Gets the list of the version information that represents each version of the repository file.
|
List<RepositoryFile> |
getFileVersions(String path)
Gets the list of versions of the repository file.
|
RepositoryFolder |
getFolder(String path)
Gets the repository folder at the path.
|
RepositoryItem |
getItem(String path)
Gets the repository object at the path.
|
int |
getPageSizeLimit()
Gets the maximum number of checked out files that can be returned in a single request.
|
RepositoryContext |
getParentMembershipContext(String path)
Gets the nearest parent context with the membership capability for the repository path.
|
SynchronizationInfo |
getSynchronizationInfo(String path)
Gets the synchronization information for the specified file path.
|
List<SynchronizationInfo> |
getSynchronizationInfos(Set<String> paths,
boolean recurse)
Gets the synchronization information for the paths specified.
|
RepositoryContext |
getTopLevelContextByName(String name)
Gets a top-level context by name.
|
List<RepositoryContext> |
getTopLevelContexts()
Gets the list of all of the accessible top-level contexts.
|
RepositoryFile |
lockFile(String path)
Locks the specified repository file, prevents users from modifying the file in any way.
|
RepositoryItem |
move(String sourcePath,
String destinationPath)
Moves the repository object from the source path to the destination path.
|
List<String> |
permanentlyDelete(String path)
Permanently deletes the specified object.
|
RepositoryItem |
rename(String path,
String name)
Renames the repository object.
|
RepositorySearchResults |
search(SearchQuery query)
Searches the repository based on the specified query.
|
SearchResultsInfo |
searchCheckedOutFiles(CheckedOutFilesQuery query)
Searches the checked out files information and returns the information that describes the results, not the
results themselves.
|
List<RepositoryStateChangeResult> |
setState(String path,
RepositoryItem.State state,
String comment,
boolean recurse)
Sets the state of a repository context.
|
RepositoryFile |
undoCheckout(String path)
Undoes the checkout of the file.
|
RepositoryFile |
unlockFile(String path)
Unlocks the repository file.
|
RepositoryFile |
updateFileContents(String path,
RepositoryCheckinSpecification checkinSpecification,
String localFileLocation)
Updates the repository file with the specified file or creates a new version of the file, if the file is
versioned.
|
RepositoryItem |
updateItem(RepositoryItem item)
Updates the editable attributes of a repository object.
|
RepositoryContext createContext(String path, String typeId) throws RepositoryItemNotFoundException, RepositoryItemExistsException
path
- The path to the context to create.typeId
- The type of context to create.RepositoryItemNotFoundException
- Thrown when a parent context does NOT exist.RepositoryItemExistsException
- Thrown when an object exists in the repository at the specified path.RepositoryFolder createFolder(String path, boolean createParentFolders) throws RepositoryItemNotFoundException, RepositoryItemExistsException
path
- The path to the folder to create.createParentFolders
- Indicates whether the parent folders are automatically created during the operation.
This does NOT include creating contexts, only folders.RepositoryItemNotFoundException
- Thrown when createParentContainers
is set to false
and a
parent container does NOT exist.RepositoryItemExistsException
- Thrown when an object exists in the repository at the specified path.RepositoryFile createFile(String path, String localFilePath, String comment, boolean createParentFolders) throws RepositoryItemNotFoundException, RepositoryItemExistsException, IOException
path
- The path to the unversioned file.localFilePath
- The local file path with the contents for the new repository file.comment
- The comment about the unversioned file.createParentFolders
- Indicates whether the missing parent containers are automatically created during the
operation. This does NOT include creating contexts, only folders.RepositoryItemNotFoundException
- Thrown when createParentContainers
is set to false
and a
parent container does NOT exist.RepositoryItemExistsException
- Thrown when an object exists at the specified path.IOException
- Thrown when there is a problem streaming the file contents.RepositoryFile createVersionedFile(String path, String localFilePath, String comment, String startingVersion, boolean createParentFolders) throws RepositoryItemNotFoundException, RepositoryItemExistsException, IOException
path
- The path to the versioned file.localFilePath
- The local file path with the contents for the new repository file.comment
- The comment about the versioned file.startingVersion
- The version to use for the initial version of the repository file. The default version of
1.0
is used if not provided.createParentFolders
- Indicates whether missing parent containers are automatically created during the
operation. This does NOT include creating contexts, only folders.RepositoryItemNotFoundException
- Thrown when createParentFolders
is false
and a parent
container does NOT exist.RepositoryItemExistsException
- Thrown when an object exists at the specified path.IOException
- Thrown when there is a problem streaming the file contents.RepositoryItem updateItem(RepositoryItem item) throws RepositoryItemNotFoundException, RepositoryItemUpdateException
The expected flow for the call is to first retrieve the object by calling getItem(String)
or
getChildren(String)
, making required updates to the editable attributes, and then calling this method to
persist the changes.
item
- The repository object.RepositoryItemNotFoundException
- Thrown when repository object is not found at the given path.RepositoryItemUpdateException
- Thrown when the repository object is not updated.RepositoryItem rename(String path, String name) throws RepositoryItemNotFoundException, RepositoryItemExistsException
path
- The path to the repository object to rename.name
- the new nameRepositoryItemNotFoundException
- Thrown when repository object was not found at the specified path.RepositoryItemExistsException
- Thrown when a repository object exists in the same location with the new.
name.RepositoryItem move(String sourcePath, String destinationPath) throws RepositoryItemNotFoundException, RepositoryItemExistsException, RepositoryItemMoveException
Only folders and files can be moved. Objects that are moved maintain their identifiers and their audit trail.
sourcePath
- The path to the file or folder.destinationPath
- The path to the destination file or folder, which includes the name of the item.RepositoryItemNotFoundException
- Thrown when the specified source path or destination location is not
found.RepositoryItemExistsException
- Thrown when an object exists at the destination path.RepositoryItemMoveException
- Thrown when the move request is not possible.RepositoryItem copy(String sourcePath, String destinationPath) throws RepositoryItemNotFoundException, RepositoryItemExistsException, RepositoryItemCopyException
Only folders and files can be copied. Items that are copied create new items, with new identifiers. If a folder is copied, the folder and all readable contents within it are copied. If a versioned file is copied, only the latest version of the file is copied.
sourcePath
- The path to the file or folder to copy.destinationPath
- The path to the destination file or folder to create, which includes the name of the
created copy.RepositoryItemNotFoundException
- Thrown when the specified source path or destination location is not
found.RepositoryItemExistsException
- Whrown when an object exists at the destination path.RepositoryItemCopyException
- Thrown when the copy request is not possible. For example, the destination
path is a child of the source path.List<String> delete(String path) throws RepositoryItemNotFoundException, RepositoryItemDeleteException
path
- The object to logically delete.RepositoryItemNotFoundException
- Thrown when repository object is not found at the given path.RepositoryItemDeleteException
- Thrown when there is an issue logically deleting the object.List<VersionDeleteInfo> deleteVersions(String path, Set<String> versions) throws RepositoryItemNotFoundException, RepositoryItemDeleteException
path
- The path to the file with versions.versions
- The versions of the path to delete.RepositoryItemNotFoundException
- Thrown when repository object is not found at the specified path.RepositoryItemDeleteException
- Thrown when there is an issue permanently deleting the version.List<String> permanentlyDelete(String path) throws RepositoryItemNotFoundException, RepositoryItemDeleteException
path
- The object to permanently delete.RepositoryItemNotFoundException
- Thrown when repository object is not found at the given path.RepositoryItemDeleteException
- Thrown when there is an issue permanently deleting the item.RepositoryFile enableVersioning(String path, String startingVersion, String comment) throws RepositoryItemNotFoundException, RepositoryItemVersioningException
path
- The repository file to version.startingVersion
- (optional) the version to use for the initial version of the repository file. The default
version of 1.0
is used if not provided.comment
- (optional) a comment that describes the version.RepositoryItemNotFoundException
- Thrown when repository object is not found at the specified path.RepositoryItemVersioningException
- Thrown when the file versioning is not enabled, such as when the file
currently versioned.RepositoryFile disableVersioning(String path, String comment) throws RepositoryItemNotFoundException, RepositoryItemVersioningException
path
- The repository file to unversion.comment
- Thecomment that describes the file's contents.RepositoryItemNotFoundException
- Thrown when the specified path is not found.RepositoryItemVersioningException
- Thrown when versioning is not disabled for the file, such as when the
file is currently unversioned.RepositoryFile lockFile(String path) throws RepositoryItemNotFoundException, RepositoryItemLockException
path
- The path to the repository file to lock.RepositoryItemNotFoundException
- Thrown when the specified path is not found.RepositoryItemLockException
- Thrown when the specified file is not locked, such as when the file is
currently locked.RepositoryFile unlockFile(String path) throws RepositoryItemNotFoundException, RepositoryItemUnlockException
path
- The path to the repository file to unlock.RepositoryItemNotFoundException
- Thrown when the specified path is not found.RepositoryItemUnlockException
- Thrown when the specified file cannot be unlocked, such as when the file is
currently unlocked.boolean exists(String path)
path
- The path to the repository item.True
, if the path exists, false
otherwise.RepositoryItem getItem(String path) throws RepositoryItemNotFoundException
path
- The path to the repository item.RepositoryItemNotFoundException
- Thrown when repository object is not found at the specified path.RepositoryContext getTopLevelContextByName(String name) throws RepositoryItemNotFoundException
name
- The name of the top-level context.RepositoryItemNotFoundException
- Thrown when the top-level context is not found.List<RepositoryContext> getTopLevelContexts()
SynchronizationInfo getSynchronizationInfo(String path)
The synchronization information is information about the state between the file that that is located in the
workspace and a file that is located in the repository. A file that is in the workspace can be independent of a
file that is in the repository. This method retrieves information which that indicates the state
of the
file. Does it exist only in the workspace or the repository? Does it exist in both places? Was the workspace file
synchronized with the repository file? If so, which version of the repository file was synchronized? Is the
workspace file still in sync with the repository file or has the repository file changed? Has the workspace file
changed?
The information contained in the SynchronizationInfo
object enables you to determine whether the
workspace file is out-of-sync with the repository file.
If the path specified does not exist a SynchronizationInfo
is returned,
SynchronizationInfo.FileStatus.NON_EXISTENT
is set, and all other file
information attributes are null. If the path is to a folder, an IllegalArgumentException
is thrown.
path
- The file path to retrieve synchronization information for.List<SynchronizationInfo> getSynchronizationInfos(Set<String> paths, boolean recurse)
If there are no child files, then an empty List
is be returned. Note: Root and top context level paths
are not allowed.
paths
- That path to the files or folders.recurse
- Indicates whether to retrieve recursive synchronization. If false
, it retrieves the
synchronization information for the files that are within the folder specified (the folder's immediate
children). If true
, it retrieves the synchronization information for the files that are within
the entire subtree (recurses into all subfolders, if they exist).RepositoryContext getContext(String path) throws RepositoryItemNotFoundException
path
- The path to the repository context.RepositoryItemNotFoundException
- Thrown when a repository context is not found at the specified path.RepositoryContext getContextById(String id) throws RepositoryItemNotFoundException
id
- The identifier of the repository context.RepositoryItemNotFoundException
- Thrown when a repository context is not found.RepositoryContext getParentMembershipContext(String path) throws RepositoryItemNotFoundException, MembershipContextNotFoundException
path
- The repository path for which the nearest membership context is found. This can be a folder path,
file path, context path, or other repository type.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path.MembershipContextNotFoundException
- Thrown when the repository item has no parent context with the
membership capability. This is thrown when a top repository context path is specified.RepositoryFolder getFolder(String path) throws RepositoryItemNotFoundException
path
- The path to the repository folder.RepositoryItemNotFoundException
- Thrown when the repository folder is not found at the specified path.RepositoryFile getFile(String path) throws RepositoryItemNotFoundException
path
- the path of the repository file.RepositoryItemNotFoundException
- Thrown when the repository file is not found at the specified path.List<RepositoryItem> getChildren(String path) throws RepositoryItemNotFoundException
path
- The path to the parent container.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path.List<RepositoryItem> getChildrenByType(String path, String typeId) throws RepositoryItemNotFoundException
path
- The path to the parent container.typeId
- The type of children to return.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path.RepositoryFile getFileVersion(String path, String version) throws RepositoryItemNotFoundException
path
- The path to the versioned file.version
- The version.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path, if it
is not a versioned file, or if the specified version does not exist for the versioned file.List<RepositoryFile> getFileVersions(String path) throws RepositoryItemNotFoundException, RepositoryItemVersioningException
path
- The path to the file.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path.RepositoryItemVersioningException
- Thrown when the file at the specified path is not versioned.List<RepositoryFileVersionInfo> getFileVersionInfos(String path) throws RepositoryItemNotFoundException, RepositoryItemVersioningException
path
- The path to the repository file.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path.RepositoryItemVersioningException
- Thrown when the file at the specified path is not versioned.void downloadFile(String path, String version, String outputFilePath) throws RepositoryItemNotFoundException, IOException
Note: This action has no effect upon the workspace. The file is downloaded to the client computer.
path
- The path to the repository file to download.version
- The version of the file to download. Specify null if you want the latest version.outputFilePath
- The location on the client computer in which to store the file.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path.IOException
- Thrown when there is a problem streaming the file.RepositoryFile updateFileContents(String path, RepositoryCheckinSpecification checkinSpecification, String localFileLocation) throws RepositoryItemNotFoundException, RepositoryItemVersioningException, RepositoryItemCheckoutException, IOException
Note: This method enables you to update a repository file without going through the typical checkout/checkin process. Therefore, this action has no effect on your workspace contents.
If null
is specified for the checkin specification, that is interpreted as a blank comment and
MAJOR
version update value, if the file is versioned.
path
- The path to the repository file to update.checkinSpecification
- The method to generate the file version number, if the file is versioned.localFileLocation
- The local file path with the new version of the file.RepositoryItemNotFoundException
- Thrown when the repository item is not found at the specified path.RepositoryItemVersioningException
- Thrown when the version specification is not valid or inappropriate for
the specified file.RepositoryItemCheckoutException
- Thrown when the specified file specified is currently checked out.IOException
- Thrown when there is a problem streaming the file.List<RepositoryStateChangeResult> setState(String path, RepositoryItem.State state, String comment, boolean recurse) throws RepositoryItemNotFoundException
RepositoryItem.State
s:
Setting the state requires the privilege
PRIVILEGE_MANAGE_STATE
. In
addition, READ METADATA
and WRITE METADATA
permissions are required on the context. If the user
setting the state has these authorizations, then they are allowed to set the state on all descendents implicitly.
Even if they lack one or both of the permissions required on the context to set, the state IS set
implicitly, if the state is cascading.
As described above, an ACTIVE context within a CLOSED context is an invalid state. Therefore, when setting a context from CLOSED to ACTIVE and the parent context is CLOSED, this action automatically changes the state of all immediate ancestors that are CLOSED to ACTIVE.
path
- The path to the context.state
- The state.comment
- The comment that is used in the audit record. If no comment is specified then that value is not
audited. The comment is not persisted in any other place except the audit trail.recurse
- The state to set is cascaded to all of the descendent contexts. All non-context descendents (which
includes non-stateable) contexts are always set regardless of whether this flag is set. If a context
is set to ACTIVE, all folders, files, and non-stateable context descendents are set to the
context state automatically by default. The flag indicates whether stateable context descendents
should have their state changed. The flag is used only when setting the state to ACTIVE. When
setting a context state to CLOSED, then ALL descendents are automatically set to CLOSED
because ACTIVE content within a CLOSED context is an invalid state. Therefore, when
closing a context, the flag is ignored because recursion is a requirement.RepositoryItemNotFoundException
- Thrown when the item no longer exists.IllegalTypeException
- Thrown if the path specified is for a type that is not Stateable
. This
includes non-stateable context types, folders, and files.PrivilegeRequiredAccessDeniedException
- Thrown when the current user does not have the scoped privilege
PRIVILEGE_MANAGE_STATE
granted at the context to be set or higher. This can also be thrown when the
user is propagating the state change upwards and they do NOT have the privilege on a parent.PermissionRequiredAccessDeniedException
- Thrown when the current user does not have READ
and
WRITE METADATA
permissions on the context to set. This can also be thrown when the user is
propagating the state change upwards and they do NOT have the permissions on a parent.RepositoryFile checkout(String path) throws RepositoryItemNotFoundException, RepositoryItemCheckoutException
path
- The repository file.RepositoryItemNotFoundException
- Thrown when the specified path is not found.RepositoryItemCheckoutException
- Thrown when the file is currently checked out or locked.RepositoryFile undoCheckout(String path) throws RepositoryItemNotFoundException, RepositoryItemUndoCheckoutException
path
- The repository file.RepositoryItemNotFoundException
- Thrown when the specified path cannot not found.RepositoryItemUndoCheckoutException
- Thrown when the repository file is not checked out.RepositoryFile checkin(String path, RepositoryCheckinSpecification checkinSpecification) throws RepositoryItemNotFoundException, RepositoryItemCheckinException
path
- The file.checkinSpecification
- The method for how to label the new version. If null
is specified for
checkinSpecification, that is interpreted as a blank comment (and MINOR version update value if the
file is versioned).RepositoryItemNotFoundException
- Thrown when the specified path is not found.RepositoryItemCheckinException
- Thrown when the specified file is not checked in.void copyLatestFileVersionToWorkspace(String path) throws RepositoryItemNotFoundException
path
- The path to the repository file.RepositoryItemNotFoundException
- Thrown when repository file is not found at the specified path.void copySpecificFileVersionToWorkspace(String path, String version) throws RepositoryItemNotFoundException
path
- The path to the repository file.version
- The specific version to copy into your workspace.RepositoryItemNotFoundException
- Thrown when the repository file is not found at the specified path.SearchResultsInfo searchCheckedOutFiles(CheckedOutFilesQuery query)
getCheckedOutFilesSearchResults(int, int)
. When the results are no longer
required, call clearCheckedOutFilesSearchResults()
to release server-side resources that are related to the
query.
Note: Only one query can be active at a time for each client. The results generated for the query can be used to
iterate through the results by calling getCheckedOutFilesSearchResults(int, int)
, but if the same client
calls this method again, a new set of results is generated. The previous results are no longer valid.
query
- The search criteria with which to query the checked out files. Specifying
null returns the current user's checked out files.RepositorySearchResults search(SearchQuery query) throws RepositorySearchException
RepositoryItem
s
that satisfy the query. However, items in the recycle bin and any items that the current user does not have read
access to will not be returned. If the server cannot process all of the items due to server limitations,
RepositorySearchResults.isLimitReached()
is set to true
. If true, more items might exist that
satisfy the query but they cannot be returned.
Search rules:
To search file content, setTypeId must be called with one of the following types. Note: Because job files contain XML content, search will only find what is in attribute values.
query
- The search criteria with which to query the repository. Must specify a value for at least one
query field.RepositoryItem
s that satisfy the query and whether the limit is reached on the server.RepositorySearchException
- Thrown if there is an issue processing the repository search.List<SynchronizationInfo> getCheckedOutFilesSearchResults(int fromRow, int toRow) throws CheckedOutFilesSearchException
searchCheckedOutFiles(CheckedOutFilesQuery)
. The
from row
and to row
values must be between 1 and the total number of rows retrieved by the
query. This is considered a page
of results, and therefore, a pageable
results model.
Note: The maximum number of records that can be returned for a single page is determined by
getPageSizeLimit()
. The default maximum is 5000.
fromRow
- The starting row number to include in the results. Must be greater than 0.toRow
- The ending row number to include in the results. Must be less than or equal to the total row count.
The total number retrieved must be less than or equal to the page size limit.CheckedOutFilesSearchException
- Thrown when the total row number requested exceeds the page size limit.void clearCheckedOutFilesSearchResults()
finally
block for each call to searchCheckedOutFiles(CheckedOutFilesQuery)
. If the
results no longer exist when this method is called, then this method returns without any further action.int getPageSizeLimit()
<i>Copyright (c) 2021, SAS Institute Inc., Cary, NC, USA</i>