use of com.liferay.portal.kernel.json.JSONFactoryUtil.createJSONObject in project sw360portal by sw360.
the class ProjectPortlet method updateVulnerabilityRating.
private void updateVulnerabilityRating(ResourceRequest request, ResourceResponse response) throws IOException {
String projectId = request.getParameter(PortalConstants.PROJECT_ID);
User user = UserCacheHolder.getUserFromRequest(request);
VulnerabilityService.Iface vulClient = thriftClients.makeVulnerabilityClient();
RequestStatus requestStatus = RequestStatus.FAILURE;
try {
Optional<ProjectVulnerabilityRating> projectVulnerabilityRatings = wrapThriftOptionalReplacement(vulClient.getProjectVulnerabilityRatingByProjectId(projectId, user));
ProjectVulnerabilityRating link = ProjectPortletUtils.updateProjectVulnerabilityRatingFromRequest(projectVulnerabilityRatings, request);
requestStatus = vulClient.updateProjectVulnerabilityRating(link, user);
} catch (TException e) {
log.error("Error updating vulnerability ratings for project in backend.", e);
}
JSONObject responseData = JSONFactoryUtil.createJSONObject();
responseData.put(PortalConstants.REQUEST_STATUS, requestStatus.toString());
PrintWriter writer = response.getWriter();
writer.write(responseData.toString());
}
Aggregations