Exemplo n.º 1
0
 /** DELETE /accountings/:id -> delete the "id" accounting. */
 @RequestMapping(
     value = "/accountings/{id}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Void> deleteAccounting(@PathVariable Long id) {
   log.debug("REST request to delete Accounting : {}", id);
   accountingRepository.delete(id);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityDeletionAlert("accounting", id.toString()))
       .build();
 }
Exemplo n.º 2
0
 /** PUT /accountings -> Updates an existing accounting. */
 @RequestMapping(
     value = "/accountings",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Accounting> updateAccounting(@RequestBody Accounting accounting)
     throws URISyntaxException {
   log.debug("REST request to update Accounting : {}", accounting);
   if (accounting.getId() == null) {
     return createAccounting(accounting);
   }
   Accounting result = accountingRepository.save(accounting);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("accounting", accounting.getId().toString()))
       .body(result);
 }
Exemplo n.º 3
0
 /** POST /accountings -> Create a new accounting. */
 @RequestMapping(
     value = "/accountings",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Accounting> createAccounting(@RequestBody Accounting accounting)
     throws URISyntaxException {
   log.debug("REST request to save Accounting : {}", accounting);
   if (accounting.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new accounting cannot already have an ID")
         .body(null);
   }
   Accounting result = accountingRepository.save(accounting);
   return ResponseEntity.created(new URI("/api/accountings/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("accounting", result.getId().toString()))
       .body(result);
 }