Search in sources :

Example 1 with BadRequestAlertException

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

the class FavouriteBandResource method createFavouriteBand.

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

Example 2 with BadRequestAlertException

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

the class FavouriteSongResource method createFavouriteSong.

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

Example 3 with BadRequestAlertException

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

the class InstrumentResource method createInstrument.

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

Example 4 with BadRequestAlertException

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

the class LabelResource method createLabel.

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

Example 5 with BadRequestAlertException

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

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