+ "(hasRole('USER_UPDATE') and "
+ "(#bulkAction.operation == #bulkAction.operation.REACTIVATE or "
+ "#bulkAction.operation == #bulkAction.operation.SUSPEND))")
@RequestMapping(method = RequestMethod.POST, value = "/bulk")
public BulkActionRes bulkAction(@RequestBody final BulkAction bulkAction) {
BulkActionRes res = new BulkActionRes();
switch (bulkAction.getOperation()) {
case DELETE:
for (String userId : bulkAction.getTargets()) {
try {
res.add(doDelete(Long.valueOf(userId)).getId(), Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing delete for user {}", userId, e);
res.add(userId, Status.FAILURE);
}
}
break;
case SUSPEND:
for (String userId : bulkAction.getTargets()) {
try {
res.add(suspend(Long.valueOf(userId)).getId(), Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing suspend for user {}", userId, e);
res.add(userId, Status.FAILURE);
}
}
break;
case REACTIVATE:
for (String userId : bulkAction.getTargets()) {
try {
res.add(reactivate(Long.valueOf(userId)).getId(), Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing reactivate for user {}", userId, e);
res.add(userId, Status.FAILURE);
}
}
break;
default:
}