@PreAuthorize("hasPermission(#jobId, 'job', 'admin')")
@RequestMapping(value = "/jobs/{jobId}", method = RequestMethod.DELETE)
@ResponseBody
public DeleteJobResponse deleteJob(@PathVariable String jobId) throws NotFound {
MetaGraphTx tx = metaGraphService.newTransaction();
DeleteJobResponse deleteJobResponse;
try {
JobMetadata jobMetadata = tx.getJob(jobId);
if (jobMetadata == null) {
throw new NotFound(JobMetadata.class, jobId);
}
tx.deleteJob(jobMetadata);
deleteJobResponse = new DeleteJobResponse();
} catch (Throwable t) {
tx.rollback();
throw t;
}