Search in sources :

Example 1 with Social

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

the class SocialResource method updateSocial.

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

Example 2 with Social

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

the class SocialResource method getSocial.

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

Example 3 with Social

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

the class SocialResource method createSocial.

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

Aggregations

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