public interface RepositoryQueryService
Modifier and Type | Method and Description |
---|---|
String |
executeRepositoryContainerQuery(RepositoryContainerQuery query,
ExtractFileCreateInfo file)
Extracts repository container information to a file based on the specified query.
|
String |
executeRepositoryFileQuery(RepositoryFileQuery query,
ExtractFileCreateInfo file)
Extracts repository file information for the latest version of a file based on the specified query.
|
String |
executeRepositoryFileVersionQuery(RepositoryFileVersionQuery query,
ExtractFileCreateInfo file)
Extracts repository file information for each version of a file based on the specified query.
|
String |
executeRepositoryItemQuery(RepositoryItemQuery query,
ExtractFileCreateInfo file)
Extracts repository item (file and container) information to a file based on the specified query.
|
String executeRepositoryItemQuery(RepositoryItemQuery query, ExtractFileCreateInfo file) throws QueryException
QueryLimitException
is thrown.
Here is an example that queries repository items for any item created in a specific location within the last month. The output includes all available RepositoryItemQuery columns and is sorted in ascending order (oldest first) by created date.
RepositoryItemQuery query = new RepositoryItemQuery(); Date oneMonthAgo = DateUtils.addMonths(new Date(), -1); query.select(RepositoryItemQuery.ALL) .constrain(Condition.and(Comparison.greaterThan(RepositoryItemQuery.CREATED, oneMonthAgo.getTime()), Comparison.like(RepositoryItemQuery.PATH, "/ORG/PROJECT_A/*"))) .order(Order.ascending(RepositoryItemQuery.CREATED)); service.executeRepositoryItemQuery(query, fileInfo);
query
- The repository criteria with which to query the repository content.file
- The method to add the query output file.QueryException
- Thrown when there is an issue generating the query.String executeRepositoryContainerQuery(RepositoryContainerQuery query, ExtractFileCreateInfo file) throws QueryException
RepositoryContainerQuery
represents the total size of all files in the container and, which includes
all versions of the file, if it is versioned. The method requires the current user to be an Administrative mode
user. If the query results exceed the row limit (default is 10 million), a
QueryLimitException
is thrown.
Here is an example that queries repository containers with a size greater than 1 million bytes (roughly 1 gigabyte). Size represents the total size which includes all versions of all files in the container and below. The output includes path and size columns and will sort according to size using the default sort order, which is descending.
RepositoryContainerQuery query = new RepositoryContainerQuery(); query.select(RepositoryItemQuery.PATH, RepositoryContainerQuery.SIZE) .constrain(Comparison.greaterThan(RepositoryContainerQuery.SIZE, 1000000)); .order((RepositoryContainerQuery.SIZE)); service.executeRepositoryContainerQuery(query, fileInfo);
query
- The repository criteria with which to query the repository content.file
- The method to add the query output file.QueryException
- Thrown when there is an issue generating the query.String executeRepositoryFileQuery(RepositoryFileQuery query, ExtractFileCreateInfo file) throws QueryException
QueryLimitException
is thrown.
Here is an example that queries repository files with the latest version that has not been signed. The output includes all available RepositoryFileQuery columns and is sorted by path in ascending order, ignoring case.
RepositoryFileQuery query = new RepositoryFileQuery(); query.select(RepositoryFileQuery.ALL); query.constrain(Comparison.notEqual(RepositoryFileQuery.SIGNING_STATUS, SigningStatus.CURRENT)); query.order(Order.ascending(RepositoryItemQuery.PATH, false)); service.executeRepositoryFileQuery(query, fileInfo);
query
- The repository criteria with which to query the repository content.file
- The method to add the query output file.QueryException
- Thrown when there is an issue generating the query.String executeRepositoryFileVersionQuery(RepositoryFileVersionQuery query, ExtractFileCreateInfo file) throws QueryException
QueryLimitException
is thrown.
Here is an example that queries repository files that have a specific version with a size greater than 10000000 bytes (roughly 10 megabytes). The output includes path, version, and size columns and is sorted in descending order by size.
RepositoryFileVersionQuery query = new RepositoryFileVersionQuery(); query.select(RepositoryItemQuery.PATH, RepositoryFileVersionQuery.VERSION, RepositoryFileVersionQuery.SIZE); query.constrain(Comparison.greaterThanOrEqual(RepositoryFileVersionQuery.SIZE, 10000000)); query.order(Order.descending(RepositoryFileVersionQuery.SIZE));
query
- The repository criteria with which to query the repository content.file
- The method to add the query output file.QueryException
- Thrown when there is an issue generating the query.<i>Copyright (c) 2022, SAS Institute Inc., Cary, NC, USA</i>