use of org.jfrog.build.api.search.AqlSearchResult in project build-info by JFrogDev.
the class ArtifactoryDependenciesClient method searchArtifactsByAql.
public AqlSearchResult searchArtifactsByAql(String aql) throws IOException {
PreemptiveHttpClient client = httpClient.getHttpClient();
String url = artifactoryUrl + "/api/search/aql";
HttpPost httpPost = new HttpPost(url);
StringEntity entity = new StringEntity(aql);
httpPost.setEntity(entity);
AqlSearchResult result = readResponse(client.execute(httpPost), new TypeReference<AqlSearchResult>() {
}, "Failed to search artifact by the aql '" + aql + "'", true);
return result;
}
use of org.jfrog.build.api.search.AqlSearchResult in project build-info by JFrogDev.
the class AqlDependenciesHelper method collectArtifactsToDownload.
public Set<DownloadableArtifact> collectArtifactsToDownload(String aql, boolean explode) throws IOException {
Set<DownloadableArtifact> downloadableArtifacts = Sets.newHashSet();
if (StringUtils.isNotBlank(buildName)) {
aql = addBuildToQuery(aql);
}
aql = "items.find(" + aql + ")";
AqlSearchResult aqlSearchResult = downloader.getClient().searchArtifactsByAql(aql);
List<AqlSearchResult.SearchEntry> searchResults = aqlSearchResult.getResults();
for (AqlSearchResult.SearchEntry searchEntry : searchResults) {
String path = searchEntry.getPath().equals(".") ? "" : searchEntry.getPath() + "/";
DownloadableArtifact downloadableArtifact = new DownloadableArtifact(StringUtils.stripEnd(artifactoryUrl, "/") + "/" + searchEntry.getRepo(), target, path + searchEntry.getName(), "", "", PatternType.NORMAL);
downloadableArtifact.setExplode(explode);
downloadableArtifacts.add(downloadableArtifact);
}
return downloadableArtifacts;
}
Aggregations