Exemplo n.º 1
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);
 }
Exemplo n.º 2
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);
 }