@Override public VulnerabilityUpdateStatus updateForComponent(String componentId) throws TException { Optional<Component> component = vulnerabilityConnector.getComponent(componentId); return component .map( c -> c.isSetReleaseIds() ? c.getReleaseIds() .stream() .map(this::updateForRelease) .reduce( getEmptyVulnerabilityUpdateStatus(), (r1, r2) -> reduceVulnerabilityUpdateStatus(r1, r2)) : getEmptyVulnerabilityUpdateStatus()) .orElse(getEmptyVulnerabilityUpdateStatus(RequestStatus.FAILURE)); }
@Override public VulnerabilityUpdateStatus updateForProject(String projectId) throws TException { Optional<Project> project = vulnerabilityConnector.getProject(projectId); return project .map( r -> r.isSetReleaseIdToUsage() ? r.getReleaseIdToUsage() .keySet() .stream() .map(this::updateForRelease) .reduce( getEmptyVulnerabilityUpdateStatus(), (r1, r2) -> reduceVulnerabilityUpdateStatus(r1, r2)) : getEmptyVulnerabilityUpdateStatus()) .orElse(getEmptyVulnerabilityUpdateStatus(RequestStatus.FAILURE)); }
@Override public VulnerabilityUpdateStatus updateForRelease(String releaseId) { Optional<Release> release = vulnerabilityConnector.getRelease(releaseId); Optional<VulnerabilityUpdateStatus> updateStatus = release.map(this::updateForRelease); return updateStatus.orElse(getEmptyVulnerabilityUpdateStatus(RequestStatus.FAILURE)); }