use of org.eclipse.sw360.datahandler.thrift.importstatus.ImportStatus in project sw360portal by sw360.
the class ComponentPortlet method updateAllVulnerabilities.
private void updateAllVulnerabilities(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
CveSearchService.Iface cveClient = thriftClients.makeCvesearchClient();
try {
VulnerabilityUpdateStatus importStatus = cveClient.fullUpdate();
JSONObject responseData = PortletUtils.importStatusToJSON(importStatus);
PrintWriter writer = response.getWriter();
writer.write(responseData.toString());
} catch (TException e) {
log.error("Error occurred with full update of CVEs in backend.", e);
}
}
use of org.eclipse.sw360.datahandler.thrift.importstatus.ImportStatus in project sw360portal by sw360.
the class ComponentPortlet method updateVulnerabilitiesRelease.
private void updateVulnerabilitiesRelease(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
String releaseId = request.getParameter(PortalConstants.RELEASE_ID);
CveSearchService.Iface cveClient = thriftClients.makeCvesearchClient();
try {
VulnerabilityUpdateStatus importStatus = cveClient.updateForRelease(releaseId);
JSONObject responseData = PortletUtils.importStatusToJSON(importStatus);
PrintWriter writer = response.getWriter();
writer.write(responseData.toString());
} catch (TException e) {
log.error("Error updating CVEs for release in backend.", e);
}
}
use of org.eclipse.sw360.datahandler.thrift.importstatus.ImportStatus in project sw360portal by sw360.
the class ComponentPortlet method updateVulnerabilitiesComponent.
private void updateVulnerabilitiesComponent(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
String componentId = request.getParameter(PortalConstants.COMPONENT_ID);
CveSearchService.Iface cveClient = thriftClients.makeCvesearchClient();
try {
VulnerabilityUpdateStatus importStatus = cveClient.updateForComponent(componentId);
JSONObject responseData = PortletUtils.importStatusToJSON(importStatus);
PrintWriter writer = response.getWriter();
writer.write(responseData.toString());
} catch (TException e) {
log.error("Error updating CVEs for component in backend.", e);
}
}
use of org.eclipse.sw360.datahandler.thrift.importstatus.ImportStatus in project sw360portal by sw360.
the class ProjectImportPortlet method importBdpProjects.
private void importBdpProjects(User user, List<String> selectedIds, JSONObject responseData, RemoteCredentials remoteCredentials) throws PortletException, IOException {
ImportStatus importStatus = importDatasources(selectedIds, user, remoteCredentials);
JSONObject jsonFailedIds = JSONFactoryUtil.createJSONObject();
JSONArray jsonSuccessfulIds = JSONFactoryUtil.createJSONArray();
if (importStatus.isSetRequestStatus() && importStatus.getRequestStatus().equals(RequestStatus.SUCCESS)) {
importStatus.getFailedIds().forEach(jsonFailedIds::put);
importStatus.getSuccessfulIds().forEach(jsonSuccessfulIds::put);
responseData.put(ProjectImportConstants.RESPONSE__FAILED_IDS, jsonFailedIds);
responseData.put(ProjectImportConstants.RESPONSE__SUCCESSFUL_IDS, jsonSuccessfulIds);
}
if (isImportSuccessful(importStatus)) {
responseData.put(ProjectImportConstants.RESPONSE__STATUS, ProjectImportConstants.RESPONSE__SUCCESS);
} else if (importStatus.isSetRequestStatus() && importStatus.getRequestStatus().equals(RequestStatus.SUCCESS)) {
responseData.put(ProjectImportConstants.RESPONSE__STATUS, ProjectImportConstants.RESPONSE__FAILURE);
} else {
responseData.put(ProjectImportConstants.RESPONSE__STATUS, ProjectImportConstants.RESPONSE__GENERAL_FAILURE);
}
}
use of org.eclipse.sw360.datahandler.thrift.importstatus.ImportStatus in project sw360portal by sw360.
the class ProjectPortlet method updateVulnerabilitiesProject.
private void updateVulnerabilitiesProject(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
String projectId = request.getParameter(PortalConstants.PROJECT_ID);
CveSearchService.Iface cveClient = thriftClients.makeCvesearchClient();
try {
VulnerabilityUpdateStatus importStatus = cveClient.updateForProject(projectId);
JSONObject responseData = PortletUtils.importStatusToJSON(importStatus);
PrintWriter writer = response.getWriter();
writer.write(responseData.toString());
} catch (TException e) {
log.error("Error updating CVEs for project in backend.", e);
}
}
Aggregations