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
will be thrown.
Here is an example of how to query repository items for any item created in a specific location within the last month. The output will include all available RepositoryItemQuery columns and will be 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 total size of all files in that container and below including
all versions of the file if it is versioned. The method requires the current user be an administrative mode user.
If the query results in more than one million records, a QueryLimitException
will be
thrown.
Here is an example of how to query repository containers whose size is greater than 1 million bytes (roughly 1 gigabyte). Size represents the total size including all versions of all files in the container and below. The output will include 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
will be thrown.
Here is an example of how to query repository files whose latest version has not been signed. The output will include all available RepositoryFileQuery columns and will be 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
will be thrown.
Here is an example of how to query repository files that have a specific version whose size is greater than 10000000 bytes (roughly 10 megabytes). The output will include path, version, and size columns and will be 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.Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA