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