Package org.artifactory.search
Interface Searches
public interface Searches
Public API for executing searches
- Author:
- Yoav Landman
-
Method Summary
Modifier and TypeMethodDescriptionvoid
aql
(String aqlQuery, AqlResultHandler handler) Perform a search using Artifactory Query Language (AQL).archiveEntriesByName
(String query, String... repositories) Search the content of jar/zip archivesartifactsByGavc
(String groupId, String artifactId, String version, String classifier, String... repositories) artifactsByName
(String query, String... repositories) Find artifacts by nameartifactsBySha1
(String sha1, String... repositories) Find artifacts by their checksum valuesartifactsBySha256
(String sha256, String... repositories) Find artifacts by their checksum valuesartifactsCreatedOrModifiedInRange
(Calendar from, Calendar to, String... repositories) Find artifacts created or modified within a date rangeartifactsNotDownloadedSince
(Calendar since, Calendar createdBefore, String... repositories) Find artifacts not downloaded since the specified date, searches for both locally and remotely downloaded stats, using smart remote repository stats where applicable.buildsByArtifactSha1
(String sha1) Find all build runs that produced the artifact with the provided sha1 checksumbuildsByArtifactSha1
(String sha1, String buildRepo) Find all build runs that produced the artifact with the provided sha1 checksumbuildsByDependencySha1
(String sha1) Find all build runs that used a dependency with the provided sha1 checksumbuildsByDependencySha1
(String sha1, String buildRepo) Find all build runs that used a dependency with the provided sha1 checksumitemsByProperties
(com.google.common.collect.SetMultimap<String, String> properties, String... repositories) Find artifacts by properties
-
Method Details
-
artifactsByName
Find artifacts by name- Parameters:
query
- The search query term for the artifact namerepositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- Artifacts found by the search, empty list if nothing was found
-
itemsByProperties
List<RepoPath> itemsByProperties(com.google.common.collect.SetMultimap<String, String> properties, String... repositories) Find artifacts by properties- Parameters:
properties
- A set of key-value properties to search for on artifacts or folders. All specified properties need to exist on found items. If multiple values are used a contains() semantic is appliedrepositories
- A list of repositories to search in. Can be null to search all repositories.- Returns:
- Artifacts matching the criteria
-
archiveEntriesByName
Search the content of jar/zip archives- Parameters:
query
- The search term for the archive of the entryrepositories
- A list of repositories to search in. Can be null to search all repositories.- Returns:
- List of zip resources repo path matching the criteria
-
artifactsByGavc
-
artifactsBySha1
Find artifacts by their checksum values- Parameters:
sha1
- The sha1 checksum of the artifactrepositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- Set of repo paths that comply with the given checksums
-
artifactsBySha256
Find artifacts by their checksum values- Parameters:
sha256
- The sha256 checksum of the artifactrepositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- Set of repo paths that comply with the given checksums
-
artifactsCreatedOrModifiedInRange
List<RepoPath> artifactsCreatedOrModifiedInRange(@Nullable Calendar from, @Nullable Calendar to, String... repositories) Find artifacts created or modified within a date range- Parameters:
from
- The time to start the search exclusive (eg, >). If empty will start from 1st Jan 1970to
- The time to end search inclusive (eg, invalid input: '<'=), If null, will not use current time as the limitrepositories
- A list of repositories to search in. Can be null to search all repositories.- Returns:
- List of file repo paths that were created or modified between the input time range and the date the file was modified.
-
artifactsNotDownloadedSince
List<RepoPath> artifactsNotDownloadedSince(@Nullable Calendar since, @Nullable Calendar createdBefore, String... repositories) Find artifacts not downloaded since the specified date, searches for both locally and remotely downloaded stats, using smart remote repository stats where applicable.- Parameters:
since
- The time to start the search exclusive (eg, >). If null will start from 1st Jan 1970createdBefore
- Only include artifacts created before the specified time. If null will default to the value of since.repositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- List of file repo paths that were not downloaded since the specified date
-
buildsByArtifactSha1
Find all build runs that produced the artifact with the provided sha1 checksum- Parameters:
sha1
- The sha1 checksum of the build dependency to search- Returns:
- A list of BuildRuns (may be empty)
-
buildsByArtifactSha1
Find all build runs that produced the artifact with the provided sha1 checksum- Parameters:
sha1
- The sha1 checksum of the build dependency to searchbuildRepo
- The build info repository- Returns:
- A list of BuildRuns (may be empty)
-
buildsByDependencySha1
Find all build runs that used a dependency with the provided sha1 checksum- Parameters:
sha1
- The sha1 cheksum of the build dependency to search- Returns:
- A list of BuildRuns (may be empty)
-
buildsByDependencySha1
Find all build runs that used a dependency with the provided sha1 checksum- Parameters:
sha1
- The sha1 cheksum of the build dependency to searchbuildRepo
- The build info repository- Returns:
- A list of BuildRuns (may be empty)
-
aql
Perform a search using Artifactory Query Language (AQL). This can be used to stream AQL results from Artifactory as map objects. This method accepts a String param with the AQL query, and an AqlResultHandler object (can be a closure).Usage example 1:
Usage example 2:String aqlQuery = "items.find..." searches.aql(aqlQuery) { AqlResult result -> result.each { Map item -> String itemPath = item.path + "/" + item.name //do something } }
AqlResultHandler handler = new AqlResultHandler() { void handle(AqlResult result) { for (Map<String, Object> item : result) { String name = item.name //do something } } } searches.aql(aqlQuery, handler)
- Parameters:
aqlQuery
- The AQL query to performhandler
- The handler (can be a closure)
-