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