Interface Searches


  • public interface Searches
    Public API for executing searches
    Author:
    Yoav Landman
    • Method Detail

      • artifactsByName

        List<RepoPath> artifactsByName​(String query,
                                       String... repositories)
        Find artifacts by name
        Parameters:
        query - The search query term for the artifact name
        repositories - 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 applied
        repositories - A list of repositories to search in. Can be null to search all repositories.
        Returns:
        Artifacts matching the criteria
      • archiveEntriesByName

        List<RepoPath> archiveEntriesByName​(String query,
                                            String... repositories)
        Search the content of jar/zip archives
        Parameters:
        query - The search term for the archive of the entry
        repositories - A list of repositories to search in. Can be null to search all repositories.
        Returns:
        List of zip resources repo path matching the criteria
      • artifactsBySha1

        Set<RepoPath> artifactsBySha1​(String sha1,
                                      String... repositories)
        Find artifacts by their checksum values
        Parameters:
        sha1 - The sha1 checksum of the artifact
        repositories - 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

        Set<RepoPath> artifactsBySha256​(String sha256,
                                        String... repositories)
        Find artifacts by their checksum values
        Parameters:
        sha256 - The sha256 checksum of the artifact
        repositories - 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 1970
        to - The time to end search inclusive (eg, <=), If null, will not use current time as the limit
        repositories - 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 1970
        createdBefore - 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

        Set<BuildRun> buildsByArtifactSha1​(String sha1)
        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

        Set<BuildRun> buildsByArtifactSha1​(String sha1,
                                           @Nonnull
                                           String buildRepo)
        Find all build runs that produced the artifact with the provided sha1 checksum
        Parameters:
        sha1 - The sha1 checksum of the build dependency to search
        buildRepo - The build info repository
        Returns:
        A list of BuildRuns (may be empty)
      • buildsByDependencySha1

        Set<BuildRun> buildsByDependencySha1​(String sha1)
        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

        Set<BuildRun> buildsByDependencySha1​(String sha1,
                                             @Nonnull
                                             String buildRepo)
        Find all build runs that used a dependency with the provided sha1 checksum
        Parameters:
        sha1 - The sha1 cheksum of the build dependency to search
        buildRepo - The build info repository
        Returns:
        A list of BuildRuns (may be empty)
      • aql

        void aql​(String aqlQuery,
                 AqlResultHandler handler)
        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:

        
         String aqlQuery = "items.find..."
         searches.aql(aqlQuery) { AqlResult result ->
              result.each { Map item ->
                  String itemPath = item.path + "/" + item.name
                  //do something
              }
         }
          
        Usage example 2:
         
         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 perform
        handler - The handler (can be a closure)