Search in sources :

Example 16 with BadRequestAlertException

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

the class SocialResource method createSocial.

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

Example 17 with BadRequestAlertException

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

the class UserExtResource method createUserExt.

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

Example 18 with BadRequestAlertException

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

the class AlphaResource method createAlpha.

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

Example 19 with BadRequestAlertException

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

the class ArtistResource method createArtist.

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

Example 20 with BadRequestAlertException

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

the class BetaResource method createBeta.

/**
 * POST  /betas : Create a new beta.
 *
 * @param beta the beta to create
 * @return the ResponseEntity with status 201 (Created) and with body the new beta, or with status 400 (Bad Request) if the beta has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/betas")
@Timed
public ResponseEntity<Beta> createBeta(@RequestBody Beta beta) throws URISyntaxException {
    log.debug("REST request to save Beta : {}", beta);
    if (beta.getId() != null) {
        throw new BadRequestAlertException("A new beta cannot already have an ID", ENTITY_NAME, "idexists");
    }
    Beta result = betaService.save(beta);
    return ResponseEntity.created(new URI("/api/betas/" + 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) Beta(com.dubion.domain.Beta) 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