Ejemplo n.º 1
0
 /**
  * POST /queues : Create a new queue.
  *
  * @param queue the queue to create
  * @return the ResponseEntity with status 201 (Created) and with body the new queue, or with
  *     status 400 (Bad Request) if the queue has already an ID
  * @throws URISyntaxException if the Location URI syntax is incorrect
  */
 @RequestMapping(
     value = "/queues",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Queue> createQueue(@RequestBody Queue queue) throws URISyntaxException {
   log.debug("REST request to save Queue : {}", queue);
   if (queue.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "queue", "idexists", "A new queue cannot already have an ID"))
         .body(null);
   }
   Queue result = queueRepository.save(queue);
   return ResponseEntity.created(new URI("/api/queues/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("queue", result.getId().toString()))
       .body(result);
 }
Ejemplo n.º 2
0
 /**
  * DELETE /queues/:id : delete the "id" queue.
  *
  * @param id the id of the queue to delete
  * @return the ResponseEntity with status 200 (OK)
  */
 @RequestMapping(
     value = "/queues/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteQueue(@PathVariable Long id) {
   log.debug("REST request to delete Queue : {}", id);
   queueRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("queue", id.toString()))
       .build();
 }
Ejemplo n.º 3
0
 /**
  * PUT /queues : Updates an existing queue.
  *
  * @param queue the queue to update
  * @return the ResponseEntity with status 200 (OK) and with body the updated queue, or with status
  *     400 (Bad Request) if the queue is not valid, or with status 500 (Internal Server Error) if
  *     the queue couldnt be updated
  * @throws URISyntaxException if the Location URI syntax is incorrect
  */
 @RequestMapping(
     value = "/queues",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Queue> updateQueue(@RequestBody Queue queue) throws URISyntaxException {
   log.debug("REST request to update Queue : {}", queue);
   if (queue.getId() == null) {
     return createQueue(queue);
   }
   Queue result = queueRepository.save(queue);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("queue", queue.getId().toString()))
       .body(result);
 }