Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public void evaluate_shouldReturnPatientDataForEachAppointmentInThePassedContext
}

@Test
@DirtiesContext
public void evaluate_shouldReturnPatientDataForNonConfidentialAppointments() throws Exception {
Context.becomeUser("butch");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public void evaluate_shouldReturnPersonDataForEachAppointmentInThePassedContext(
}

@Test
@DirtiesContext
public void evaluate_shouldReturnPersonDataForNonConfidentialAppointments() throws Exception {
Context.becomeUser("butch");

Expand Down
6 changes: 5 additions & 1 deletion api/src/test/resources/standardAppointmentTestDataset.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<dataset>

<provider provider_id="2" person_id="1" identifier="8A760-2" creator="1" date_created="2005-01-01 00:00:00.0" retired="false" uuid="c2299800-cca9-11e0-9572-0800200c9a67" />
<provider provider_id="3" person_id="1" identifier="8A760-3" creator="1" date_created="2005-01-01 00:00:00.0" retired="true" retire_reason="Test retired provider" uuid="c2299800-cca9-11e0-9572-0800200c9a68" />

<appointmentscheduling_appointment_type appointment_type_id="1" name="Initial HIV Clinic Appointment" duration="54" description="Initial HIV Clinic Appointment Description" creator="1" date_created="2005-01-01 00:00:00.0" retired="false" uuid="c0c579b0-8e59-401d-8a4a-976a0b183519" confidential="1"/>
<appointmentscheduling_appointment_type appointment_type_id="2" name="Return TB Clinic Appointment" duration="5" description="Return TB Clinic Appointment Description" creator="1" date_created="2005-01-01 00:00:00.0" retired="false" uuid="759799ab-c9a5-435e-b671-77773ada74e4" confidential="0"/>
<appointmentscheduling_appointment_type appointment_type_id="3" name="Hospitalization2" description="Hospitalization Description" duration="10" creator="1" date_created="2005-01-01 00:00:00.0" retired="false" retire_reason="Some Retire Reason" uuid="759799ab-c9a5-435e-b671-77773ada74e6" confidential="0"/>
Expand Down Expand Up @@ -54,7 +58,7 @@
<appointmentscheduling_appointment appointment_id="7" time_slot_id="8" appointment_type_id="1" patient_id="1" status="SCHEDULED" uuid="c0c579b0-8e59-401d-8a4a-976a0b183607" date_created="2005-01-01 00:00:00.0" voided="false" creator="1"/>
<appointmentscheduling_appointment appointment_id="8" time_slot_id="8" appointment_type_id="1" patient_id="1" status="CANCELLED" cancel_reason="provider sick" uuid="aaaa79b0-8e59-401d-8a4a-976a0b183607" date_created="2005-01-01 00:00:00.0" voided="false" creator="1"/>
<appointmentscheduling_appointment appointment_id="9" time_slot_id="8" appointment_type_id="1" patient_id="2" status="CANCELLED_AND_NEEDS_RESCHEDULE" uuid="bbbb79b0-8e59-401d-8a4a-976a0b183607" date_created="2005-01-01 00:00:00.0" voided="false" creator="1"/>
<appointmentscheduling_appointment appointment_id="10" time_slot_id="8" appointment_type_id="1" patient_id="3" status="SCHEDULED" uuid="cccc79b0-8e59-401d-8a4a-976a0b183607" date_created="2005-01-01 00:00:00.0" voided="true" creator="1"/>
<appointmentscheduling_appointment appointment_id="10" time_slot_id="8" appointment_type_id="1" patient_id="2" status="SCHEDULED" uuid="cccc79b0-8e59-401d-8a4a-976a0b183607" date_created="2005-01-01 00:00:00.0" voided="true" creator="1"/>
<appointmentscheduling_appointment appointment_id="11" time_slot_id="8" appointment_type_id="1" patient_id="6" status="WALKIN" uuid="dddd79b0-8e59-401d-8a4a-976a0b183607" date_created="2005-01-01 00:00:00.0" voided="false" creator="1"/>
<appointmentscheduling_appointment appointment_id="12" time_slot_id="9" appointment_type_id="1" patient_id="6" status="WALKIN" uuid="dddd79b0-8e59-401d-8a4a-976a0b183608" date_created="2005-01-01 00:00:00.0" voided="false" creator="1"/>
<appointmentscheduling_appointment appointment_id="13" time_slot_id="6" appointment_type_id="3" visit_id="2" patient_id="2" status="COMPLETED" uuid="c0c57900-8e59-401d-8a4a-976a0b183605" date_created="2005-01-01 00:00:00.0" voided="false" creator="1"/>
Expand Down
2 changes: 1 addition & 1 deletion omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>webservices.rest-omod</artifactId>
<artifactId>webservices.rest-omod-1.11</artifactId>
<version>${webservicesRestVersion}</version>
<scope>provided</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import org.openmrs.module.appointmentscheduling.api.AppointmentService;
import org.openmrs.module.appointmentscheduling.rest.controller.AppointmentRestController;
import org.openmrs.module.appointmentscheduling.rest.resource.openmrs1_9.util.AppointmentRestUtils;
import org.openmrs.module.webservices.rest.web.ConversionUtil;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.ConversionUtil;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
import org.openmrs.module.webservices.rest.web.representation.Representation;
Expand Down Expand Up @@ -145,9 +146,21 @@ protected PageableResult doSearch(RequestContext context) {

}

public String getDisplayString(AppointmentBlock appointmentBlock) {
return appointmentBlock.getProvider() + ", " + appointmentBlock.getLocation() + ": "
+ appointmentBlock.getStartDate() + " - " + appointmentBlock.getEndDate();
}
@PropertyGetter("display")
public String getDisplayString(AppointmentBlock appointmentBlock) {
String providerName = "";
if (appointmentBlock.getProvider() != null && appointmentBlock.getProvider().getPerson() != null
&& appointmentBlock.getProvider().getPerson().getPersonName() != null) {
String fullName = appointmentBlock.getProvider().getPerson().getPersonName().getFullName();
String suffix = appointmentBlock.getProvider().getPerson().getPersonName().getFamilyNameSuffix();
if (suffix != null && suffix.trim().length() > 0) {
providerName = fullName + " " + suffix.trim();
} else {
providerName = fullName;
}
}
return providerName + ", " + appointmentBlock.getLocation() + ": "
+ appointmentBlock.getStartDate() + " - " + appointmentBlock.getEndDate();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.openmrs.module.appointmentscheduling.rest.controller.AppointmentRestController;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
Expand Down Expand Up @@ -160,6 +161,7 @@ protected NeedsPaging<AppointmentRequest> doGetAll(RequestContext context) {
context.getIncludeAll()), context);
}

@PropertyGetter("display")
public String getDisplayString(AppointmentRequest appointmentRequest) {
return appointmentRequest.getAppointmentType().getName() + " : " + appointmentRequest.getStatus();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import org.openmrs.module.webservices.rest.web.ConversionUtil;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
import org.openmrs.module.webservices.rest.web.representation.Representation;
Expand All @@ -24,7 +25,7 @@
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging;
import org.openmrs.module.webservices.rest.web.response.ResponseException;
import org.openmrs.module.webservices.validation.ValidationException;
import org.openmrs.api.ValidationException;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;

Expand Down Expand Up @@ -253,7 +254,8 @@ private List<AppointmentStatus> getStatusList(String[] statuses) {
return statusList;
}

public String getDisplayString(PatientAppointment appointment) {
return appointment.getAppointmentType().getName() + " : " + appointment.getStatus();
}
}
@PropertyGetter("display")
public String getDisplayString(PatientAppointment appointment) {
return appointment.getAppointmentType().getName() + " : " + appointment.getStatus();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.openmrs.module.appointmentscheduling.rest.controller.AppointmentRestController;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
Expand Down Expand Up @@ -82,6 +83,7 @@ protected PageableResult doSearch(RequestContext context) {
return new NeedsPaging<AppointmentStatusHistory>(Context.getService(AppointmentService.class).getAppointmentStatusHistories(appointment), context);
}

@PropertyGetter("display")
public String getDisplayString(AppointmentStatusHistory statusHistory) {
return statusHistory.getStartDate() + " "+statusHistory.getEndDate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.openmrs.module.appointmentscheduling.rest.resource.openmrs1_9.util.AppointmentRestUtils;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
Expand Down Expand Up @@ -131,6 +132,7 @@ protected PageableResult doSearch(RequestContext context) {

}

@PropertyGetter("display")
public String getDisplayString(ProviderSchedule schedule) {
return schedule.getLocation() + ": "
+ schedule.getStartTime() + " - " + schedule.getEndTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.openmrs.module.webservices.rest.web.ConversionUtil;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
Expand Down Expand Up @@ -157,8 +158,21 @@ protected PageableResult doSearch(RequestContext context) {

}

@PropertyGetter("display")
public String getDisplayString(TimeSlot timeSlot) {
return timeSlot.getAppointmentBlock().getProvider() + ", " + timeSlot.getAppointmentBlock().getLocation() + ": "
String providerName = "";
if (timeSlot.getAppointmentBlock().getProvider() != null
&& timeSlot.getAppointmentBlock().getProvider().getPerson() != null
&& timeSlot.getAppointmentBlock().getProvider().getPerson().getPersonName() != null) {
String fullName = timeSlot.getAppointmentBlock().getProvider().getPerson().getPersonName().getFullName();
String suffix = timeSlot.getAppointmentBlock().getProvider().getPerson().getPersonName().getFamilyNameSuffix();
if (suffix != null && suffix.trim().length() > 0) {
providerName = fullName + " " + suffix.trim();
} else {
providerName = fullName;
}
}
return providerName + ", " + timeSlot.getAppointmentBlock().getLocation() + ": "
+ timeSlot.getStartDate() + " - " + timeSlot.getEndDate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void shouldPurgeAnAppointmentBlock() throws Exception {
int originalCount = 5;

MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/759799ab-c9a5-435e-b671-77773ada7410");
req.addParameter("purge", "");
req.addParameter("purge", "true");
req.addParameter("reason", "really ridiculous random reason");
handle(req);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void shouldVoidAnAppointment() throws Exception {
public void shouldPurgeAnAppointment() throws Exception {

MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + getUuid());
req.addParameter("purge", "");
req.addParameter("purge", "true");
req.addParameter("reason", "really ridiculous random reason");
handle(req);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void shouldPurgeAnAppointment() throws Exception {

MockHttpServletRequest req = request(RequestMethod.DELETE, getURI()
+ "/" + getUuid());
req.addParameter("purge", "");
req.addParameter("purge", "true");
req.addParameter("reason", "really ridiculous random reason");
handle(req);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void shouldPurgeAnAppointmentType() throws Exception {
int originalCount = 4;

MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/759799ab-c9a5-435e-b671-77373ada74e6");
req.addParameter("purge", "");
req.addParameter("purge", "true");
req.addParameter("reason", "really ridiculous random reason");
handle(req);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void shouldPurgeATimeSlot() throws Exception {
int originalCount = 8;

MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/c0c579b0-8e59-401d-8a4a-976a0b183607");
req.addParameter("purge", "");
req.addParameter("purge", "true");
req.addParameter("reason", "really ridiculous random reason");
handle(req);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public void validateFullRepresentation() throws Exception {
assertPropPresent("auditInfo");
}

@Override
public String getDisplayProperty() {
return "Mr. Horatio Test Hornblower Esq., Xanadu: 2005-01-03 00:00:00.0 - 2005-01-03 11:00:00.0";
}
@Override
public String getDisplayProperty() {
return "Mr. Horatio Test Hornblower Esq., Xanadu: 2005-01-03 00:00:00.0 - 2005-01-03 11:00:00.0";
}

@Override
public String getUuidProperty() {
Expand Down
Loading