use of org.eclipse.sw360.datahandler.thrift.RemoveModeratorRequestStatus in project sw360portal by sw360.
the class ModerationPortlet method removeMeFromModerators.
private void removeMeFromModerators(ResourceRequest request, ResourceResponse response) {
final User user = UserCacheHolder.getUserFromRequest(request);
final String id = request.getParameter(MODERATION_ID);
ModerationService.Iface client = thriftClients.makeModerationClient();
RemoveModeratorRequestStatus status = null;
try {
status = client.removeUserFromAssignees(id, user);
request.setAttribute(PortalConstants.REQUEST_STATUS, status);
} catch (TException e) {
log.error("Error in Moderation ", e);
}
renderRemoveModerationRequestStatus(request, response, status);
}
use of org.eclipse.sw360.datahandler.thrift.RemoveModeratorRequestStatus in project sw360portal by sw360.
the class ModerationHandler method removeUserFromAssignees.
@Override
public RemoveModeratorRequestStatus removeUserFromAssignees(String requestId, User user) throws TException {
ModerationRequest request = handler.getRequest(requestId);
if (request.getModerators().size() == 1) {
return RemoveModeratorRequestStatus.LAST_MODERATOR;
}
request.getModerators().remove(user.getEmail());
request.setModerationState(ModerationState.PENDING);
request.unsetReviewer();
handler.updateModerationRequest(request);
return RemoveModeratorRequestStatus.SUCCESS;
}
Aggregations