Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
  /**
   * 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;
  }
Exemplo n.º 3
0
  /**
   * 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;
  }
Exemplo n.º 4
0
  /**
   * 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;
  }
Exemplo n.º 5
0
  /**
   * 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;
  }