Search in sources :

Example 1 with RatingAlbum

use of com.dubion.domain.RatingAlbum in project dubion by valsamiq.

the class RatingAlbumResource method createRatingAlbum.

/**
 * POST  /rating-albums : Create a new ratingAlbum.
 *
 * @param ratingAlbum the ratingAlbum to create
 * @return the ResponseEntity with status 201 (Created) and with body the new ratingAlbum, or with status 400 (Bad Request) if the ratingAlbum has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/rating-albums")
@Timed
public ResponseEntity<RatingAlbum> createRatingAlbum(@RequestBody RatingAlbum ratingAlbum) throws URISyntaxException {
    log.debug("REST request to save RatingAlbum : {}", ratingAlbum);
    if (ratingAlbum.getId() != null) {
        throw new BadRequestAlertException("A new ratingAlbum cannot already have an ID", ENTITY_NAME, "idexists");
    }
    RatingAlbum result = ratingAlbumService.save(ratingAlbum);
    return ResponseEntity.created(new URI("/api/rating-album/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Also used : BadRequestAlertException(com.dubion.web.rest.errors.BadRequestAlertException) RatingAlbum(com.dubion.domain.RatingAlbum) URI(java.net.URI) Timed(com.codahale.metrics.annotation.Timed)

Example 2 with RatingAlbum

use of com.dubion.domain.RatingAlbum in project dubion by valsamiq.

the class RatingAlbumResource method updateRatingAlbum.

/**
 * PUT  /rating-albums : Updates an existing ratingAlbum.
 *
 * @param ratingAlbum the ratingAlbum to update
 * @return the ResponseEntity with status 200 (OK) and with body the updated ratingAlbum,
 * or with status 400 (Bad Request) if the ratingAlbum is not valid,
 * or with status 500 (Internal Server Error) if the ratingAlbum couldn't be updated
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PutMapping("/rating-albums")
@Timed
public ResponseEntity<RatingAlbum> updateRatingAlbum(@RequestBody RatingAlbum ratingAlbum) throws URISyntaxException {
    log.debug("REST request to update RatingAlbum : {}", ratingAlbum);
    if (ratingAlbum.getId() == null) {
        return createRatingAlbum(ratingAlbum);
    }
    RatingAlbum result = ratingAlbumService.save(ratingAlbum);
    return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, ratingAlbum.getId().toString())).body(result);
}
Also used : RatingAlbum(com.dubion.domain.RatingAlbum) Timed(com.codahale.metrics.annotation.Timed)

Example 3 with RatingAlbum

use of com.dubion.domain.RatingAlbum in project dubion by valsamiq.

the class RatingAlbumResource method getRatingAlbum.

/**
 * GET  /rating-albums/:id : get the "id" ratingAlbum.
 *
 * @param id the id of the ratingAlbum to retrieve
 * @return the ResponseEntity with status 200 (OK) and with body the ratingAlbum, or with status 404 (Not Found)
 */
@GetMapping("/rating-albums/{id}")
@Timed
public ResponseEntity<RatingAlbum> getRatingAlbum(@PathVariable Long id) {
    log.debug("REST request to get RatingAlbum : {}", id);
    RatingAlbum ratingAlbum = ratingAlbumService.findOne(id);
    return ResponseUtil.wrapOrNotFound(Optional.ofNullable(ratingAlbum));
}
Also used : RatingAlbum(com.dubion.domain.RatingAlbum) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)3 RatingAlbum (com.dubion.domain.RatingAlbum)3 BadRequestAlertException (com.dubion.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1