Search in sources :

Example 1 with RemoveModeratorRequestStatus

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);
}
Also used : ModerationService(org.eclipse.sw360.datahandler.thrift.moderation.ModerationService) RemoveModeratorRequestStatus(org.eclipse.sw360.datahandler.thrift.RemoveModeratorRequestStatus) TException(org.apache.thrift.TException) User(org.eclipse.sw360.datahandler.thrift.users.User)

Example 2 with RemoveModeratorRequestStatus

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;
}
Also used : ModerationRequest(org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest)

Aggregations

TException (org.apache.thrift.TException)1 RemoveModeratorRequestStatus (org.eclipse.sw360.datahandler.thrift.RemoveModeratorRequestStatus)1 ModerationRequest (org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest)1 ModerationService (org.eclipse.sw360.datahandler.thrift.moderation.ModerationService)1 User (org.eclipse.sw360.datahandler.thrift.users.User)1