コード例 #1
0
  public VulnerabilityUpdateStatus updateForRelease(Release release) {
    Optional<List<CveSearchData>> cveSearchDatas = cveSearchWrapper.searchForRelease(release);
    if (!cveSearchDatas.isPresent()) {
      return new VulnerabilityUpdateStatus().setRequestStatus(RequestStatus.FAILURE);
    }

    CveSearchDataTranslator cveSearchDataTranslator = new CveSearchDataTranslator();
    List<CveSearchDataTranslator.VulnerabilityWithRelation> translated =
        cveSearchDatas
            .get()
            .stream()
            .map(cveSearchData -> cveSearchDataTranslator.apply(cveSearchData))
            .map(
                vulnerabilityWithRelation -> {
                  vulnerabilityWithRelation.relation.setReleaseId(release.getId());
                  return vulnerabilityWithRelation;
                })
            .collect(Collectors.toList());

    VulnerabilityUpdateStatus updateStatus = getEmptyVulnerabilityUpdateStatus();
    for (CveSearchDataTranslator.VulnerabilityWithRelation vulnerabilityWithRelation : translated) {
      updateStatus =
          vulnerabilityConnector.addOrUpdate(
              vulnerabilityWithRelation.vulnerability,
              vulnerabilityWithRelation.relation,
              updateStatus);
    }

    return updateStatus;
  }
コード例 #2
0
  @Override
  public RequestStatus updateReleaseFossology(Release release, User user) throws TException {
    assertNotNull(release);
    assertId(release.getId());
    assertUser(user);

    return handler.updateRelease(release, user, ThriftUtils.immutableOfReleaseForFossology());
  }
コード例 #3
0
  @Override
  public AddDocumentRequestSummary addRelease(Release release, User user) throws TException {
    assertNotNull(release);
    assertIdUnset(release.getId());
    assertUser(user);

    return handler.addRelease(release, user.getEmail());
  }