Skip to content

Commit

Permalink
UHM-1173, add appointmentstatustype webservice
Browse files Browse the repository at this point in the history
  • Loading branch information
cioan committed Apr 3, 2014
1 parent 4bfe517 commit d0cb8d5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ public class Appointment extends BaseOpenmrsData implements Serializable {
private static final long serialVersionUID = 1L;

public enum AppointmentStatusType {
SCHEDULED, ACTIVE, CANCELLED, MISSED, COMPLETED
SCHEDULED, ACTIVE, CANCELLED, MISSED, COMPLETED;

private final String name = null;

public String getName() {
return name;
}

@Override
public String toString() {
return name;
}
}

// TODO confirm that "WALK-IN" should be considered active and "RESCHEDULED" should be scheduled
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.openmrs.module.appointmentscheduling.rest.resource.openmrs1_9;

import org.openmrs.module.appointmentscheduling.Appointment;
import org.openmrs.module.appointmentscheduling.rest.controller.AppointmentRestController;
import org.openmrs.module.webservices.rest.SimpleObject;
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.resource.api.Listable;
import org.openmrs.module.webservices.rest.web.resource.api.Searchable;
import org.openmrs.module.webservices.rest.web.response.ResponseException;

@Resource(name = RestConstants.VERSION_1 + AppointmentRestController.APPOINTMENT_SCHEDULING_REST_NAMESPACE
+ "/appointmentstatustype", supportedClass = AppointmentStatusTypeResource1_9.class, supportedOpenmrsVersions = "1.9.*")
public class AppointmentStatusTypeResource1_9 implements Listable, Searchable {

@Override
public SimpleObject getAll(RequestContext requestContext) throws ResponseException {
Appointment.AppointmentStatusType[] appointmentStatusType = Appointment.AppointmentStatusType.values();
SimpleObject simpleObject = new SimpleObject().add("results", appointmentStatusType);
return simpleObject;
}

@Override
public String getUri(Object o) {
return RestConstants.URI_PREFIX + "/appointmentscheduling/appointmentstatustype/"
+ ((Appointment.AppointmentStatusType) o).getName();
}

@Override
public SimpleObject search(RequestContext requestContext) throws ResponseException {
return null;
}
}

0 comments on commit d0cb8d5

Please sign in to comment.