Пример #1
0
 /** POST /group -> Create a new group. */
 @RequestMapping(
     value = "/group",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> create(@RequestBody Group group) throws URISyntaxException {
   log.debug("REST request to save Group : {}", group);
   if (group.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new group cannot already have an ID")
         .build();
   }
   groupRepository.save(group);
   return ResponseEntity.created(new URI("/api/group/" + group.getId())).build();
 }
Пример #2
0
 /** PUT /group -> Updates an existing group. */
 @RequestMapping(
     value = "/group",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> update(@RequestBody Group group) throws URISyntaxException {
   log.debug("REST request to update Group : {}", group);
   if (group.getId() == null) {
     return create(group);
   }
   groupRepository.save(group);
   return ResponseEntity.ok().build();
 }