use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.
the class BandResource method createBand.
/**
* POST /bands : Create a new band.
*
* @param band the band to create
* @return the ResponseEntity with status 201 (Created) and with body the new band, or with status 400 (Bad Request) if the band has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/bands")
@Timed
public ResponseEntity<Band> createBand(@RequestBody Band band) throws URISyntaxException {
log.debug("REST request to save Band : {}", band);
if (band.getId() != null) {
throw new BadRequestAlertException("A new band cannot already have an ID", ENTITY_NAME, "idexists");
}
Band result = bandService.save(band);
return ResponseEntity.created(new URI("/api/band/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.
the class CountryResource method createCountry.
/**
* POST /countries : Create a new country.
*
* @param country the country to create
* @return the ResponseEntity with status 201 (Created) and with body the new country, or with status 400 (Bad Request) if the country has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/countries")
@Timed
public ResponseEntity<Country> createCountry(@RequestBody Country country) throws URISyntaxException {
log.debug("REST request to save Country : {}", country);
if (country.getId() != null) {
throw new BadRequestAlertException("A new country cannot already have an ID", ENTITY_NAME, "idexists");
}
Country result = countryRepository.save(country);
return ResponseEntity.created(new URI("/api/countries/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.
the class RatingSongResource method createRatingSong.
/**
* POST /rating-songs : Create a new ratingSong.
*
* @param ratingSong the ratingSong to create
* @return the ResponseEntity with status 201 (Created) and with body the new ratingSong, or with status 400 (Bad Request) if the ratingSong has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/rating-songs")
@Timed
public ResponseEntity<RatingSong> createRatingSong(@RequestBody RatingSong ratingSong) throws URISyntaxException {
log.debug("REST request to save RatingSong : {}", ratingSong);
if (ratingSong.getId() != null) {
throw new BadRequestAlertException("A new ratingSong cannot already have an ID", ENTITY_NAME, "idexists");
}
RatingSong result = ratingSongRepository.save(ratingSong);
return ResponseEntity.created(new URI("/api/rating-songs/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.
the class ReviewResource method createReview.
/**
* POST /reviews : Create a new review.
*
* @param review the review to create
* @return the ResponseEntity with status 201 (Created) and with body the new review, or with status 400 (Bad Request) if the review has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/reviews")
@Timed
public ResponseEntity<Review> createReview(@RequestBody Review review) throws URISyntaxException {
log.debug("REST request to save Review : {}", review);
if (review.getId() != null) {
throw new BadRequestAlertException("A new review cannot already have an ID", ENTITY_NAME, "idexists");
}
Review result = reviewRepository.save(review);
return ResponseEntity.created(new URI("/api/reviews/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of com.dubion.web.rest.errors.BadRequestAlertException in project dubion by valsamiq.
the class SexResource method createSex.
/**
* POST /sexes : Create a new sex.
*
* @param sex the sex to create
* @return the ResponseEntity with status 201 (Created) and with body the new sex, or with status 400 (Bad Request) if the sex has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/sexes")
@Timed
public ResponseEntity<Sex> createSex(@RequestBody Sex sex) throws URISyntaxException {
log.debug("REST request to save Sex : {}", sex);
if (sex.getId() != null) {
throw new BadRequestAlertException("A new sex cannot already have an ID", ENTITY_NAME, "idexists");
}
Sex result = sexRepository.save(sex);
return ResponseEntity.created(new URI("/api/sexes/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Aggregations