use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentPortletUtils method deleteRelease.
public static RequestStatus deleteRelease(PortletRequest request, Logger log) {
String releaseId = request.getParameter(PortalConstants.RELEASE_ID);
if (releaseId != null) {
try {
String deleteCommentEncoded = request.getParameter(PortalConstants.MODERATION_REQUEST_COMMENT);
User user = UserCacheHolder.getUserFromRequest(request);
if (deleteCommentEncoded != null) {
String deleteComment = new String(Base64.getDecoder().decode(deleteCommentEncoded));
user.setCommentMadeDuringModerationRequest(deleteComment);
}
ComponentService.Iface client = new ThriftClients().makeComponentClient();
return client.deleteRelease(releaseId, UserCacheHolder.getUserFromRequest(request));
} catch (TException e) {
log.error("Could not delete release from DB", e);
}
}
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentPortletUtils method unsubscribeComponent.
public static RequestStatus unsubscribeComponent(ResourceRequest request, Logger log) {
String id = request.getParameter(PortalConstants.COMPONENT_ID);
if (id != null) {
try {
ComponentService.Iface client = new ThriftClients().makeComponentClient();
User user = UserCacheHolder.getUserFromRequest(request);
return client.unsubscribeComponent(id, user);
} catch (TException e) {
log.error("Could not unsubscribe to component", e);
}
}
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentPortletUtils method unsubscribeRelease.
public static RequestStatus unsubscribeRelease(ResourceRequest request, Logger log) {
String id = request.getParameter(PortalConstants.RELEASE_ID);
if (id != null) {
try {
ComponentService.Iface client = new ThriftClients().makeComponentClient();
User user = UserCacheHolder.getUserFromRequest(request);
return client.unsubscribeRelease(id, user);
} catch (TException e) {
log.error("Could not unsubscribe to release", e);
}
}
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ComponentPortletUtils method subscribeComponent.
public static RequestStatus subscribeComponent(ResourceRequest request, Logger log) {
String id = request.getParameter(PortalConstants.COMPONENT_ID);
if (id != null) {
try {
ComponentService.Iface client = new ThriftClients().makeComponentClient();
User user = UserCacheHolder.getUserFromRequest(request);
return client.subscribeComponent(id, user);
} catch (TException e) {
log.error("Could not subscribe to component", e);
}
}
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class VulnerabilityDatabaseHandler method addRelationsIfNecessary.
public RequestStatus addRelationsIfNecessary(String releaseId, Map<String, List<String>> needlesToVulnerabilityIds) {
RequestStatus requestStatus = RequestStatus.SUCCESS;
for (Map.Entry<String, List<String>> needleWithVulnerabilityIds : needlesToVulnerabilityIds.entrySet()) {
String usedNeedle = needleWithVulnerabilityIds.getKey();
List<String> vulnerabilityIds = needleWithVulnerabilityIds.getValue();
for (String vulnerabilityId : vulnerabilityIds) {
RequestStatus singleOperationStatus = addRelationIfNecessary(releaseId, vulnerabilityId, Optional.ofNullable(usedNeedle));
if (RequestStatus.FAILURE.equals(singleOperationStatus)) {
requestStatus = RequestStatus.FAILURE;
}
}
}
return requestStatus;
}
Aggregations