Skip to content

Commit

Permalink
HUM-1173, serialize appointment status type
Browse files Browse the repository at this point in the history
  • Loading branch information
cioan committed Apr 4, 2014
1 parent 2ae3c2c commit 15dc5ca
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ 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
}

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

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;

import static org.openmrs.module.appointmentscheduling.Appointment.AppointmentStatusType;

@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 {
AppointmentStatusType[] appointmentStatusType = AppointmentStatusType
.values();
SimpleObject simpleObject = new SimpleObject().add("results",
appointmentStatusType);
return simpleObject;
}

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

@Override
public SimpleObject search(RequestContext requestContext)
throws ResponseException {
return null;
}
}
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);
}

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

0 comments on commit 15dc5ca

Please sign in to comment.