use of org.eclipse.sw360.datahandler.thrift.cvesearch.UpdateType in project sw360portal by sw360.
the class VulnerabilityUtils method reduceVulnerabilityUpdateStatus.
public static VulnerabilityUpdateStatus reduceVulnerabilityUpdateStatus(VulnerabilityUpdateStatus... statuses) {
VulnerabilityUpdateStatus resultStatus = getEmptyVulnerabilityUpdateStatus();
RequestStatus requestStatus = Arrays.stream(statuses).map(VulnerabilityUpdateStatus::getRequestStatus).reduce(RequestStatus.SUCCESS, CommonUtils::reduceRequestStatus);
resultStatus.setRequestStatus(requestStatus);
for (UpdateType updateType : UpdateType.values()) {
for (VulnerabilityUpdateStatus status : statuses) {
if (status.isSetStatusToVulnerabilityIds()) {
resultStatus.statusToVulnerabilityIds.get(updateType).addAll(nullToEmptyList(status.statusToVulnerabilityIds.get(updateType)));
}
}
}
return resultStatus;
}
use of org.eclipse.sw360.datahandler.thrift.cvesearch.UpdateType in project sw360portal by sw360.
the class VulnerabilityUtils method getUpdateStatusFromUpdateMap.
public static VulnerabilityUpdateStatus getUpdateStatusFromUpdateMap(Map<UpdateType, List<Vulnerability>> statusToVulnerabilities) {
VulnerabilityUpdateStatus status = getEmptyVulnerabilityUpdateStatus();
status.requestStatus = nullToEmptyList(statusToVulnerabilities.get(UpdateType.FAILED)).size() > 0 ? RequestStatus.FAILURE : RequestStatus.SUCCESS;
for (UpdateType updateType : UpdateType.values()) {
List<String> idList = nullToEmptyList(statusToVulnerabilities.get(updateType)).stream().map(Vulnerability::getExternalId).collect(Collectors.toList());
status.statusToVulnerabilityIds.get(updateType).addAll(idList);
}
return status;
}
Aggregations