/** * REST service for deleting a patient. * * @param patientId the patient id */ @Path("deletePatient") @DELETE @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public void deletePatient(@QueryParam(value = "patientId") long patientId) { patientService.remove(patientId); }
/** * REST service for getting an patient with a specified id. * * @param patientId the specified patient id * @return the patient with the specified id. */ @GET @Path("getPatient/{patientId}") @Produces(MediaType.APPLICATION_JSON) public Patient getPatientById(@PathParam(value = "patientId") long patientId) { Patient patient = patientService.findById(patientId); return patient; }
/** * REST service for getting all patients. * * @return list with all patients. */ @GET @Path("getPatients") @Produces(MediaType.APPLICATION_JSON) public List<Patient> getAllPatients() { List<Patient> patientsList = patientService.findAll(); return patientsList; }
/** * REST service for creating a patient. * * @param patient patient to be created. * @return created patient. */ @Path("updatePatient") @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Patient updatePatient(Patient patient) { Patient updated = patientService.update(patient); return updated; }
/** * REST service for creating a patient. * * @param patient patient to be created. * @return created patient. */ @Path("createPatient") @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Patient createPatient(Patient patient) { Patient persisted = patientService.create(patient); return persisted; }