/** POST /projects -> Create a new project. */ @RequestMapping( value = "/projects", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> create(@Valid @RequestBody Project project) throws URISyntaxException { log.debug("REST request to save Project : {}", project); if (project.getId() != null) { return ResponseEntity.badRequest() .header("Failure", "A new project cannot already have an ID") .build(); } projectRepository.save(project); return ResponseEntity.created(new URI("/api/projects/" + project.getId())).build(); }
/** PUT /projects -> Updates an existing project. */ @RequestMapping( value = "/projects", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> update(@Valid @RequestBody Project project) throws URISyntaxException { log.debug("REST request to update Project : {}", project); if (project.getId() == null) { return create(project); } projectRepository.save(project); return ResponseEntity.ok().build(); }