コード例 #1
0
 /** POST /organizers -> Create a new organizer. */
 @RequestMapping(
     value = "/organizers",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Organizer> createOrganizer(@Valid @RequestBody Organizer organizer)
     throws URISyntaxException {
   log.debug("REST request to save Organizer : {}", organizer);
   if (organizer.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "organizer", "idexists", "A new organizer cannot already have an ID"))
         .body(null);
   }
   Organizer result = organizerService.save(organizer);
   return ResponseEntity.created(new URI("/api/organizers/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("organizer", result.getId().toString()))
       .body(result);
 }
コード例 #2
0
 /** DELETE /organizers/:id -> delete the "id" organizer. */
 @RequestMapping(
     value = "/organizers/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteOrganizer(@PathVariable Long id) {
   log.debug("REST request to delete Organizer : {}", id);
   organizerService.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("organizer", id.toString()))
       .build();
 }
コード例 #3
0
 /** PUT /organizers -> Updates an existing organizer. */
 @RequestMapping(
     value = "/organizers",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Organizer> updateOrganizer(@Valid @RequestBody Organizer organizer)
     throws URISyntaxException {
   log.debug("REST request to update Organizer : {}", organizer);
   if (organizer.getId() == null) {
     return createOrganizer(organizer);
   }
   Organizer result = organizerService.save(organizer);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("organizer", organizer.getId().toString()))
       .body(result);
 }