+ "#bulkAction.operation == #bulkAction.operation.DRYRUN))")
@RequestMapping(method = RequestMethod.POST, value = "/bulk")
public BulkActionRes bulkAction(@RequestBody final BulkAction bulkAction) {
LOG.debug("Bulk action '{}' called on '{}'", bulkAction.getOperation(), bulkAction.getTargets());
BulkActionRes res = new BulkActionRes();
switch (bulkAction.getOperation()) {
case DELETE:
for (String taskId : bulkAction.getTargets()) {
try {
res.add(delete(Long.valueOf(taskId)).getId(), BulkActionRes.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing delete for task {}", taskId, e);
res.add(taskId, BulkActionRes.Status.FAILURE);
}
}
break;
case DRYRUN:
for (String taskId : bulkAction.getTargets()) {
try {
execute(Long.valueOf(taskId), true);
res.add(taskId, BulkActionRes.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing dryrun for task {}", taskId, e);
res.add(taskId, BulkActionRes.Status.FAILURE);
}
}
break;
case EXECUTE:
for (String taskId : bulkAction.getTargets()) {
try {
execute(Long.valueOf(taskId), false);
res.add(taskId, BulkActionRes.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing execute for task {}", taskId, e);
res.add(taskId, BulkActionRes.Status.FAILURE);
}
}
break;
default:
}