예제 #1
0
 /** DELETE /roles/:id -> delete the "id" role. */
 @RequestMapping(
     value = "/roles/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteRole(@PathVariable Long id) {
   log.debug("REST request to delete Role : {}", id);
   roleRepository.delete(id);
   roleSearchRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("role", id.toString()))
       .build();
 }
예제 #2
0
 /** PUT /roles -> Updates an existing role. */
 @RequestMapping(
     value = "/roles",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Role> updateRole(@Valid @RequestBody Role role) throws URISyntaxException {
   log.debug("REST request to update Role : {}", role);
   if (role.getId() == null) {
     return createRole(role);
   }
   Role result = roleRepository.save(role);
   roleSearchRepository.save(role);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("role", role.getId().toString()))
       .body(result);
 }
예제 #3
0
 /** 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);
 }
예제 #4
0
 /** POST /roles -> Create a new role. */
 @RequestMapping(
     value = "/roles",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Role> createRole(@Valid @RequestBody Role role) throws URISyntaxException {
   log.debug("REST request to save Role : {}", role);
   if (role.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new role cannot already have an ID")
         .body(null);
   }
   Role result = roleRepository.save(role);
   roleSearchRepository.save(result);
   return ResponseEntity.created(new URI("/api/roles/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("role", result.getId().toString()))
       .body(result);
 }
예제 #5
0
 /** 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);
 }