use of io.cdap.cdap.internal.entity.EntityResult in project cdap by caskdata.
the class CapabilityApplier method getApplications.
@VisibleForTesting
EntityResult<ApplicationId> getApplications(NamespaceId namespace, String capability, @Nullable String cursor, int offset, int limit) throws IOException, UnauthorizedException {
String capabilityTag = String.format(CAPABILITY, capability);
SearchRequest searchRequest = SearchRequest.of(capabilityTag).addNamespace(namespace.getNamespace()).addType(APPLICATION).setScope(MetadataScope.SYSTEM).setCursor(cursor).setOffset(offset).setLimit(limit).build();
MetadataSearchResponse searchResponse = metadataSearchClient.search(searchRequest);
Set<ApplicationId> applicationIds = searchResponse.getResults().stream().map(MetadataSearchResultRecord::getMetadataEntity).map(this::getApplicationId).collect(Collectors.toSet());
return new EntityResult<>(applicationIds, getCursorResponse(searchResponse), searchResponse.getOffset(), searchResponse.getLimit(), searchResponse.getTotal());
}
use of io.cdap.cdap.internal.entity.EntityResult in project cdap by cdapio.
the class CapabilityApplier method getApplications.
@VisibleForTesting
EntityResult<ApplicationId> getApplications(NamespaceId namespace, String capability, @Nullable String cursor, int offset, int limit) throws IOException, UnauthorizedException {
String capabilityTag = String.format(CAPABILITY, capability);
SearchRequest searchRequest = SearchRequest.of(capabilityTag).addNamespace(namespace.getNamespace()).addType(APPLICATION).setScope(MetadataScope.SYSTEM).setCursor(cursor).setOffset(offset).setLimit(limit).build();
MetadataSearchResponse searchResponse = metadataSearchClient.search(searchRequest);
Set<ApplicationId> applicationIds = searchResponse.getResults().stream().map(MetadataSearchResultRecord::getMetadataEntity).map(this::getApplicationId).collect(Collectors.toSet());
return new EntityResult<>(applicationIds, getCursorResponse(searchResponse), searchResponse.getOffset(), searchResponse.getLimit(), searchResponse.getTotal());
}
Aggregations