use of com.dubion.domain.Band 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.domain.Band in project dubion by valsamiq.
the class BandResource method getBand.
/**
* GET /bands/:id : get the "id" band.
*
* @param id the id of the band to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the band, or with status 404 (Not Found)
*/
@GetMapping("/bands/{id}")
@Timed
public ResponseEntity<Band> getBand(@PathVariable Long id) {
log.debug("REST request to get Band : {}", id);
Band band = bandService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(band));
}
use of com.dubion.domain.Band in project dubion by valsamiq.
the class BandResource method updateBand.
/**
* PUT /bands : Updates an existing band.
*
* @param band the band to update
* @return the ResponseEntity with status 200 (OK) and with body the updated band,
* or with status 400 (Bad Request) if the band is not valid,
* or with status 500 (Internal Server Error) if the band couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/bands")
@Timed
public ResponseEntity<Band> updateBand(@RequestBody Band band) throws URISyntaxException {
log.debug("REST request to update Band : {}", band);
if (band.getId() == null) {
return createBand(band);
}
Band result = bandService.save(band);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, band.getId().toString())).body(result);
}
Aggregations