use of org.folio.rmapi.result.PackageBulkResult in project mod-kb-ebsco-java by folio-org.
the class PackageServiceImpl method retrievePackagesBulk.
public CompletableFuture<PackageBulkResult> retrievePackagesBulk(Set<String> packageIds) {
Set<CompletableFuture<Result<PackageResult, String>>> futures = new HashSet<>();
packageIds.forEach(inputId -> {
try {
PackageId id = IdParser.parsePackageId(inputId);
futures.add(retrievePackageForBulk(id));
} catch (ValidationException e) {
futures.add(completedFuture(new Failure<>(inputId)));
}
});
return allOfSucceeded(futures, throwable -> LOG.warn(throwable.getMessage(), throwable)).thenApply(this::mapToPackageBulk);
}
Aggregations