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