Search in sources :

Example 21 with BadRequestAlertException

use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.

the class FavouriteAlbumResource method createFavouriteAlbum.

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

Example 22 with BadRequestAlertException

use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.

the class GammaResource method createGamma.

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

Example 23 with BadRequestAlertException

use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.

the class GenreResource method createGenre.

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

Example 24 with BadRequestAlertException

use of com.dubion.web.rest.errors.BadRequestAlertException 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)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)24 BadRequestAlertException (com.dubion.web.rest.errors.BadRequestAlertException)24 URI (java.net.URI)24 Album (com.dubion.domain.Album)1 Alpha (com.dubion.domain.Alpha)1 Artist (com.dubion.domain.Artist)1 Band (com.dubion.domain.Band)1 BandPrueba (com.dubion.domain.BandPrueba)1 Beta (com.dubion.domain.Beta)1 Country (com.dubion.domain.Country)1 FavouriteAlbum (com.dubion.domain.FavouriteAlbum)1 FavouriteBand (com.dubion.domain.FavouriteBand)1 FavouriteSong (com.dubion.domain.FavouriteSong)1 Gamma (com.dubion.domain.Gamma)1 Genre (com.dubion.domain.Genre)1 Instrument (com.dubion.domain.Instrument)1 Label (com.dubion.domain.Label)1 RatingAlbum (com.dubion.domain.RatingAlbum)1 RatingArtist (com.dubion.domain.RatingArtist)1 RatingBand (com.dubion.domain.RatingBand)1