Search in sources :

Example 1 with Beta

use of com.dubion.domain.Beta in project dubion by valsamiq.

the class BetaResource method getBeta.

/**
 * GET  /betas/:id : get the "id" beta.
 *
 * @param id the id of the beta to retrieve
 * @return the ResponseEntity with status 200 (OK) and with body the beta, or with status 404 (Not Found)
 */
@GetMapping("/betas/{id}")
@Timed
public ResponseEntity<Beta> getBeta(@PathVariable Long id) {
    log.debug("REST request to get Beta : {}", id);
    Beta beta = betaService.findOne(id);
    return ResponseUtil.wrapOrNotFound(Optional.ofNullable(beta));
}
Also used : Beta(com.dubion.domain.Beta) Timed(com.codahale.metrics.annotation.Timed)

Example 2 with Beta

use of com.dubion.domain.Beta in project dubion by valsamiq.

the class BetaResource method updateBeta.

/**
 * PUT  /betas : Updates an existing beta.
 *
 * @param beta the beta to update
 * @return the ResponseEntity with status 200 (OK) and with body the updated beta,
 * or with status 400 (Bad Request) if the beta is not valid,
 * or with status 500 (Internal Server Error) if the beta couldn't be updated
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PutMapping("/betas")
@Timed
public ResponseEntity<Beta> updateBeta(@RequestBody Beta beta) throws URISyntaxException {
    log.debug("REST request to update Beta : {}", beta);
    if (beta.getId() == null) {
        return createBeta(beta);
    }
    Beta result = betaService.save(beta);
    return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, beta.getId().toString())).body(result);
}
Also used : Beta(com.dubion.domain.Beta) Timed(com.codahale.metrics.annotation.Timed)

Example 3 with Beta

use of com.dubion.domain.Beta 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)3 Beta (com.dubion.domain.Beta)3 BadRequestAlertException (com.dubion.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1