Search in sources :

Example 1 with RatingArtist

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

the class RatingArtistResource method getRatingArtist.

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

Example 2 with RatingArtist

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

the class RatingArtistResource method createRatingArtist.

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

Example 3 with RatingArtist

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

the class RatingArtistResource method updateRatingArtist.

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

Aggregations

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