use of com.dubion.domain.RatingBand in project dubion by valsamiq.
the class RatingBandResource method createRatingBand.
/**
* POST /rating-bands : Create a new ratingBand.
*
* @param ratingBand the ratingBand to create
* @return the ResponseEntity with status 201 (Created) and with body the new ratingBand, or with status 400 (Bad Request) if the ratingBand has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/rating-bands")
@Timed
public ResponseEntity<RatingBand> createRatingBand(@RequestBody RatingBand ratingBand) throws URISyntaxException {
log.debug("REST request to save RatingBand : {}", ratingBand);
if (ratingBand.getId() != null) {
throw new BadRequestAlertException("A new ratingBand cannot already have an ID", ENTITY_NAME, "idexists");
}
RatingBand result = ratingBandRepository.save(ratingBand);
return ResponseEntity.created(new URI("/api/rating-bands/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of com.dubion.domain.RatingBand in project dubion by valsamiq.
the class RatingBandResource method getRatingBand.
/**
* GET /rating-bands/:id : get the "id" ratingBand.
*
* @param id the id of the ratingBand to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the ratingBand, or with status 404 (Not Found)
*/
@GetMapping("/rating-bands/{id}")
@Timed
public ResponseEntity<RatingBand> getRatingBand(@PathVariable Long id) {
log.debug("REST request to get RatingBand : {}", id);
RatingBand ratingBand = ratingBandRepository.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(ratingBand));
}
use of com.dubion.domain.RatingBand in project dubion by valsamiq.
the class RatingBandResource method updateRatingBand.
/**
* PUT /rating-bands : Updates an existing ratingBand.
*
* @param ratingBand the ratingBand to update
* @return the ResponseEntity with status 200 (OK) and with body the updated ratingBand,
* or with status 400 (Bad Request) if the ratingBand is not valid,
* or with status 500 (Internal Server Error) if the ratingBand couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/rating-bands")
@Timed
public ResponseEntity<RatingBand> updateRatingBand(@RequestBody RatingBand ratingBand) throws URISyntaxException {
log.debug("REST request to update RatingBand : {}", ratingBand);
if (ratingBand.getId() == null) {
return createRatingBand(ratingBand);
}
RatingBand result = ratingBandRepository.save(ratingBand);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, ratingBand.getId().toString())).body(result);
}
Aggregations