Search in sources :

Example 1 with Gamma

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

the class GammaResource method updateGamma.

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

Example 2 with Gamma

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

the class GammaResource method createGamma.

/**
 * POST  /gammas : Create a new gamma.
 *
 * @param gamma the gamma to create
 * @return the ResponseEntity with status 201 (Created) and with body the new gamma, or with status 400 (Bad Request) if the gamma has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/gammas")
@Timed
public ResponseEntity<Gamma> createGamma(@RequestBody Gamma gamma) throws URISyntaxException {
    log.debug("REST request to save Gamma : {}", gamma);
    if (gamma.getId() != null) {
        throw new BadRequestAlertException("A new gamma cannot already have an ID", ENTITY_NAME, "idexists");
    }
    Gamma result = gammaService.save(gamma);
    return ResponseEntity.created(new URI("/api/gammas/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Also used : BadRequestAlertException(com.dubion.web.rest.errors.BadRequestAlertException) Gamma(com.dubion.domain.Gamma) URI(java.net.URI) Timed(com.codahale.metrics.annotation.Timed)

Example 3 with Gamma

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

the class GammaResource method getGamma.

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

Aggregations

Timed (com.codahale.metrics.annotation.Timed)3 Gamma (com.dubion.domain.Gamma)3 BadRequestAlertException (com.dubion.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1