/** * Create a execution. * * <p>If the execution needs to be compiled, the compilation will be launched asynchronously by * this webservice. * * @param body The body of the request should contain the source code to compile * @return A unique ID representing the execution in the system. The id will be used for all * further interactions with the API */ @RequestMapping(method = RequestMethod.POST, value = "/programs") public PostProgramResponse postProgram(@RequestBody String body) { Program p = new Program(); PostProgramResponse response = new PostProgramResponse(); try { p.setStatus(ProgramStatus.NEW); p.setSourceCode(body); programsRepository.save(p); } catch (DataAccessException e) { response.status = RequestStatus.KO; response.programId = null; return response; } compilationService.compile(p); response.status = RequestStatus.OK; response.programId = p.getTid(); return response; }