Package sonia.scm.repository.api
Class BrowseCommandBuilder
java.lang.Object
sonia.scm.repository.api.BrowseCommandBuilder
BrowseCommandBuilder is able to browse the files of a
Sample:
Print all paths from folder scm-core at revision 11aeec7db845:
Repository
.
Sample:
Print all paths from folder scm-core at revision 11aeec7db845:
BrowseCommandBuilder browse = repositoryService.getBrowseCommand();
BrowserResult result = browse.setPath("scm-core")
.setRevision("11aeec7db845")
.getBrowserResult();
for ( FileObject fo : result ){
System.out.println( fo.getPath() );
}
- Since:
- 1.17
-
Method Summary
Modifier and TypeMethodDescriptionReturn the files for the given parameters.reset()
Reset each parameter to its default value.setCollapse
(boolean collapse) Collapse folders with only one sub-folder until a folder is empty, contains files or has more than one sub-folder and return the path to such folder as a single item.setDisableCache
(boolean disableCache) Disables the cache.setDisableLastCommit
(boolean disableLastCommit) Disabling the last commit means that every call toFileObject.getDescription()
andFileObject.getLastModified()
will returnnull
, but this will also reduce the execution time.setDisablePreProcessors
(boolean disablePreProcessors) Disable the execution of pre processors if set totrue
.setDisableSubRepositoryDetection
(boolean disableSubRepositoryDetection) Enable or disable the detection of sub repositories.setLimit
(int limit) Limit the number of result files tolimit
entries.setOffset
(int offset) Proceed the list from the given number on (zero based).Retrieve only files which are children of the given path.setRecursive
(boolean recursive) Enable or disable recursive file object browsing.setRevision
(String revision) Retrieve only files of the given revision.
-
Method Details
-
reset
Reset each parameter to its default value.- Returns:
this
-
getBrowserResult
Return the files for the given parameters.- Throws:
IOException
-
setDisableCache
Disables the cache. This means that everyBrowserResult
is directly retrieved from theRepository
. Note: Disabling the cache cost a lot of performance and could be much more slower.- Parameters:
disableCache
- true to disable the cache- Returns:
this
-
setDisableLastCommit
Disabling the last commit means that every call toFileObject.getDescription()
andFileObject.getLastModified()
will returnnull
, but this will also reduce the execution time.- Parameters:
disableLastCommit
- true to disable the last commit message- Returns:
this
- Since:
- 1.26
-
setDisablePreProcessors
Disable the execution of pre processors if set totrue
.- Returns:
this
-
setDisableSubRepositoryDetection
Enable or disable the detection of sub repositories.- Parameters:
disableSubRepositoryDetection
- true to disable sub repository detection.- Returns:
this
- Since:
- 1.26
-
setPath
Retrieve only files which are children of the given path. This path have to be a directory.- Parameters:
path
- path of the folder- Returns:
this
-
setRecursive
Enable or disable recursive file object browsing. Default is disabled.- Parameters:
recursive
- true to enable recursive browsing- Returns:
this
- Since:
- 1.26
-
setRevision
Retrieve only files of the given revision.- Parameters:
revision
- revision for the files- Returns:
this
-
setLimit
Limit the number of result files tolimit
entries. By default, this is set to 100. Be aware that this parameter can have severe performance implications. Reading a repository with thousands of files in one folder can generate a huge load for a longer time.- Parameters:
limit
- The maximal number of files this request shall return (directories are not counted).- Since:
- 2.0.0
-
setOffset
Proceed the list from the given number on (zero based).- Parameters:
offset
- The number of the file, the result should start with (zero based). All preceding files will be omitted. Directories are not counted. Therefore, directories are only listed in results without offset.- Since:
- 2.0.0
-
setCollapse
Collapse folders with only one sub-folder until a folder is empty, contains files or has more than one sub-folder and return the path to such folder as a single item.- Parameters:
collapse
-true
if folders with only one sub-folder should be collapsed, otherwisefalse
.- Since:
- 2.31.0
-