/** POST /categorys -> Create a new category. */
 @RequestMapping(
     value = "/categorys",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Category> createCategory(@Valid @RequestBody Category category)
     throws URISyntaxException {
   log.debug("REST request to save Category : {}", category);
   if (category.getId() != null) {
     return ResponseEntity.badRequest()
         .headers(
             HeaderUtil.createFailureAlert(
                 "category", "idexists", "A new category cannot already have an ID"))
         .body(null);
   }
   Category result = categoryService.save(category);
   return ResponseEntity.created(new URI("/api/categorys/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("category", result.getId().toString()))
       .body(result);
 }
 /** DELETE /categorys/:id -> delete the "id" category. */
 @RequestMapping(
     value = "/categorys/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteCategory(@PathVariable Long id) {
   log.debug("REST request to delete Category : {}", id);
   categoryService.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("category", id.toString()))
       .build();
 }
 /** PUT /categorys -> Updates an existing category. */
 @RequestMapping(
     value = "/categorys",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Category> updateCategory(@Valid @RequestBody Category category)
     throws URISyntaxException {
   log.debug("REST request to update Category : {}", category);
   if (category.getId() == null) {
     return createCategory(category);
   }
   Category result = categoryService.save(category);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("category", category.getId().toString()))
       .body(result);
 }