/** PUT /parameters -> Updates an existing parameter. */ @RequestMapping( value = "/parameters", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Parameter> updateParameter(@Valid @RequestBody Parameter parameter) throws URISyntaxException { log.debug("REST request to update Parameter : {}", parameter); if (parameter.getId() == null) { return createParameter(parameter); } Parameter result = parameterRepository.save(parameter); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert("parameter", parameter.getId().toString())) .body(result); }
/** POST /parameters -> Create a new parameter. */ @RequestMapping( value = "/parameters", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Parameter> createParameter(@Valid @RequestBody Parameter parameter) throws URISyntaxException { log.debug("REST request to save Parameter : {}", parameter); if (parameter.getId() != null) { return ResponseEntity.badRequest() .headers( HeaderUtil.createFailureAlert( "parameter", "idexists", "A new parameter cannot already have an ID")) .body(null); } Parameter result = parameterRepository.save(parameter); return ResponseEntity.created(new URI("/api/parameters/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert("parameter", result.getId().toString())) .body(result); }