use of org.eclipse.sw360.datahandler.thrift.users.User 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());
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class BulkReleaseEdit method doView.
@Override
public void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
final User user = UserCacheHolder.getUserFromRequest(request);
ComponentService.Iface client = thriftClients.makeComponentClient();
try {
final List<Release> releaseSummary = client.getReleaseSummary(user);
request.setAttribute(RELEASE_LIST, releaseSummary);
} catch (TException e) {
log.error("Could not fetch releases from backend", e);
request.setAttribute(RELEASE_LIST, Collections.emptyList());
}
// Proceed with page rendering
super.doView(request, response);
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class DatabaseSanitation method importLicensesFromSPDX.
private void importLicensesFromSPDX(ResourceRequest request, ResourceResponse response) throws TException {
User user = UserCacheHolder.getUserFromRequest(request);
LicenseService.Iface licenseClient = thriftClients.makeLicenseClient();
RequestSummary requestSummary = licenseClient.importAllSpdxLicenses(user);
renderRequestSummary(request, response, requestSummary);
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class ScheduleAdminPortlet method scheduleCveSearch.
@UsedAsLiferayAction
public void scheduleCveSearch(ActionRequest request, ActionResponse response) throws PortletException, IOException {
try {
User user = UserCacheHolder.getUserFromRequest(request);
RequestSummary requestSummary = new ThriftClients().makeScheduleClient().scheduleService(ThriftClients.CVESEARCH_SERVICE);
setSessionMessage(request, requestSummary.getRequestStatus(), "Task", "schedule");
} catch (TException e) {
log.error(e);
}
}
use of org.eclipse.sw360.datahandler.thrift.users.User in project sw360portal by sw360.
the class ScheduleAdminPortlet method unscheduleAllServices.
@UsedAsLiferayAction
public void unscheduleAllServices(ActionRequest request, ActionResponse response) throws PortletException, IOException {
try {
User user = UserCacheHolder.getUserFromRequest(request);
RequestStatus requestStatus = new ThriftClients().makeScheduleClient().unscheduleAllServices(user);
setSessionMessage(request, requestStatus, "Every task", "unschedule");
} catch (TException e) {
log.error(e);
}
}
Aggregations