class SW360ReleaseClientAdapterAsyncImpl implements SW360ReleaseClientAdapterAsync {

    @Override
    public CompletableFuture<Optional<SW360Release>> getReleaseByVersion(SW360Component component, String releaseVersion) {
        if (component != null &&
                component.getEmbedded() != null &&
                component.getEmbedded().getReleases() != null) {

            List<SW360SparseRelease> releases = component.getEmbedded().getReleases();
            Optional<String> releaseId = releases.stream()
                    .filter(release -> release.getVersion().equals(releaseVersion))
                    .findFirst()
                    .flatMap(release -> SW360HalResourceUtility.getLastIndexOfSelfLink(release.getLinks()));
            if (releaseId.isPresent()) {
                return getReleaseById(releaseId.get());
            }
        }
        return CompletableFuture.completedFuture(Optional.empty());
    }

    public  SW360ReleaseClientAdapterAsyncImpl(SW360ReleaseClient client,
                                              SW360ComponentClientAdapterAsync componentClientAdapter);

}