diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/CareSettingResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/CareSettingResource1_10.java index 7aa1da2c0..8bb2a4ce8 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/CareSettingResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/CareSettingResource1_10.java @@ -13,11 +13,8 @@ import java.util.List; import java.util.regex.Pattern; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; import org.openmrs.CareSetting; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; 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; @@ -69,17 +66,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation public DelegatingResourceDescription getCreatableProperties() { throw new ResourceDoesNotSupportOperationException(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("careSettingType", new EnumProperty(CareSetting.CareSettingType.class)); - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugReferenceMapResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugReferenceMapResource1_10.java index b40c3fab0..d2c27ac32 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugReferenceMapResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugReferenceMapResource1_10.java @@ -24,11 +24,6 @@ import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException; import org.openmrs.module.webservices.rest.web.response.ResponseException; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -117,27 +112,5 @@ public DelegatingResourceDescription getCreatableProperties() { description.addProperty("drug"); return description; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - modelImpl.property("display", new StringProperty()).property("uuid", new StringProperty()) - .property("drug", new RefProperty("#/definitions/DrugGetRef")) - .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGetRef")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl.property("display", new StringProperty()).property("uuid", new StringProperty()) - .property("auditInfo", new StringProperty()).property("drug", new RefProperty("#/definitions/DrugGet")) - .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGet")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl().property("conceptReferenceTerm", new StringProperty().example("uuid")) - .property("conceptMapType", new StringProperty().example("uuid")) - .property("drug", new StringProperty().example("uuid")); - } + } diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugResource1_10.java index 820e8298e..b0ad0851b 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/DrugResource1_10.java @@ -18,10 +18,6 @@ import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.DrugResource1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; - /** * {@link org.openmrs.module.webservices.rest.web.annotation.Resource} for {@link org.openmrs.Drug}, * supporting standard CRUD operations @@ -59,22 +55,5 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("drugReferenceMaps", new RefProperty("#/definitions/DrugreferencemapGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("drugReferenceMaps", new RefProperty("#/definitions/DrugreferencemapGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("drugReferenceMaps", new RefProperty("#/definitions/DrugreferencemapCreate")); - } + } diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderResource1_10.java index 98b8c0f76..ecfa2ca76 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderResource1_10.java @@ -9,18 +9,12 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.CareSetting; import org.openmrs.Order; import org.openmrs.OrderType; import org.openmrs.Patient; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.ConversionUtil; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -31,7 +25,6 @@ import org.openmrs.module.webservices.rest.web.representation.Representation; import org.openmrs.module.webservices.rest.web.resource.api.PageableResult; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; -import org.openmrs.module.webservices.rest.web.resource.impl.EmptySearchResult; import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging; import org.openmrs.module.webservices.rest.web.response.InvalidSearchException; import org.openmrs.module.webservices.rest.web.response.ObjectNotFoundException; @@ -114,45 +107,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation return null; } } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("encounter", new StringProperty().example("uuid")) - .property("orderType", new StringProperty().example("uuid")) - .property("action", new EnumProperty(Order.Action.class)) - .property("accessionNumber", new StringProperty()) - .property("dateActivated", new DateProperty()) - .property("scheduledDate", new DateProperty()) - .property("patient", new StringProperty().example("uuid")) - .property("concept", new StringProperty().example("uuid")) - .property("careSetting", new StringProperty().example("uuid")) - .property("dateStopped", new DateProperty()) - .property("autoExpireDate", new DateProperty()) - .property("orderer", new StringProperty().example("uuid")) - .property("previousOrder", new StringProperty().example("uuid")) - .property("urgency", new EnumProperty(Order.Urgency.class)) - .property("orderReason", new StringProperty().example("uuid")) - .property("orderReasonNonCoded", new StringProperty()) - .property("instructions", new StringProperty()) - .property("commentToFulfiller", new StringProperty()) - - .required("orderType").required("patient").required("concept"); - if (rep instanceof FullRepresentation) { - model - .property("encounter", new RefProperty("#/definitions/EncounterCreate")) - .property("patient", new RefProperty("#/definitions/PatientCreate")) - .property("concept", new RefProperty("#/definitions/ConceptCreate")) - .property("orderer", new RefProperty("#/definitions/UserCreate")) - .property("previousOrder", new RefProperty("#/definitions/OrderCreate")) - .property("orderReason", new RefProperty("#/definitions/ConceptCreate")) - .property("orderReasonNonCoded", new StringProperty()) - .property("instructions", new StringProperty()) - .property("commentToFulfiller", new StringProperty()); - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderTypeResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderTypeResource1_10.java index e0eb1037e..4de8e4c48 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderTypeResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderTypeResource1_10.java @@ -13,11 +13,6 @@ import java.util.List; import java.util.regex.Pattern; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.OrderType; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -151,33 +146,5 @@ public DelegatingResourceDescription getCreatableProperties() { d.addProperty("conceptClasses"); return d; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("javaClassName", new StringProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("conceptClasses", new ArrayProperty(new RefProperty("#/definitions/ConceptclassGetRef"))) - .property("parent", new RefProperty("#/definitions/OrdertypeGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("conceptClasses", new ArrayProperty(new RefProperty("#/definitions/ConceptclassGet"))) - .property("parent", new RefProperty("#/definitions/OrdertypeGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("javaClassName", new StringProperty()) - .property("parent", new StringProperty().example("uuid")) //FIXME type - .property("conceptClasses", new ArrayProperty(new StringProperty().example("uuid"))) - - .required("javaClassName"); - } + } diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/PersonResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/PersonResource1_10.java index e605ecdf1..9bb41950b 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/PersonResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/PersonResource1_10.java @@ -59,21 +59,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe description.addProperty("birthtime"); return description; } - @Override - public Model getGETModel(Representation rep) { - return addNewProperties(super.getGETModel(rep), rep); - } - - @Override - public Model getCREATEModel(Representation rep) { - return addNewProperties(super.getCREATEModel(rep), rep); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return addNewProperties(super.getUPDATEModel(rep), rep); - } - + private Model addNewProperties(Model model, Representation rep) { return model; diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramEnrollmentResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramEnrollmentResource1_10.java index 3fad6b60f..201059bdf 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramEnrollmentResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramEnrollmentResource1_10.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; import org.openmrs.PatientProgram; import org.openmrs.PatientState; import org.openmrs.api.context.Context; @@ -98,28 +92,7 @@ public DelegatingResourceDescription getCreatableProperties() { d.addProperty("voided"); return d; } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("states", new ArrayProperty(new RefProperty("#/definitions/ProgramenrollmentStateCreate"))) - .property("outcome", new RefProperty("#/definitions/ConceptCreate")); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() //FIXME use super. - .property("dateEnrolled", new DateProperty()) - .property("states", new ArrayProperty(new RefProperty("#/definitions/ProgramenrollmentStateCreate"))) - .property("outcome", new RefProperty("#/definitions/ConceptCreate")) - .property("location", new RefProperty("#/definitions/LocationCreate")) - .property("voided", new BooleanProperty()) - .property("dateCompleted", new DateProperty()) - - .required("dateEnrolled"); - - } - + @Override public DelegatingResourceDescription getUpdatableProperties() { DelegatingResourceDescription d = new DelegatingResourceDescription(); diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramResource1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramResource1_10.java index 123d687bc..d00788929 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramResource1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/ProgramResource1_10.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_10; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Program; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.annotation.Resource; @@ -63,18 +59,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getCREATEModel(rep)) - .property("outcomesConcept", new StringProperty().example("uuid")); - if (rep instanceof FullRepresentation) { - model - .property("outcomesConcept", new RefProperty("#/definitions/ConceptCreate")); - } - return model; - } - + @Override public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = new DelegatingResourceDescription(); diff --git a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/TestOrderSubclassHandler1_10.java b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/TestOrderSubclassHandler1_10.java index a42d475fb..d52a54ea5 100644 --- a/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/TestOrderSubclassHandler1_10.java +++ b/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/TestOrderSubclassHandler1_10.java @@ -19,7 +19,6 @@ import org.openmrs.TestOrder; import org.openmrs.api.OrderService; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.ConversionUtil; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter; @@ -35,12 +34,6 @@ import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging; import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - /** * Exposes the {@link org.openmrs.TestOrder} subclass as a type in * {@link org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.OrderResource1_8} @@ -128,49 +121,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe //this actually throws a ResourceDoesNotSupportOperationException return orderResource.getUpdatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - OrderResource1_10 orderResource = (OrderResource1_10) Context.getService(RestService.class) - .getResourceBySupportedClass(Order.class); - ModelImpl orderModel = (ModelImpl) orderResource.getGETModel(rep); - orderModel - .property("laterality", new EnumProperty(TestOrder.Laterality.class)) - .property("clinicalHistory", new StringProperty()) - .property("numberOfRepeats", new IntegerProperty()); - - if (rep instanceof DefaultRepresentation) { - orderModel - .property("specimenSource", new RefProperty("#/definitions/ConceptGetRef")) - .property("frequency", new RefProperty("#/definitions/OrderfrequencyGetRef")); - } else if (rep instanceof FullRepresentation) { - orderModel - .property("specimenSource", new RefProperty("#/definitions/ConceptGet")) - .property("frequency", new RefProperty("#/definitions/OrderfrequencyGet")); - } - return orderModel; - } - - @Override - public Model getCREATEModel(Representation rep) { - OrderResource1_10 orderResource = (OrderResource1_10) Context.getService(RestService.class) - .getResourceBySupportedClass(Order.class); - ModelImpl orderModel = (ModelImpl) orderResource.getCREATEModel(rep); - return orderModel - .property("specimenSource", new StringProperty().example("uuid")) - .property("laterality", new EnumProperty(TestOrder.Laterality.class)) - .property("clinicalHistory", new StringProperty()) - .property("frequency", new StringProperty().example("uuid")) - .property("numberOfRepeats", new IntegerProperty()); - } - - @Override - public Model getUPDATEModel(Representation rep) { - OrderResource1_10 orderResource = (OrderResource1_10) Context.getService(RestService.class) - .getResourceBySupportedClass(Order.class); - return orderResource.getUPDATEModel(rep); - } - + public PageableResult getActiveOrders(Patient patient, RequestContext context) { String careSettingUuid = context.getRequest().getParameter("careSetting"); String asOfDateString = context.getRequest().getParameter("asOfDate"); diff --git a/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/DrugIngredientResource1_11.java b/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/DrugIngredientResource1_11.java index 15dbb8976..9c25e03db 100644 --- a/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/DrugIngredientResource1_11.java +++ b/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/DrugIngredientResource1_11.java @@ -12,11 +12,6 @@ import java.util.ArrayList; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DoubleProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Drug; import org.openmrs.DrugIngredient; import org.openmrs.api.context.Context; @@ -84,43 +79,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("strength", new DoubleProperty()); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("ingredient", new RefProperty("#/definitions/ConceptGetRef")) - .property("units", new RefProperty("#/definitions/ConceptGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("ingredient", new RefProperty("#/definitions/ConceptGet")) - .property("units", new RefProperty("#/definitions/ConceptGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("ingredient", new StringProperty().example("uuid")) - .property("strength", new DoubleProperty()) - .property("units", new StringProperty().example("uuid")) - - .required("ingredient"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingSubResource#getParent(java.lang.Object) */ diff --git a/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/ObsResource1_11.java b/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/ObsResource1_11.java index 14626f497..a49f50038 100644 --- a/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/ObsResource1_11.java +++ b/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/ObsResource1_11.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_11; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.BooleanUtils; import org.openmrs.Concept; import org.openmrs.ConceptNumeric; @@ -41,21 +38,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return description; } - - @Override - public Model getGETModel(Representation rep) { - return ((ModelImpl) super.getGETModel(rep)) - .property("formFieldPath", new StringProperty()) - .property("formFieldNamespace", new StringProperty()); - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("formFieldPath", new StringProperty()) - .property("formFieldNamespace", new StringProperty()); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/PersonResource1_11.java b/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/PersonResource1_11.java index 5a272b267..6c4474719 100644 --- a/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/PersonResource1_11.java +++ b/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_11/PersonResource1_11.java @@ -62,22 +62,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe description.addProperty("deathdateEstimated"); return description; } - - @Override - public Model getGETModel(Representation rep) { - return addNewProperties(super.getGETModel(rep), rep); - } - - @Override - public Model getCREATEModel(Representation rep) { - return addNewProperties(super.getCREATEModel(rep), rep); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return addNewProperties(super.getUPDATEModel(rep), rep); - } - + private Model addNewProperties(Model model, Representation rep) { if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { ((ModelImpl) model) diff --git a/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderGroupResource1_12.java b/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderGroupResource1_12.java index e54ac146d..866435e2f 100644 --- a/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderGroupResource1_12.java +++ b/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderGroupResource1_12.java @@ -27,13 +27,6 @@ import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException; import org.openmrs.module.webservices.rest.web.response.ResponseException; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - @Resource(name = RestConstants.VERSION_1 + "/ordergroup", supportedClass = OrderGroup.class, supportedOpenmrsVersions = { "1.12.* - 9.*" }) public class OrderGroupResource1_12 extends DataDelegatingCrudResource { @@ -127,46 +120,7 @@ public DelegatingResourceDescription getUpdatableProperties() { description.addProperty("orders"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - modelImpl.property("uuid", new StringProperty()).property("display", new StringProperty()) - .property("voided", new BooleanProperty()) - .property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("encounter", new RefProperty("#/definitions/EncounterGetRef")) - .property("orders", new RefProperty("#/definitions/OrderGetRef")) - .property("orderSet", new RefProperty("#/definitions/OrdersetGetRef")); - - } else if (rep instanceof FullRepresentation) { - modelImpl.property("uuid", new StringProperty()).property("display", new StringProperty()) - .property("voided", new BooleanProperty()).property("auditInfo", new BooleanProperty()) - .property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("encounter", new RefProperty("#/definitions/EncounterGetRef")) - .property("orders", new ArrayProperty(new RefProperty("#/definitions/OrderGetRef"))) - .property("orderSet", new RefProperty("#/definitions/OrdersetGetRef")); - } else if (rep instanceof RefRepresentation) { - modelImpl.property("display", new StringProperty()).property("uuid", new StringProperty()); - - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation representation) { - return new ModelImpl().property("patient", new StringProperty().example("uuid")) - .property("encounter", new StringProperty().example("uuid")) - .property("orders", new ArrayProperty(new RefProperty("#/definitions/OrderCreate"))) - .property("orderSet", new StringProperty().example("uuid")); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl().property("orders", - new ArrayProperty(new RefProperty("#/definitions/OrderCreate"))); - } - + @PropertyGetter("display") public String getDisplayString(OrderGroup group) { if (group.getOrders() == null) diff --git a/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetMemberResource1_12.java b/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetMemberResource1_12.java index 9ae07a777..93f2478ac 100644 --- a/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetMemberResource1_12.java +++ b/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetMemberResource1_12.java @@ -30,13 +30,6 @@ import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging; import org.openmrs.module.webservices.rest.web.response.ResponseException; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - /** * {@link Resource} for OrderSetMembers, supporting standard CRUD operations */ @@ -103,45 +96,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("retired", new BooleanProperty()) - .property("orderTemplate", new StringProperty()) - .property("orderTemplateType", new StringProperty()); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("orderType", new RefProperty("#/definitions/OrdertypeGetRef")) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("orderType", new RefProperty("#/definitions/OrdertypeGet")) - .property("concept", new RefProperty("#/definitions/ConceptGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("orderType", new ObjectProperty() - .property("uuid", new StringProperty())) - .property("orderTemplate", new StringProperty()) - .property("concept", new StringProperty().example("uuid")) - .property("retired", new BooleanProperty()); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + @Override public OrderSetMember getByUniqueId(String uniqueId) { return Context.getOrderSetService().getOrderSetMemberByUuid(uniqueId); diff --git a/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetResource1_12.java b/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetResource1_12.java index 41176c265..e2e353985 100644 --- a/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetResource1_12.java +++ b/omod-1.12/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_12/OrderSetResource1_12.java @@ -9,16 +9,11 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_12; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.RefProperty; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.openmrs.OrderSet; import org.openmrs.OrderSetMember; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.annotation.PropertySetter; @@ -107,31 +102,5 @@ public DelegatingResourceDescription getCreatableProperties() { d.addProperty("orderSetMembers"); return d; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("operator", new EnumProperty(OrderSet.Operator.class)); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("orderSetMembers", new ArrayProperty(new RefProperty( - "#/definitions/OrdersetOrdersetmemberGetRef"))); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("orderSetMembers", new ArrayProperty( - new RefProperty("#/definitions/OrdersetOrdersetmemberGet"))); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation representation) { - return new ModelImpl() - .property("operator", new EnumProperty(OrderSet.Operator.class)) - .property("orderSetMembers", - new ArrayProperty(new RefProperty("#/definitions/OrdersetOrdersetmemberCreate"))); - } + } diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/AllergyResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/AllergyResource1_8.java index 9892c90e4..1c42ee6cc 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/AllergyResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/AllergyResource1_8.java @@ -9,17 +9,9 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Patient; import org.openmrs.activelist.Allergy; -import org.openmrs.activelist.AllergySeverity; -import org.openmrs.activelist.AllergyType; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; 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; @@ -62,32 +54,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)) - .property("allergyType", new EnumProperty(AllergyType.class)) - .property("reaction", new RefProperty("#/definitions/ConceptGetRef")) - .property("severity", new EnumProperty(AllergySeverity.class)) - .property("allergen", new RefProperty("#/definitions/ConceptGetRef")); - if (rep instanceof FullRepresentation) { - model - .property("reaction", new RefProperty("#/definitions/ConceptGet")) - .property("allergen", new RefProperty("#/definitions/ConceptGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("allergyType", new EnumProperty(AllergyType.class)) - .property("reaction", new ObjectProperty() - .property("uuid", new StringProperty())) - .property("severity", new EnumProperty(AllergySeverity.class)) - .property("allergen", new StringProperty()); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#newDelegate() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/BaseActiveListItemResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/BaseActiveListItemResource1_8.java index 9ef1b74c0..56347071a 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/BaseActiveListItemResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/BaseActiveListItemResource1_8.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.activelist.ActiveListItem; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -31,26 +25,7 @@ * {@link ActiveListItem} */ public abstract class BaseActiveListItemResource1_8 extends DataDelegatingCrudResource { - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("person", new StringProperty()) - .property("startDate", new DateProperty()) - .property("comments", new StringProperty()) - .property("startObs", new StringProperty()) - .property("stopObs", new StringProperty()) - - .required("person").required("startDate"); - if (rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonCreate")) - .property("startObs", new RefProperty("#/definitions/ObsCreate")) - .property("stopObs", new RefProperty("#/definitions/ObsCreate")); - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ @@ -89,31 +64,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()) - .property("comments", new StringProperty()) - .property("voided", new BooleanProperty()); - if (rep instanceof DefaultRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGet")) - .property("activeListType", new StringProperty()) //FIXME type - .property("startObs", new RefProperty("#/definitions/ObsGet")) - .property("stopObs", new RefProperty("#/definitions/ObsGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGetRef")) - .property("activeListType", new StringProperty()) //FIXME type - .property("startObs", new RefProperty("#/definitions/ObsGetRef")) - .property("stopObs", new RefProperty("#/definitions/ObsGetRef")); - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortMemberResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortMemberResource1_8.java index e062d1db3..7c904942e 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortMemberResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortMemberResource1_8.java @@ -12,10 +12,6 @@ import java.util.ArrayList; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Cohort; import org.openmrs.Patient; import org.openmrs.api.context.Context; @@ -118,41 +114,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof RefRepresentation) { - modelImpl - .property("display", new StringProperty()); - } else if (rep instanceof DefaultRepresentation) { - modelImpl - .property("display", new StringProperty()) - .property("patient", new RefProperty("#/definitions/PatientGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("display", new StringProperty()) - .property("patient", new RefProperty("#/definitions/PatientGetRef")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("patient", new StringProperty().example("uuid")) - .required("patient"); - if (rep instanceof FullRepresentation) { - model - .property("patient", new RefProperty("#/definitions/PatientCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortResource1_8.java index ff12bc660..aeb9ac596 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/CohortResource1_8.java @@ -11,11 +11,6 @@ import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Cohort; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -90,38 +85,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("voided", new StringProperty()) - .property("memberIds", new ArrayProperty(new IntegerProperty())); //FIXME - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("memberIds", new ArrayProperty(new IntegerProperty())) //FIXME - .required("name").required("description").required("memberIds"); - } - - @Override - public Model getUPDATEModel(Representation representation) { - return new ModelImpl() - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .required("name").required("description"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptClassResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptClassResource1_8.java index e4a8e25a0..663ecee43 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptClassResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptClassResource1_8.java @@ -9,13 +9,11 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; import org.openmrs.ConceptClass; import org.openmrs.api.context.Context; 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.representation.Representation; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource; import org.openmrs.module.webservices.rest.web.resource.impl.MetadataDelegatingCrudResource; import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging; @@ -66,13 +64,8 @@ public void purge(ConceptClass conceptClass, RequestContext context) throws Resp return; Context.getConceptService().purgeConceptClass(conceptClass); } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - - /** + + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doGetAll(org.openmrs.module.webservices.rest.web.RequestContext) */ @Override diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDatatypeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDatatypeResource1_8.java index 0de73cceb..714b398a8 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDatatypeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDatatypeResource1_8.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.ConceptDatatype; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.SimpleObject; @@ -66,21 +62,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("hl7Abbreviation", new StringProperty()) - .property("retired", new BooleanProperty()); - } - return model; - } - + /** * @see DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDescriptionResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDescriptionResource1_8.java index d5465bd38..0c181efb1 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDescriptionResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptDescriptionResource1_8.java @@ -12,9 +12,6 @@ import java.util.ArrayList; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.openmrs.Concept; import org.openmrs.ConceptDescription; import org.openmrs.api.context.Context; @@ -66,37 +63,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof RefRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - } else if (rep instanceof DefaultRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("description", new StringProperty()) - .property("locale", new StringProperty()); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("description", new StringProperty()) - .property("locale", new StringProperty()); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation representation) { - return new ModelImpl() - .property("description", new StringProperty()) - .property("locale", new StringProperty().example("fr")) - .required("description").required("locale"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptMapResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptMapResource1_8.java index 798d54364..4ec66f612 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptMapResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptMapResource1_8.java @@ -12,9 +12,6 @@ import java.util.ArrayList; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.openmrs.Concept; import org.openmrs.ConceptMap; import org.openmrs.api.context.Context; @@ -64,34 +61,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("display", new StringProperty()) - .property("uuid", new StringProperty()) - .property("source", new StringProperty()) //FIXME - .property("sourceCode", new StringProperty()); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("display", new StringProperty()) - .property("uuid", new StringProperty()) - .property("source", new StringProperty()) //FIXME - .property("sourceCode", new StringProperty()) - .property("comment", new StringProperty()); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation representation) { - return new ModelImpl() - .property("source", new StringProperty()) - .property("sourceCode", new StringProperty()) - .required("source").required("sourceCode"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptNameResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptNameResource1_8.java index 8088f9f54..781b934aa 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptNameResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptNameResource1_8.java @@ -13,15 +13,9 @@ import java.util.Date; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Concept; import org.openmrs.ConceptName; -import org.openmrs.api.ConceptNameType; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; 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; @@ -69,38 +63,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("name", new StringProperty()) - .property("locale", new StringProperty().example("en")) - .property("localePreferred", new BooleanProperty()) - .property("conceptNameType", new EnumProperty(ConceptNameType.class)); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("name", new StringProperty()) - .property("locale", new StringProperty().example("en")) - .property("localePreferred", new BooleanProperty()._default(false)) - .property("conceptNameType", new EnumProperty(ConceptNameType.class)) - .required("name").required("locale"); - } - - @Override - public Model getUPDATEModel(Representation representation) { - return new ModelImpl() - .property("name", new StringProperty()); //FIXME missing props - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptResource1_8.java index 9c2042dc9..6b13abb6b 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptResource1_8.java @@ -9,13 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.Concept; import org.openmrs.ConceptAnswer; @@ -215,73 +208,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("name", new RefProperty("#/definitions/ConceptNameGet")) - .property("datatype", new RefProperty("#/definitions/ConceptdatatypeGetRef")) - .property("conceptClass", new RefProperty("#/definitions/ConceptclassGetRef")) - .property("set", new BooleanProperty()) - .property("version", new StringProperty()) - .property("retired", new BooleanProperty()) - .property("names", new ArrayProperty(new RefProperty("#/definitions/ConceptNameGetRef"))) //FIXME - .property("descriptions", new ArrayProperty(new RefProperty("#/definitions/ConceptDescriptionGetRef"))) //FIXME - .property("mappings", new ArrayProperty(new RefProperty("#/definitions/ConceptMappingGetRef"))) //FIXME - .property("answers", new ArrayProperty(new ObjectProperty())) //FIXME - .property("setMembers", new ArrayProperty(new ObjectProperty())); //FIXME - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("names", new ArrayProperty(new RefProperty("#/definitions/ConceptNameCreate"))) - .property("datatype", new StringProperty().example("uuid")) - .property("set", new BooleanProperty()) - .property("version", new StringProperty()) - .property("answers", new ArrayProperty(new StringProperty().example("uuid"))) - .property("setMembers", new ArrayProperty(new StringProperty().example("uuid"))) - - //ConceptNumeric properties - .property("hiNormal", new StringProperty()) - .property("hiAbsolute", new StringProperty()) - .property("hiCritical", new StringProperty()) - .property("lowNormal", new StringProperty()) - .property("lowAbsolute", new StringProperty()) - .property("lowCritical", new StringProperty()) - .property("units", new StringProperty()) - .property("allowDecimal", new StringProperty()) - .property("displayPrecision", new StringProperty()) - - .required("names").required("datatype").required("conceptClass"); - if (rep instanceof DefaultRepresentation) { - model - .property("conceptClass", new StringProperty()) - .property("descriptions", new ArrayProperty(new StringProperty())) - .property("mappings", new ArrayProperty(new StringProperty())); - } - else if (rep instanceof FullRepresentation) { - model - .property("conceptClass", new RefProperty("#/definitions/ConceptclassCreate")) - .property("descriptions", new ArrayProperty(new RefProperty("#/definitions/ConceptDescriptionCreate"))) - .property("mappings", new ArrayProperty(new RefProperty("#/definitions/ConceptMappingCreate"))); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation representation) { - return new ModelImpl() - .property("name", new RefProperty("#/definitions/ConceptNameCreate")) - .property("names", new ArrayProperty(new RefProperty("#/definitions/ConceptNameCreate"))) - .property("descriptions", new ArrayProperty(new RefProperty("#/definitions/ConceptDescriptionCreate"))); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptSourceResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptSourceResource1_8.java index 58bf17ce0..9febf0f4d 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptSourceResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ConceptSourceResource1_8.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.ConceptSource; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -69,26 +65,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - return ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("hl7Code", new StringProperty()) - .property("retired", new BooleanProperty()); - } - - @Override - public Model getCREATEModel(Representation representation) { - return new ModelImpl() - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("hl7Code", new StringProperty()) - .required("name").required("description"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugOrderSubclassHandler1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugOrderSubclassHandler1_8.java index f1d82939d..32dcea911 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugOrderSubclassHandler1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugOrderSubclassHandler1_8.java @@ -11,13 +11,6 @@ import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DoubleProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.DrugOrder; import org.openmrs.Order; import org.openmrs.Patient; @@ -135,50 +128,7 @@ public DelegatingResourceDescription getCreatableProperties() { d.removeProperty("orderType"); return d; } - - @Override - public Model getGETModel(Representation rep) { - OrderResource1_8 orderResource = (OrderResource1_8) Context.getService(RestService.class) - .getResourceBySupportedClass(Order.class); - ModelImpl orderModel = (ModelImpl) orderResource.getGETModel(rep); - orderModel - .property("dose", new DoubleProperty()) - .property("units", new StringProperty()) - .property("frequency", new StringProperty()) - .property("prn", new BooleanProperty()) - .property("complex", new BooleanProperty()) - .property("quantity", new IntegerProperty()); - - if (rep instanceof DefaultRepresentation) { - orderModel - .property("drug", new RefProperty("#/definitions/DrugGetRef")); - } else if (rep instanceof FullRepresentation) { - orderModel - .property("drug", new RefProperty("#/definitions/DrugGet")); - } - return orderModel; - } - - @Override - public Model getCREATEModel(Representation rep) { - OrderResource1_8 orderResource = (OrderResource1_8) Context.getService(RestService.class) - .getResourceBySupportedClass(Order.class); - ModelImpl orderModel = (ModelImpl) orderResource.getCREATEModel(rep); - orderModel - .property("dose", new DoubleProperty()) - .property("units", new StringProperty()) - .property("frequency", new StringProperty()) - .property("prn", new BooleanProperty()) - .property("complex", new BooleanProperty()) - .property("quantity", new IntegerProperty()) - .property("drug", new RefProperty("#/definitions/DrugCreate")); - - // DrugOrders have a specific hardcoded value for this property - orderModel.getProperties().remove("orderType"); - - return orderModel; - } - + /** * Handles getOrdersByPatient for {@link OrderResource1_8} when type=drugorder * diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugResource1_8.java index f34e6df7f..bd8c97b7b 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/DrugResource1_8.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DoubleProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Drug; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -118,58 +112,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation //Let the superclass handle this return null; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("doseStrength", new DoubleProperty()) - .property("maximumDailyDose", new DoubleProperty()) - .property("minimumDailyDose", new DoubleProperty()) - .property("units", new StringProperty()) - .property("combination", new BooleanProperty()._default(false)); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("dosageForm", new RefProperty("#/definitions/ConceptGetRef")) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("route", new RefProperty("#/definitions/ConceptGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("dosageForm", new RefProperty("#/definitions/ConceptGet")) - .property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("route", new RefProperty("#/definitions/ConceptGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getCREATEModel(rep)) - .property("combination", new BooleanProperty()._default(false)) - .property("concept", new StringProperty()) - .property("doseStrength", new DoubleProperty()) - .property("maximumDailyDose", new DoubleProperty()) - .property("minimumDailyDose", new DoubleProperty()) - .property("units", new StringProperty()) - .property("dosageForm", new StringProperty()) - .property("route", new StringProperty()) - - .required("combination").required("concept"); - if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptCreate")) - .property("dosageForm", new RefProperty("#/definitions/ConceptCreate")) - .property("route", new RefProperty("#/definitions/ConceptCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); //FIXME no updatableProperties() - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.MetadataDelegatingCrudResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterResource1_8.java index d28dcce52..fcb737aa5 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterResource1_8.java @@ -9,13 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Encounter; import org.openmrs.Obs; import org.openmrs.Order; @@ -90,57 +83,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("encounterDatetime", new DateProperty()) - .property("provider", new StringProperty()) //FIXME - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("patient", new RefProperty("#/definitions/PatientGetRef")) //FIXME - .property("location", new RefProperty("#/definitions/LocationGetRef")) //FIXME - .property("form", new RefProperty("#/definitions/FormGetRef")) //FIXME - .property("encounterType", new RefProperty("#/definitions/EncountertypeGetRef")) //FIXME - .property("obs", new ArrayProperty(new RefProperty("#/definitions/ObsGetRef"))) //FIXME - .property("orders", new ArrayProperty(new RefProperty("#/definitions/OrderGetRef"))); //FIXME - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("patient", new RefProperty("#/definitions/PatientGet")) //FIXME - .property("location", new RefProperty("#/definitions/LocationGet")) //FIXME - .property("form", new RefProperty("#/definitions/FormGet")) //FIXME - .property("encounterType", new RefProperty("#/definitions/EncountertypeGet")) //FIXME - .property("obs", new ArrayProperty(new RefProperty("#/definitions/ObsGet"))) //FIXME - .property("orders", new ArrayProperty(new RefProperty("#/definitions/OrderGet"))); //FIXME - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("patient", new RefProperty("#/definitions/PatientCreate")) - .property("encounterType", new RefProperty("#/definitions/EncountertypeCreate")) - .property("encounterDatetime", new DateProperty()) - .property("location", new RefProperty("#/definitions/LocationCreate")) - .property("form", new RefProperty("#/definitions/FormCreate")) - .property("provider", new StringProperty()) - .property("orders", new ArrayProperty(new RefProperty("#/definitions/OrderCreate"))) - .property("obs", new ArrayProperty(new RefProperty("#/definitions/ObsCreate"))) - - .required("patient").required("encounterType"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() * Should create an encounter type diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterTypeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterTypeResource1_8.java index 952889804..6620530f5 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterTypeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/EncounterTypeResource1_8.java @@ -9,14 +9,11 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; import org.openmrs.EncounterType; import org.openmrs.api.context.Context; 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.representation.Representation; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; import org.openmrs.module.webservices.rest.web.resource.impl.MetadataDelegatingCrudResource; @@ -42,13 +39,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .required("description"); - } - + /** * @see DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldAnswerResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldAnswerResource1_8.java index 61e70b452..ac69f2c33 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldAnswerResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldAnswerResource1_8.java @@ -12,10 +12,6 @@ import java.util.ArrayList; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Field; import org.openmrs.FieldAnswer; import org.openmrs.api.context.Context; @@ -79,39 +75,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("field", new RefProperty("#/definitions/FieldGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("field", new RefProperty("#/definitions/FieldGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("concept", new StringProperty().example("uuid")) - .property("field", new StringProperty().example("uuid")) - .required("field").required("concept"); - if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptCreate")) - .property("field", new RefProperty("#/definitions/FieldCreate")); - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.MetadataDelegatingCrudResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldResource1_8.java index 7eb26f5c2..ac39ccbc9 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldResource1_8.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Field; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -35,46 +30,7 @@ */ @Resource(name = RestConstants.VERSION_1 + "/field", supportedClass = Field.class, supportedOpenmrsVersions = { "1.8.* - 9.*" }) public class FieldResource1_8 extends MetadataDelegatingCrudResource { - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("tableName", new StringProperty()) - .property("attributeName", new StringProperty()) - .property("defaultValue", new StringProperty()) - .property("selectMultiple", new BooleanProperty()._default(false)); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("fieldType", new RefProperty("#/definitions/FieldtypeGetRef")) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("fieldType", new RefProperty("#/definitions/FieldtypeGet")) - .property("concept", new RefProperty("#/definitions/ConceptGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("fieldType", new RefProperty("#/definitions/FieldtypeCreate")) - .property("selectMultiple", new BooleanProperty()._default(false)) - .property("concept", new RefProperty("#/definitions/ConceptCreate")) - .property("tableName", new StringProperty()) - .property("attributeName", new StringProperty()) - .property("defaultValue", new StringProperty()) - - .required("fieldType").required("selectMultiple"); - } - - @Override - public Model getUPDATEModel(Representation representation) { - return new ModelImpl(); //FIXME missing props - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldTypeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldTypeResource1_8.java index ba62a0174..0fc710915 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldTypeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FieldTypeResource1_8.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; import org.openmrs.FieldType; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -31,21 +28,7 @@ @Resource(name = RestConstants.VERSION_1 + "/fieldtype", supportedClass = FieldType.class, supportedOpenmrsVersions = { "1.8.* - 9.*" }) public class FieldTypeResource1_8 extends MetadataDelegatingCrudResource { - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("isSet", new BooleanProperty()._default(false)); - } - return modelImpl; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormFieldResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormFieldResource1_8.java index 4b7ddfece..299ea227b 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormFieldResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormFieldResource1_8.java @@ -12,13 +12,6 @@ import java.util.ArrayList; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.FloatProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Form; import org.openmrs.FormField; import org.openmrs.api.context.Context; @@ -41,65 +34,7 @@ @SubResource(parent = FormResource1_8.class, path = "formfield", supportedClass = FormField.class, supportedOpenmrsVersions = { "1.8.* - 9.*" }) public class FormFieldResource1_8 extends DelegatingSubResource { - - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("fieldNumber", new IntegerProperty()) - .property("fieldPart", new StringProperty()) - .property("pageNumber", new IntegerProperty()) - .property("minOccurs", new IntegerProperty()) - .property("maxOccurs", new IntegerProperty()) - .property("required", new BooleanProperty()._default(false)) - .property("sortWeight", new FloatProperty()) - .property("retired", new BooleanProperty()); //FIXME - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("parent", new RefProperty("#/definitions/FormFormfieldGetRef")) - .property("form", new RefProperty("#/definitions/FormGetRef")) - .property("field", new RefProperty("#/definitions/FieldGetRef")); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("parent", new RefProperty("#/definitions/FormFormfieldGet")) - .property("form", new RefProperty("#/definitions/FormGet")) - .property("field", new RefProperty("#/definitions/FieldGet")); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() //FIXME validate if correct - .property("form", new StringProperty().example("uuid")) - .property("field", new StringProperty().example("uuid")) - .property("required", new BooleanProperty()._default(false)) - .property("parent", new StringProperty().example("uuid")) - .property("fieldNumber", new IntegerProperty()) - .property("fieldPart", new StringProperty()) - .property("pageNumber", new IntegerProperty()) - .property("minOccurs", new IntegerProperty()) - .property("maxOccurs", new IntegerProperty()) - .property("sortWeight", new BooleanProperty()._default(false)) - - .required("form").required("field").required("required"); - if (rep instanceof FullRepresentation) { - model - .property("form", new RefProperty("#/definitions/FormCreate")) - .property("field", new RefProperty("#/definitions/FieldCreate")) - .property("parent", new RefProperty("#/definitions/FormFormfieldCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormResource1_8.java index 8f1e9894f..12ef0bcdd 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/FormResource1_8.java @@ -9,17 +9,7 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; -import org.openmrs.EncounterType; -import org.openmrs.Field; import org.openmrs.Form; -import org.openmrs.FormField; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -97,58 +87,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("version", new StringProperty()) - .property("build", new IntegerProperty()) - .property("published", new BooleanProperty()._default(false)) - .property("retired", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("encounterType", new RefProperty("#/definitions/EncountertypeGetRef")) - .property("formFields", new ArrayProperty(new RefProperty("#/definitions/FormFormfieldGetRef"))); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("encounterType", new RefProperty("#/definitions/EncountertypeGet")) - .property("formFields", new ArrayProperty(new RefProperty("#/definitions/FormFormfieldGet"))); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getCREATEModel(rep)) - .property("version", new StringProperty()) - .property("encounterType", new StringProperty()) - .property("build", new IntegerProperty()) - .property("published", new BooleanProperty()._default(false)) - .property("formFields", new ArrayProperty(new StringProperty())) - .property("xslt", new StringProperty()) - .property("template", new StringProperty()) - - .required("version"); - if (rep instanceof FullRepresentation) { - model - .property("encounterType", new RefProperty("#/definitions/EncountertypeCreate")) - .property("formFields", new ArrayProperty(new RefProperty("#/definitions/FormFormfieldCreate"))); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7MessageResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7MessageResource1_8.java index 999810ac9..3dc44b98e 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7MessageResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7MessageResource1_8.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -94,34 +89,7 @@ public DelegatingResourceDescription getCreatableProperties() { description.addRequiredProperty("hl7"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("messageState", new IntegerProperty()); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("source", new RefProperty("#/definitions/Hl7sourceGet")) - .property("sourceKey", new StringProperty()) - .property("data", new StringProperty()) - .property("messageState", new IntegerProperty()); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("hl7", new StringProperty()) //FIXME TYPE - .required("hl7"); - } - + /** * It needs to be overwritten to allow for hidden properties: source, sourceKey and data. They * are automatically extracted from the hl7 property and populated in diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7SourceResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7SourceResource1_8.java index 78eecfd92..b0d252738 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7SourceResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/HL7SourceResource1_8.java @@ -9,8 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; import org.openmrs.api.context.Context; import org.openmrs.hl7.HL7Source; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -56,19 +54,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - - .required("description"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#newDelegate() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationResource1_8.java index 6a9bbb860..5be475d30 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationResource1_8.java @@ -13,11 +13,6 @@ import java.util.Arrays; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.openmrs.Location; @@ -142,66 +137,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("address1", new StringProperty()) - .property("address2", new StringProperty()) - .property("cityVillage", new StringProperty()) - .property("stateProvince", new StringProperty()) - .property("country", new StringProperty()) - .property("postalCode", new StringProperty()) - .property("latitude", new StringProperty()) - .property("longitude", new StringProperty()) - .property("countyDistrict", new StringProperty()) - .property("address3", new StringProperty()) - .property("address4", new StringProperty()) - .property("address5", new StringProperty()) - .property("address6", new StringProperty()); - } - if (rep instanceof DefaultRepresentation) { - modelImpl - .property("tags", new ArrayProperty(new RefProperty("#/definitions/LocationtagGetRef"))) - .property("parentLocation", new RefProperty("#/definitions/LocationGetRef")) - .property("childLocations", new ArrayProperty(new RefProperty("#/definitions/LocationGetRef"))); - } else if (rep instanceof FullRepresentation) { - modelImpl - .property("tags", new ArrayProperty(new RefProperty("#/definitions/LocationtagGet"))) - .property("parentLocation", new RefProperty("#/definitions/LocationGet")) - .property("childLocations", new ArrayProperty(new RefProperty("#/definitions/LocationGet"))); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("address1", new StringProperty()) - .property("address2", new StringProperty()) - .property("cityVillage", new StringProperty()) - .property("stateProvince", new StringProperty()) - .property("country", new StringProperty()) - .property("postalCode", new StringProperty()) - .property("latitude", new StringProperty()) - .property("longitude", new StringProperty()) - .property("countyDistrict", new StringProperty()) - .property("address3", new StringProperty()) - .property("address4", new StringProperty()) - .property("address5", new StringProperty()) - .property("address6", new StringProperty()) - .property("tags", new ArrayProperty(new StringProperty())) - .property("parentLocation", new StringProperty()) - .property("childLocations", new ArrayProperty(new StringProperty())); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationTagResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationTagResource1_8.java index 9199ba24c..db373a386 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationTagResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationTagResource1_8.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.LocationTag; import org.openmrs.api.LocationService; import org.openmrs.api.context.Context; @@ -92,14 +88,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("retired", new BooleanProperty()) - .property("retiredReason", new StringProperty()); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doSearch(org.openmrs.module.webservices.rest.web.RequestContext) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleActionResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleActionResource1_8.java index d67ab5ff4..14b1d9b83 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleActionResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleActionResource1_8.java @@ -9,19 +9,12 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.openmrs.api.APIException; import org.openmrs.module.Module; import org.openmrs.module.ModuleException; import org.openmrs.module.ModuleUtil; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.helper.ModuleAction; import org.openmrs.module.webservices.helper.ModuleFactoryWrapper; import org.openmrs.module.webservices.helper.ModuleAction.Action; @@ -41,7 +34,6 @@ import org.springframework.util.ResourceUtils; import javax.servlet.ServletContext; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; @@ -296,24 +288,7 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe description.addRequiredProperty("action", "action"); return description; } - - @Override - public Model getGETModel(Representation rep) { - return ((ModelImpl) super.getGETModel(rep)) - .property("modules", new ArrayProperty(new RefProperty("#/definitions/ModuleGetRef"))) - .property("action", new EnumProperty(ModuleAction.Action.class)); - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("modules", new ArrayProperty(new StringProperty().example("moduleId"))) - .property("allModules", new BooleanProperty()) - .property("action", new EnumProperty(ModuleAction.Action.class)) - .property("installUri", new StringProperty()) - .required("action"); - } - + /** * Converter does not handle getters starting with 'is' instead of 'get' */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java index e4d5ecc25..20988898f 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ModuleResource1_8.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.io.FileUtils; import org.openmrs.module.Module; import org.openmrs.module.ModuleException; @@ -106,35 +101,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("started", new BooleanProperty()) //FIXME check type - .property("startupErrorMessage", new StringProperty()); //FIXME add-link: action - } - if (rep instanceof FullRepresentation) { - model - .property("packageName", new StringProperty()) - .property("author", new StringProperty()) - .property("version", new StringProperty()) - .property("requireOpenmrsVersion", new StringProperty()) - .property("awareOfModules", new ArrayProperty(new StringProperty())) //FIXME check type - .property("requiredModules", new ArrayProperty(new StringProperty())); - } else if (rep instanceof RefRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingReadableResource#doGetAll(RequestContext) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ObsResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ObsResource1_8.java index 9e4970296..d015a6ca5 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ObsResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ObsResource1_8.java @@ -57,15 +57,6 @@ import org.openmrs.obs.ComplexData; import org.springframework.web.multipart.MultipartFile; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.DateTimeProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - /** * {@link Resource} for Obs, supporting standard CRUD operations */ @@ -181,57 +172,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model.property("uuid", new StringProperty()).property("display", new StringProperty()) - .property("obsDatetime", new DateProperty()).property("accessionNumber", new StringProperty()) - .property("comment", new StringProperty()).property("voided", new BooleanProperty()) - .property("value", new StringProperty()).property("valueModifier", new StringProperty()); - } - if (rep instanceof DefaultRepresentation) { - model.property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("person", new RefProperty("#/definitions/PersonGetRef")) - .property("obsGroup", new RefProperty("#/definitions/ObsGetRef")) - .property("groupMembers", new ArrayProperty(new RefProperty("#/definitions/ObsGetRef"))) - .property("valueCodedName", new RefProperty("#/definitions/ConceptNameGetRef")) - .property("location", new RefProperty("#/definitions/LocationGetRef")) - .property("order", new RefProperty("#/definitions/OrderGetRef")) - .property("encounter", new RefProperty("#/definitions/EncounterGetRef")); - } else if (rep instanceof FullRepresentation) { - model.property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("person", new RefProperty("#/definitions/PersonGet")) - .property("obsGroup", new RefProperty("#/definitions/ObsGet")) - .property("groupMembers", new ArrayProperty(new RefProperty("#/definitions/ObsGet"))) - .property("valueCodedName", new RefProperty("#/definitions/ConceptNameGet")) - .property("location", new RefProperty("#/definitions/LocationGet")) - .property("order", new RefProperty("#/definitions/OrderGet")) - .property("encounter", new RefProperty("#/definitions/EncounterGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl().property("person", new StringProperty().example("uuid")) - .property("obsDatetime", new DateTimeProperty()).property("concept", new StringProperty().example("uuid")) - .property("location", new StringProperty()).property("order", new StringProperty()) - .property("encounter", new StringProperty()).property("accessionNumber", new StringProperty()) - .property("groupMembers", new ArrayProperty(new StringProperty())) - .property("valueCodedName", new StringProperty()).property("comment", new StringProperty()) - .property("voided", new BooleanProperty()).property("value", new StringProperty()) - .property("valueModifier", new StringProperty()) - - .required("person").required("obsDatetime").required("concept"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#newDelegate() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/OrderResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/OrderResource1_8.java index e087cb560..d2ee25c18 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/OrderResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/OrderResource1_8.java @@ -11,12 +11,6 @@ import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Order; import org.openmrs.Patient; import org.openmrs.api.OrderService.ORDER_STATUS; @@ -208,81 +202,7 @@ public DelegatingResourceDescription getCreatableProperties() { d.addProperty("accessionNumber"); return d; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("instructions", new StringProperty()) - .property("startDate", new DateProperty()) - .property("autoExpireDate", new DateProperty()) - .property("accessionNumber", new StringProperty()) - .property("discontinuedDate", new DateProperty()) - .property("discontinuedReasonNonCoded", new StringProperty()) - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("orderType", new RefProperty("#/definitions/OrdertypeGetRef")) - .property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("encounter", new RefProperty("#/definitions/EncounterGetRef")) - .property("orderer", new RefProperty("#/definitions/UserGetRef")) - .property("discontinuedBy", new RefProperty("#/definitions/UserGetRef")) - .property("discontinuedReason", new RefProperty("#/definitions/ConceptGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("orderType", new RefProperty("#/definitions/OrdertypeGet")) - .property("patient", new RefProperty("#/definitions/PatientGet")) - .property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("encounter", new RefProperty("#/definitions/EncounterGet")) - .property("orderer", new RefProperty("#/definitions/UserGet")) - .property("discontinuedBy", new RefProperty("#/definitions/UserGet")) - .property("discontinuedReason", new RefProperty("#/definitions/ConceptGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("orderType", new StringProperty().example("uuid")) - .property("patient", new StringProperty().example("uuid")) - .property("concept", new StringProperty().example("uuid")) - .property("instructions", new StringProperty()) - .property("startDate", new DateProperty()) - .property("autoExpireDate", new DateProperty()) - .property("encounter", new StringProperty().example("uuid")) - .property("orderer", new StringProperty().example("uuid")) - .property("discontinuedBy", new StringProperty().example("uuid")) - .property("discontinuedDate", new DateProperty()) - .property("discontinuedReason", new RefProperty("#/definitions/ConceptCreate")) - .property("discontinuedReasonNonCoded", new StringProperty()) - .property("accessionNumber", new StringProperty()) - - .required("orderType").required("patient").required("concept"); - if (rep instanceof FullRepresentation) { - model - .property("orderType", new RefProperty("#/definitions/OrdertypeCreate")) - .property("patient", new RefProperty("#/definitions/PatientCreate")) - .property("concept", new RefProperty("#/definitions/ConceptCreate")) - .property("encounter", new RefProperty("#/definitions/EncounterCreate")) - .property("orderer", new RefProperty("#/definitions/UserCreate")) - .property("discontinuedBy", new RefProperty("#/definitions/UserCreate")) - .property("discontinuedReason", new RefProperty("#/definitions/ConceptCreate")); - } - //FIXME missing prop: type - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } - + /** * Gets orders by given patient (paged according to context if necessary) only if a patient * parameter exists in the request set on the {@link RequestContext} otherwise diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierResource1_8.java index 34f24c837..3d840f2b9 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierResource1_8.java @@ -32,12 +32,6 @@ import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging; import org.openmrs.module.webservices.rest.web.response.ResponseException; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - /** * Sub-resource for patient identifiers */ @@ -134,52 +128,7 @@ public void setLocation(PatientIdentifier instance, Location location) { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("identifier", new StringProperty()) - .property("preferred", new BooleanProperty()._default(false)) - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("identifierType", new RefProperty("#/definitions/PatientidentifiertypeGetRef")) - .property("location", new RefProperty("#/definitions/LocationGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("identifierType", new RefProperty("#/definitions/PatientidentifiertypeGet")) - .property("location", new RefProperty("#/definitions/LocationGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("identifier", new StringProperty()) - .property("identifierType", new StringProperty().example("uuid")) - .property("location", new StringProperty().example("uuid")) - .property("preferred", new BooleanProperty()._default(false)) - - .required("identifier").required("identifierType"); - if (rep instanceof FullRepresentation) { - model - .property("identifierType", new RefProperty("#/definitions/PatientidentifiertypeCreate")) - .property("location", new RefProperty("#/definitions/LocationCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + private PatientService service() { return Context.getPatientService(); } diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierTypeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierTypeResource1_8.java index 209f47396..30d040861 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierTypeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientIdentifierTypeResource1_8.java @@ -9,14 +9,9 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.PatientIdentifierType; import org.openmrs.api.PatientService; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; 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; @@ -114,40 +109,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("format", new StringProperty()) - .property("formatDescription", new StringProperty()) - .property("required", new BooleanProperty()) - .property("checkDigit", new BooleanProperty()) - .property("validator", new StringProperty()) - .property("locationBehavior", new EnumProperty(PatientIdentifierType.LocationBehavior.class)) - .property("uniquenessBehavior", new StringProperty()); //FIXME check type - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("format", new StringProperty()) - .property("formatDescription", new StringProperty()) - .property("required", new BooleanProperty()) - .property("checkDigit", new BooleanProperty()) - .property("validator", new StringProperty()) - .property("locationBehavior", new EnumProperty(PatientIdentifierType.LocationBehavior.class)) - .property("uniquenessBehavior", new StringProperty()); //FIXME check type - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientResource1_8.java index 19178907f..633c6fd53 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientResource1_8.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Patient; import org.openmrs.PatientIdentifier; import org.openmrs.Person; @@ -142,51 +136,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - //FIXME check uuid, display in ref rep - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("identifiers", new ArrayProperty(new RefProperty("#/definitions/PatientIdentifierGetRef"))) - .property("preferred", new BooleanProperty()._default(false)) - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("person", new StringProperty().example("uuid")) - .property("identifiers", new ArrayProperty(new RefProperty("#/definitions/PatientIdentifierCreate"))) - - .required("person").required("identifiers"); - if (rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("person", new RefProperty("#/definitions/PersonGet")) - - .required("person"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientStateResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientStateResource1_8.java index b865ce818..9b45999bd 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientStateResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientStateResource1_8.java @@ -9,13 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.PatientProgram; import org.openmrs.PatientState; import org.openmrs.ProgramWorkflow; @@ -172,45 +165,5 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe updatableProperties.addProperty("voided"); return updatableProperties; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof RefRepresentation || rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()) - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("state", new RefProperty("#/definitions/WorkflowStateGet")); - } else if (rep instanceof RefRepresentation) { - model - .property("state", new RefProperty("#/definitions/WorkflowStateGetRef")) - .property("patientProgram", new ObjectProperty()); //FIXME type - } else if (rep instanceof FullRepresentation) { - model - .property("state", new RefProperty("#/definitions/WorkflowStateGetRef")) - .property("patientProgram", new ObjectProperty()); //FIXME type - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("state", new RefProperty("#/definitions/WorkflowStateCreate")) - - .required("state"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()) - .property("voided", new BooleanProperty()); - } + } diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAddressResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAddressResource1_8.java index b47bc1f90..a2a114336 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAddressResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAddressResource1_8.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Person; import org.openmrs.PersonAddress; import org.openmrs.api.context.Context; @@ -139,62 +134,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("preferred", new BooleanProperty()._default(false)) - .property("address1", new StringProperty()) - .property("address2", new StringProperty()) - .property("cityVillage", new StringProperty()) - .property("stateProvince", new StringProperty()) - .property("country", new StringProperty()) - .property("postalCode", new StringProperty()) - .property("countyDistrict", new StringProperty()) - .property("address3", new StringProperty()) - .property("address4", new StringProperty()) - .property("address5", new StringProperty()) - .property("address6", new StringProperty()) - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()) - .property("latitude", new StringProperty()) - .property("longitude", new StringProperty()) - .property("voided", new BooleanProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("preferred", new BooleanProperty()._default(false)) - .property("address1", new StringProperty()) - .property("address2", new StringProperty()) - .property("cityVillage", new StringProperty()) - .property("stateProvince", new StringProperty()) - .property("country", new StringProperty()) - .property("postalCode", new StringProperty()) - .property("countyDistrict", new StringProperty()) - .property("address3", new StringProperty()) - .property("address4", new StringProperty()) - .property("address5", new StringProperty()) - .property("address6", new StringProperty()) - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()) - .property("latitude", new StringProperty()) - .property("longitude", new StringProperty()); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeResource1_8.java index 45a7ed6ed..8057a2d45 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeResource1_8.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Attributable; import org.openmrs.Location; import org.openmrs.Person; @@ -151,49 +146,7 @@ public void setValue(PersonAttribute personAttribute, String value) { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("display", new StringProperty()) - .property("uuid", new StringProperty()) - .property("value", new StringProperty()) - .property("attributeType", new RefProperty("#/definitions/PersonattributetypeGetRef")) - .property("voided", new BooleanProperty()); - } else if (rep instanceof FullRepresentation) { - model - .property("display", new StringProperty()) - .property("uuid", new StringProperty()) - .property("value", new StringProperty()) - .property("attributeType", new RefProperty("#/definitions/PersonattributetypeGetRef")) - .property("voided", new BooleanProperty()) - .property("hydratedObject", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("attributeType", new StringProperty().example("uuid")) - .property("value", new StringProperty()) - .property("hydratedObject", new StringProperty().example("uuid")) - - .required("attributeType"); - if (rep instanceof FullRepresentation) { - model - .property("attributeType", new RefProperty("#/definitions/PersonattributetypeCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingSubResource#getParent(java.lang.Object) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeTypeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeTypeResource1_8.java index b630f9aa0..b744510d8 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeTypeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonAttributeTypeResource1_8.java @@ -9,13 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DoubleProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Concept; import org.openmrs.PersonAttributeType; import org.openmrs.api.PersonService; @@ -112,45 +105,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("format", new StringProperty()) - .property("foreignKey", new IntegerProperty()) - .property("sortWeight", new DoubleProperty()) - .property("searchable", new BooleanProperty()._default(false)); - } - if (rep instanceof DefaultRepresentation) { - model - .property("editPrivilege", new RefProperty("#/definitions/PrivilegeGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("editPrivilege", new RefProperty("#/definitions/PrivilegeGet")) - .property("concept", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("format", new StringProperty().example("java.lang.String")) - .property("foreignKey", new IntegerProperty()) - .property("sortWeight", new DoubleProperty()) - .property("searchable", new BooleanProperty()._default(false)) - .property("editPrivilege", new RefProperty("#/definitions/PrivilegeCreate")) - - .required("description"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java index 171c10cd7..f9dc12f83 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Person; import org.openmrs.PersonName; import org.openmrs.api.context.Context; @@ -104,52 +100,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("display", new StringProperty()) - .property("uuid", new StringProperty()) - .property("givenName", new StringProperty()) - .property("middleName", new StringProperty()) - .property("familyName", new StringProperty()) - .property("familyName2", new StringProperty()) - .property("voided", new BooleanProperty()); - } - if (rep instanceof FullRepresentation) { - model - .property("preferred", new BooleanProperty()) - .property("prefix", new StringProperty()) - .property("familyNamePrefix", new StringProperty()) - .property("familyNameSuffix", new StringProperty()) - .property("degree", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("givenName", new StringProperty()) - .property("middleName", new StringProperty()) - .property("familyName", new StringProperty()) - .property("familyName2", new StringProperty()) - .property("preferred", new BooleanProperty()._default(false)) - .property("prefix", new StringProperty()) - .property("familyNamePrefix", new StringProperty()) - .property("familyNameSuffix", new StringProperty()) - .property("degree", new StringProperty()) - - .required("givenName").required("familyName"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingSubResource#getParent(java.lang.Object) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonResource1_8.java index 15de940cc..a63a6b23a 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonResource1_8.java @@ -14,15 +14,6 @@ import java.util.List; import java.util.Set; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.DateTimeProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Person; import org.openmrs.PersonAddress; import org.openmrs.PersonAttribute; @@ -141,74 +132,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe description.addProperty("deathDate"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("gender", new StringProperty()._enum("M")._enum("F")) - .property("age", new IntegerProperty()) - .property("birthdate", new DateTimeProperty()) - .property("birthdateEstimated", new BooleanProperty()) - .property("dead", new BooleanProperty()) - .property("deathDate", new DateProperty()) - .property("causeOfDeath", new StringProperty()) - .property("attributes", new ArrayProperty(new RefProperty("#/definitions/PersonAttributeGetRef"))) - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("preferredName", new RefProperty("#/definitions/PersonNameGetRef")) - .property("preferredAddress", new RefProperty("#/definitions/PersonAddressGetRef")); - - } else if (rep instanceof FullRepresentation) { - model - .property("preferredName", new RefProperty("#/definitions/PersonNameGet")) - .property("preferredAddress", new RefProperty("#/definitions/PersonAddressGet")) - .property("names", new ArrayProperty(new RefProperty("#/definitions/PersonNameGet"))) - .property("addresses", new ArrayProperty(new RefProperty("#/definitions/PersonAddressGet"))); - } - return model; - } - - @Override - public Model getCREATEModel(Representation representation) { - ModelImpl model = new ModelImpl() - .property("names", new ArrayProperty(new RefProperty("#/definitions/PersonNameCreate"))) - .property("gender", new StringProperty()._enum("M")._enum("F")) - .property("age", new IntegerProperty()) - .property("birthdate", new DateProperty()) - .property("birthdateEstimated", new BooleanProperty()._default(false)) - .property("dead", new BooleanProperty()._default(false)) - .property("deathDate", new DateProperty()) - .property("causeOfDeath", new StringProperty()) - .property("addresses", new ArrayProperty(new RefProperty("#/definitions/PersonAddressCreate"))) - .property("attributes", new ArrayProperty(new RefProperty("#/definitions/PersonAttributeCreate"))); - - model.setRequired(Arrays.asList("names", "gender")); - return model; - } - - @Override - public Model getUPDATEModel(Representation representation) { - return new ModelImpl() - .property("dead", new BooleanProperty()) - .property("causeOfDeath", new StringProperty()) - .property("deathDate", new DateProperty()) - .property("age", new IntegerProperty()) - .property("gender", new StringProperty()._enum("M")._enum("F")) - .property("birthdate", new DateProperty()) - .property("birthdateEstimated", new BooleanProperty()._default(false)) - .property("preferredName", new StringProperty().example("uuid")) - .property("preferredAddress", new StringProperty().example("uuid")) - .property("attributes", new ArrayProperty(new RefProperty("#/definitions/PersonAttributeCreate"))) - - .required("dead").required("causeOfDeath"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getPropertiesToExposeAsSubResources() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PrivilegeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PrivilegeResource1_8.java index 5ca45144b..5f344be76 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PrivilegeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PrivilegeResource1_8.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.Privilege; import org.openmrs.api.context.Context; @@ -92,14 +89,8 @@ public DelegatingResourceDescription getUpdatableProperties() { return description; } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("description", new StringProperty()); - } - - /** + + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ @Override diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProblemResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProblemResource1_8.java index 19de11f5d..10ade8b65 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProblemResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProblemResource1_8.java @@ -9,15 +9,9 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DoubleProperty; -import io.swagger.models.properties.RefProperty; import org.openmrs.Patient; import org.openmrs.activelist.Problem; -import org.openmrs.activelist.ProblemModifier; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; 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; @@ -37,27 +31,7 @@ */ @Resource(name = RestConstants.VERSION_1 + "/problem", supportedClass = Problem.class, supportedOpenmrsVersions = { "1.8.*" }) public class ProblemResource1_8 extends BaseActiveListItemResource1_8 { - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("modifier", new EnumProperty(ProblemModifier.class)) - .property("sortWeight", new DoubleProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("problem", new RefProperty("#/definitions/ConceptGetRef")); - - } else if (rep instanceof FullRepresentation) { - model - .property("problem", new RefProperty("#/definitions/ConceptGet")); - - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ @@ -91,17 +65,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("problem", new RefProperty("#/definitions/ConceptCreate")) - .property("modifier", new EnumProperty(ProblemModifier.class)) - .property("sortWeight", new DoubleProperty()) - - .required("problem"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#newDelegate() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramEnrollmentResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramEnrollmentResource1_8.java index 67dcb2dc7..839f16674 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramEnrollmentResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramEnrollmentResource1_8.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Patient; import org.openmrs.PatientProgram; import org.openmrs.api.PatientService; @@ -125,60 +119,7 @@ public DelegatingResourceDescription getCreatableProperties() { d.addProperty("voided"); return d; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("dateEnrolled", new DateProperty()) - .property("dateCompleted", new DateProperty()) - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("program", new RefProperty("#/definitions/ProgramGetRef")) - .property("location", new RefProperty("#/definitions/LocationGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("patient", new RefProperty("#/definitions/PatientGet")) - .property("program", new RefProperty("#/definitions/ProgramGet")) - .property("location", new RefProperty("#/definitions/LocationGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("patient", new StringProperty().example("uuid")) - .property("program", new StringProperty().example("uuid")) - .property("dateEnrolled", new DateProperty()) - .property("dateCompleted", new DateProperty()) - .property("location", new StringProperty().example("uuid")) - .property("voided", new BooleanProperty()) - - .required("patient").required("program").required("dateEnrolled"); - if (rep instanceof FullRepresentation) { - model - .property("patient", new RefProperty("#/definitions/PatientCreate")) - .property("program", new RefProperty("#/definitions/ProgramCreate")) - .property("location", new RefProperty("#/definitions/LocationCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("dateEnrolled", new DateProperty()) - .property("dateCompleted", new DateProperty()); //FIXME missing props - - } - + /** * Gets all the programs (excluding voided) of the given patient * diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramResource1_8.java index 144760495..27831b1b8 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramResource1_8.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Program; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -116,44 +110,7 @@ public DelegatingResourceDescription getCreatableProperties() { description.addProperty("retired"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("allWorkflows", new ArrayProperty(new RefProperty("#/definitions/WorkflowGetRef"))); - } else if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("allWorkflows", new ArrayProperty(new RefProperty("#/definitions/WorkflowGet"))); - } else if (rep instanceof RefRepresentation) { - model - .property("allWorkflows", new ArrayProperty(new RefProperty("#/definitions/WorkflowGetRef"))); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getCREATEModel(rep)) - .property("concept", new StringProperty().example("uuid")) - .property("retired", new BooleanProperty()) - - .required("concept").required("description"); - if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } - + @Override protected PageableResult doSearch(RequestContext context) { String query = context.getParameter("q"); diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowResource1_8.java index 9bc4b8834..dac3587d9 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowResource1_8.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.RefProperty; import org.openmrs.Program; import org.openmrs.ProgramWorkflow; import org.openmrs.ProgramWorkflowState; @@ -70,27 +66,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("states", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateGetRef"))); - } else if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("states", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateGet"))); - } else if (rep instanceof RefRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("states", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateGet"))); - //FIXME should remove 'description'? - } - return model; - } - + @PropertyGetter("states") public Set getUnretiredStates(ProgramWorkflow instance) { return instance.getStates(false); diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowStateResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowStateResource1_8.java index ce4ec8840..68bcc1e20 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowStateResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ProgramWorkflowStateResource1_8.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Program; import org.openmrs.ProgramWorkflow; import org.openmrs.ProgramWorkflowState; @@ -121,35 +116,6 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("uuid", new StringProperty()) - .property("description", new StringProperty()) - .property("retired", new BooleanProperty()) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("description", new StringProperty()) - .property("retired", new BooleanProperty()) - .property("concept", new RefProperty("#/definitions/ConceptGet")); - } else if (rep instanceof RefRepresentation) { - model - .property("uuid", new StringProperty()) - .property("retired", new BooleanProperty()) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } @Override public DelegatingResourceDescription getCreatableProperties() { diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationShipTypeResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationShipTypeResource1_8.java index 8180de756..4e3929644 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationShipTypeResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationShipTypeResource1_8.java @@ -10,10 +10,6 @@ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; import org.apache.commons.lang.StringUtils; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.RelationshipType; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -130,37 +126,7 @@ public DelegatingResourceDescription getCreatableProperties() { description.addProperty("description"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("aIsToB", new StringProperty()) - .property("bIsToA", new StringProperty()); - } - if (rep instanceof FullRepresentation) { - model - .property("weight", new IntegerProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("aIsToB", new StringProperty()) - .property("bIsToA", new StringProperty()) - .property("weight", new IntegerProperty()) - - .required("aIsToB").required("bIsToA"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doGetAll(org.openmrs.module.webservices.rest.web.RequestContext) */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationshipResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationshipResource1_8.java index a004176ba..13a9fc140 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationshipResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RelationshipResource1_8.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Person; import org.openmrs.Relationship; import org.openmrs.api.context.Context; @@ -159,53 +153,5 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe description.addProperty("voided"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("personA", new RefProperty("#/definitions/PersonGetRef")) - .property("relationshipType", new RefProperty("#/definitions/RelationshiptypeGetRef")) - .property("personB", new RefProperty("#/definitions/PersonGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("personA", new RefProperty("#/definitions/PersonGet")) - .property("relationshipType", new RefProperty("#/definitions/RelationshiptypeGet")) - .property("personB", new RefProperty("#/definitions/PersonGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("personA", new StringProperty().example("uuid")) - .property("relationshipType", new StringProperty().example("uuid")) - .property("personB", new StringProperty().example("uuid")) - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()) - - .required("personA").required("relationshipType").required("personB"); - if (rep instanceof FullRepresentation) { - model - .property("personA", new RefProperty("#/definitions/PersonCreate")) - - .property("relationshipType", new RefProperty("#/definitions/RelationshiptypeCreate")) - .property("personB", new RefProperty("#/definitions/PersonCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("voided", new BooleanProperty()); //FIXME missing properties - } + } diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RoleResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RoleResource1_8.java index bacd9c032..034aa780e 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RoleResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/RoleResource1_8.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.Privilege; import org.openmrs.Role; @@ -124,39 +119,7 @@ public DelegatingResourceDescription getUpdatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeGetRef"))) - .property("inheritedRoles", new ArrayProperty(new RefProperty("#/definitions/RoleGetRef"))); - } - if (rep instanceof FullRepresentation) { - model - .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeGet"))) - .property("inheritedRoles", new ArrayProperty(new RefProperty("#/definitions/RoleGet"))) - .property("allInheritedRoles", new ArrayProperty(new RefProperty("#/definitions/RoleGet"))); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeCreate"))) - .property("inheritedRoles", new ArrayProperty(new RefProperty("#/definitions/RoleCreate"))); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("description", new StringProperty()) - .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeCreate"))) - .property("inheritedRoles", new ArrayProperty(new RefProperty("#/definitions/RoleCreate"))); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ServerLogResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ServerLogResource1_8.java index 0cf9916db..e4ca28d8e 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ServerLogResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/ServerLogResource1_8.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.MapProperty; import org.openmrs.module.webservices.helper.ServerLogActionWrapper; import org.openmrs.module.webservices.helper.ServerLogActionWrapper1_8; import org.openmrs.module.webservices.rest.SimpleObject; @@ -43,13 +40,7 @@ public SimpleObject getAll(RequestContext context) throws ResponseException { rest.put("serverLog", serverLogActionWrapper.getServerLogs()); return rest; } - - @Override - public Model getGETModel(Representation rep) { - return ((ModelImpl) super.getGETModel(rep)) - .property("serverLog", new MapProperty()); - } - + @Override public ServerLogActionWrapper getByUniqueId(String uniqueId) { throw new UnsupportedOperationException("Serverlog doesn't support to this action"); diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/TaskActionResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/TaskActionResource1_8.java index c1f750a4b..e09769991 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/TaskActionResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/TaskActionResource1_8.java @@ -9,13 +9,7 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.api.APIException; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.helper.TaskAction; import org.openmrs.module.webservices.helper.TaskServiceWrapper; import org.openmrs.module.webservices.rest.SimpleObject; @@ -196,17 +190,7 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe description.addRequiredProperty("action", "action"); return description; } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl(); - model.property("tasks", new ArrayProperty(new StringProperty())); - model.property("allTasks", new BooleanProperty()); - model.property("action", new EnumProperty(TaskAction.Action.class)); - model.required("action"); - return model; - } - + /** * Converter does not handle getters starting with 'is' instead of 'get' */ diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/UserResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/UserResource1_8.java index 9cf656933..26e43400c 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/UserResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/UserResource1_8.java @@ -40,14 +40,6 @@ import org.openmrs.module.webservices.rest.web.response.ResponseException; import org.openmrs.module.webservices.rest.web.v1_0.wrapper.openmrs1_8.UserAndPassword1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.MapProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - /** * {@link Resource} for User, supporting standard CRUD operations */ @@ -134,49 +126,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - //FIXME check valid supportedClass - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("username", new StringProperty()) - .property("systemId", new StringProperty()) - .property("userProperties", new MapProperty()); //FIXME type - } - if (rep instanceof DefaultRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGetRef")) - .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeGetRef"))) - .property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleGetRef"))); - } else if (rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGet")) - .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeGet"))) - .property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleGet"))) - .property("allRoles", new ArrayProperty(new RefProperty("#/definitions/RoleGet"))) - .property("proficientLocales", new ArrayProperty(new ObjectProperty())) - .property("secretQuestion", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("username", new StringProperty()) - .property("password", new StringProperty()) - .property("person", new RefProperty("#/definitions/PersonCreate")) - .property("systemId", new StringProperty()) - .property("userProperties", new MapProperty()) //FIXME type - .property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleCreate"))) - .property("proficientLocales", new ArrayProperty(new ObjectProperty())) - .property("secretQuestion", new StringProperty()) - - .required("username").required("password").required("person"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/HivDrugOrderSubclassHandler.java b/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/HivDrugOrderSubclassHandler.java index 0a555964c..7d0d548bc 100644 --- a/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/HivDrugOrderSubclassHandler.java +++ b/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/HivDrugOrderSubclassHandler.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Order; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.annotation.PropertyGetter; @@ -86,41 +81,7 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe return d; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = new ModelImpl(); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("startDate", new DateProperty()) - .property("autoExpireDate", new DateProperty()) - .property("standardRegimenCode", new StringProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("concept", new RefProperty("#/definitions/ConceptGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("patient", new RefProperty("#/definitions/PatientGet")) - .property("concept", new RefProperty("#/definitions/ConceptGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("patient", new StringProperty().example("uuid")) - .property("concept", new StringProperty().example("uuid")) - .property("startDate", new DateProperty()) - .property("autoExpireDate", new DateProperty()) - .property("standardRegimenCode", new StringProperty()) - .property("instructions", new StringProperty()) - - .required("patient").required("concept"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getAllByType(org.openmrs.module.webservices.rest.web.RequestContext) */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeCrudResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeCrudResource1_9.java index d9f0b6ab1..c34c0f3c1 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeCrudResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeCrudResource1_9.java @@ -12,10 +12,6 @@ import java.util.Arrays; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.attribute.Attribute; import org.openmrs.customdatatype.CustomDatatype; @@ -107,30 +103,7 @@ public DelegatingResourceDescription getCreatableProperties() { description.addRequiredProperty("value"); return description; } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("attributeType", new StringProperty().example("uuid")) - .property("value", new StringProperty()) - - .required("attributeType").required("value"); - } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("display", new StringProperty()) - .property("uuid", new StringProperty()) - .property("attributeType", new StringProperty()) //FIXME type - .property("value", new StringProperty()) //FIXME type - .property("voided", new BooleanProperty()); - } - return model; - } - + /** * Gets the display string for an attribute. * diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeTypeCrudResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeTypeCrudResource1_9.java index 0fd108aba..fe2de5b37 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeTypeCrudResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/BaseAttributeTypeCrudResource1_9.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.attribute.AttributeType; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation; @@ -28,39 +24,7 @@ * @param */ public abstract class BaseAttributeTypeCrudResource1_9> extends MetadataDelegatingCrudResource { - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("minOccurs", new IntegerProperty()) - .property("maxOccurs", new IntegerProperty()) - .property("datatypeClassname", new StringProperty()) - .property("preferredHandlerClassname", new StringProperty()); - } - if (rep instanceof FullRepresentation) { - model - .property("datatypeConfig", new StringProperty()) - .property("handlerConfig", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("datatypeClassname", new StringProperty()) - .property("minOccurs", new IntegerProperty()) - .property("maxOccurs", new IntegerProperty()) - .property("datatypeConfig", new StringProperty()) - .property("preferredHandlerClassname", new StringProperty()) - .property("handlerConfig", new StringProperty()) - - .required("datatypeClassname"); - - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapResource1_9.java index 420153e67..fd58497c8 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapResource1_9.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.ConceptMap; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -55,34 +52,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGetRef")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGet")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGet")); - } - model.getProperties().remove("source"); //FIXME check - model.getProperties().remove("sourceCode"); - model.getProperties().remove("comment"); - return model; - } - - @Override - public Model getCREATEModel(Representation representation) { - return new ModelImpl() - .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermCreate")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeCreate")) - - .required("conceptReferenceTerm").required("conceptMapType"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapTypeResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapTypeResource1_9.java index 5a200a342..fd2490d32 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapTypeResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptMapTypeResource1_9.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; import org.openmrs.ConceptMapType; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -81,23 +78,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("isHidden", new BooleanProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("isHidden", new BooleanProperty()); - } - + /** * @see DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermMapResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermMapResource1_9.java index 91f23b973..e976407ac 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermMapResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermMapResource1_9.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; import org.openmrs.ConceptReferenceTerm; import org.openmrs.ConceptReferenceTermMap; import org.openmrs.api.context.Context; @@ -86,39 +83,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("termA", new RefProperty("#/definitions/ConceptreferencetermGetRef")) - .property("termB", new RefProperty("#/definitions/ConceptreferencetermGetRef")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("termA", new RefProperty("#/definitions/ConceptreferencetermGet")) - .property("termB", new RefProperty("#/definitions/ConceptreferencetermGet")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("termA", new RefProperty("#/definitions/ConceptreferencetermCreate")) - .property("termB", new RefProperty("#/definitions/ConceptreferencetermCreate")) - .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeCreate")) - - .required("termA").required("termB").required("conceptMapType"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } - + /** * Gets the display string for a concept map. * diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermResource1_9.java index c188c85a0..148f7932e 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptReferenceTermResource1_9.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; -import io.swagger.models.properties.UUIDProperty; import org.apache.commons.lang3.StringUtils; import org.openmrs.ConceptReferenceTerm; import org.openmrs.api.ConceptService; @@ -92,40 +87,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model.property("uuid", new UUIDProperty()); - model.property("conceptSource", new RefProperty("#/definitions/ConceptsourceGetRef")); - model.property("code", new StringProperty()); - model.property("version", new StringProperty()); - } else if (rep instanceof FullRepresentation) { - model.property("uuid", new UUIDProperty()); - model.property("conceptSource", new RefProperty("#/definitions/ConceptsourceGetFull")); - model.property("code", new StringProperty()); - model.property("version", new StringProperty()); - model.property("auditInfo", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("code", new StringProperty()) - .property("conceptSource", new RefProperty("#/definitions/ConceptsourceCreate")) - .property("version", new StringProperty()) - - .required("code").required("conceptSource"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); //FIXME missing props - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.MetadataDelegatingCrudResource#getDisplayString(org.openmrs.OpenmrsMetadata) */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptSearchResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptSearchResource1_9.java index d824a86a3..75ca27335 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptSearchResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptSearchResource1_9.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.ConceptClass; import org.openmrs.ConceptName; import org.openmrs.ConceptSearchResult; @@ -71,28 +67,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("display", new StringProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("conceptName", new RefProperty("#/definitions/ConceptNameGetRef")); - } else if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGet")) - .property("conceptName", new RefProperty("#/definitions/ConceptNameGetRef")) - .property("word", new StringProperty()) - .property("transientWeight", new StringProperty()); - } - return model; - } - + /** * @see */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptStopwordResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptStopwordResource1_9.java index b44987aac..51cef6865 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptStopwordResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ConceptStopwordResource1_9.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -83,30 +80,7 @@ public DelegatingResourceDescription getCreatableProperties() { description.addProperty("locale"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("value", new StringProperty()) - .property("locale", new StringProperty().example("en")); //FIXME type - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("value", new StringProperty()) - .property("locale", new StringProperty().example("en")) - - .required("value"); - } - + /** * @see DelegatingCrudResource#getByUniqueId(java.lang.String) */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeHandlerResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeHandlerResource1_9.java index 4675653e9..e5a513419 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeHandlerResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeHandlerResource1_9.java @@ -9,14 +9,9 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.annotation.SubResource; -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; import org.openmrs.module.webservices.rest.web.resource.api.PageableResult; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; @@ -39,19 +34,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("handlerClassname", new StringProperty()) - .property("display", new StringProperty()); //FIXME delegate property name - } - return model; - } - + @Override public CustomDatatypeHandlerRepresentation newDelegate() { return new CustomDatatypeHandlerRepresentation(); diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java index 7762a01b4..0739f1d7f 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.api.APIAuthenticationException; import org.openmrs.api.context.Context; import org.openmrs.customdatatype.CustomDatatype; @@ -102,26 +97,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("datatypeClassname", new StringProperty()); - } - if (rep instanceof DefaultRepresentation) { - model - .property("handlers", new ArrayProperty(new RefProperty("#/definitions/CustomdatatypeHandlersGetRef"))); - } else if (rep instanceof FullRepresentation) { - model - .property("handlers", new ArrayProperty(new RefProperty("#/definitions/CustomdatatypeHandlersGet"))); - } - return model; - } - + @Override protected PageableResult doGetAll(RequestContext context) throws ResponseException { List datatypes = getAllCustomDatatypes(); diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterProviderResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterProviderResource1_9.java index c52c5ddfe..6caed8759 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterProviderResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterProviderResource1_9.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Encounter; import org.openmrs.EncounterProvider; import org.openmrs.EncounterRole; @@ -89,48 +84,7 @@ public DelegatingResourceDescription getUpdatableProperties() { description.addProperty("voidReason"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("provider", new RefProperty("#/definitions/ProviderGetRef")) - .property("encounterRole", new RefProperty("#/definitions/EncounterroleGetRef")) - .property("voided", new BooleanProperty()); - } - if (rep instanceof FullRepresentation) { - model - .property("provider", new RefProperty("#/definitions/ProviderGet")) - .property("encounterRole", new RefProperty("#/definitions/EncounterroleGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("provider", new StringProperty().example("uuid")) - .property("encounterRole", new StringProperty().example("uuid")) - .property("encounter", new StringProperty()); //FIXME remove if not needed - if (rep instanceof FullRepresentation) { - model - .property("provider", new RefProperty("#/definitions/ProviderCreate")) - .property("encounter", new RefProperty("#/definitions/EncounterCreate")) - .property("encounterRole", new RefProperty("#/definitions/EncounterroleCreate")); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("encounterRole", new StringProperty()) - .property("voided", new BooleanProperty()) - .property("voidReason", new StringProperty()); - } - + @Override public Encounter getParent(EncounterProvider instance) { return instance.getEncounter(); diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterRoleResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterRoleResource1_9.java index 4d8ad24ae..35d956e67 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterRoleResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/EncounterRoleResource1_9.java @@ -9,13 +9,11 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; import org.openmrs.EncounterRole; import org.openmrs.api.context.Context; 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.representation.Representation; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; import org.openmrs.module.webservices.rest.web.resource.impl.MetadataDelegatingCrudResource; @@ -41,13 +39,8 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - - /** + + /** * @see DelegatingCrudResource#newDelegate() */ @Override diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/FormResourceResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/FormResourceResource1_9.java index 83f6978eb..c579a04f4 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/FormResourceResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/FormResourceResource1_9.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.Form; import org.openmrs.FormResource; @@ -140,44 +136,7 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl - .property("name", new StringProperty()) - .property("valueReference", new StringProperty()); - } - if (rep instanceof FullRepresentation) { - modelImpl - .property("dataType", new StringProperty()) - .property("handler", new StringProperty()) - .property("handlerConfig", new StringProperty()); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl() - .property("form", new StringProperty()) - .property("name", new StringProperty()) - .property("dataType", new StringProperty()) - .property("handler", new StringProperty()) - .property("handlerConfig", new StringProperty()) - .property("value", new StringProperty()) - .property("valueReference", new StringProperty()); - if (rep instanceof FullRepresentation) { - model - .property("form", new RefProperty("#/definitions/FormCreate")); - } - return model; - } - + @Override protected void delete(FormResource delegate, String reason, RequestContext context) throws ResponseException { purge(delegate, context); diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ProviderResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ProviderResource1_9.java index 58a1bdcc8..9cf9e66fb 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ProviderResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/ProviderResource1_9.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Provider; import org.openmrs.ProviderAttribute; import org.openmrs.api.context.Context; @@ -112,46 +106,7 @@ public static void setAttributes(Provider provider, Set attri public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGetRef")) - .property("identifier", new StringProperty()) - .property("attributes", new ArrayProperty(new RefProperty("#/definitions/ProviderAttributeGetRef"))) - .property("preferredHandlerClassname", new StringProperty()); - } - if (rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonGet")) - .property("attributes", new ArrayProperty(new RefProperty("#/definitions/ProviderAttributeGet"))); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getCREATEModel(rep)) - .property("person", new StringProperty().example("uuid")) - .property("identifier", new StringProperty()) - .property("attributes", new ArrayProperty(new RefProperty("#/definitions/ProviderAttributeCreate"))) - .property("retired", new BooleanProperty()) - - .required("person").required("identifier"); - if (rep instanceof FullRepresentation) { - model - .property("person", new RefProperty("#/definitions/PersonCreate")); - } - return model; - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/SystemSettingResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/SystemSettingResource1_9.java index 895cc3699..d0a7a9402 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/SystemSettingResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/SystemSettingResource1_9.java @@ -34,10 +34,6 @@ import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException; import org.openmrs.module.webservices.rest.web.response.ResponseException; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; - /** * {@link Resource} for {@link GlobalProperty}, supporting standard CRUD operations */ @@ -110,49 +106,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe description.removeProperty("property"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("property", new StringProperty()) - .property("value", new StringProperty()) - .property("description", new StringProperty()) - .property("display", new StringProperty()); - } - if (rep instanceof FullRepresentation) { - model - .property("datatypeClassname", new StringProperty()) - .property("datatypeConfig", new StringProperty()) - .property("preferredHandlerClassname", new StringProperty()) - .property("handlerConfig", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("property", new StringProperty()) - .property("description", new StringProperty()) - .property("datatypeClassname", new StringProperty()) - .property("datatypeConfig", new StringProperty()) - .property("preferredHandlerClassname", new StringProperty()) - .property("handlerConfig", new StringProperty()) - .property("value", new StringProperty()) - - .required("property"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - Model model = getCREATEModel(rep); - model.getProperties().remove("property"); - return model; - } - + /** * @see DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/VisitResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/VisitResource1_9.java index de53a35c2..3cd148727 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/VisitResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/VisitResource1_9.java @@ -45,14 +45,6 @@ import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.LocationResource1_8; import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.PatientResource1_8; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; - /** * {@link Resource} for {@link Visit}, supporting standard CRUD operations */ @@ -165,63 +157,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe description.removeProperty("patient"); return description; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - modelImpl.property("uuid", new StringProperty()).property("display", new StringProperty()) - .property("startDatetime", new DateProperty()).property("stopDatetime", new DateProperty()) - .property("attributes", new ArrayProperty(new StringProperty())) //FIXME type - .property("voided", new BooleanProperty()); - } - if (rep instanceof DefaultRepresentation) { - modelImpl.property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("visitType", new RefProperty("#/definitions/VisittypeGetRef")) - .property("indication", new RefProperty("#/definitions/ConceptGetRef")) - .property("location", new RefProperty("#/definitions/LocationGetRef")) - .property("encounters", new ArrayProperty(new RefProperty("#/definitions/EncounterGetRef"))); - } else if (rep instanceof FullRepresentation) { - modelImpl.property("patient", new RefProperty("#/definitions/PatientGet")) - .property("visitType", new RefProperty("#/definitions/VisittypeGet")) - .property("indication", new RefProperty("#/definitions/ConceptGet")) - .property("location", new RefProperty("#/definitions/LocationGet")) - .property("encounters", new ArrayProperty(new RefProperty("#/definitions/EncounterGet"))); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl().property("patient", new StringProperty().example("uuid")) - .property("visitType", new StringProperty().example("uuid")).property("startDatetime", new DateProperty()) - .property("location", new StringProperty().example("uuid")).property("indication", new StringProperty()) - .property("stopDatetime", new DateProperty()) - .property("encounters", new ArrayProperty(new StringProperty().example("uuid"))) - .property("attributes", new ArrayProperty(new RefProperty("#/definitions/VisitAttributeCreate"))) - - .required("patient").required("visitType"); - if (rep instanceof FullRepresentation) { - model.property("patient", new RefProperty("#/definitions/PatientCreate")) - .property("visitType", new RefProperty("#/definitions/VisittypeCreate")) - .property("location", new RefProperty("#/definitions/LocationCreate")) - .property("indication", new RefProperty("#/definitions/ConceptCreate")) - .property("encounters", new ArrayProperty(new RefProperty("#/definitions/EncounterCreate"))); - } - return model; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl().property("visitType", new RefProperty("#/definitions/VisittypeCreate")) - .property("startDatetime", new DateProperty()) - .property("location", new RefProperty("#/definitions/LocationCreate")) - .property("indication", new RefProperty("#/definitions/ConceptCreate")) - .property("stopDatetime", new DateProperty()) - .property("encounters", new ArrayProperty(new RefProperty("#/definitions/EncounterCreate"))) - .property("attributes", new ArrayProperty(new StringProperty())); //FIXME type - } - + /** * @see DelegatingCrudResource#newDelegate() */ diff --git a/omod-1.9/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/test/GenericChildResource.java b/omod-1.9/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/test/GenericChildResource.java index c2e53d682..a39df972b 100644 --- a/omod-1.9/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/test/GenericChildResource.java +++ b/omod-1.9/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/test/GenericChildResource.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.test; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; 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; @@ -42,25 +39,7 @@ public DelegatingResourceDescription getCreatableProperties() { return description; } - - @Override - public Model getGETModel(Representation rep) { - return ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("value", new StringProperty()); - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("value", new StringProperty()); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl(); - } - + @Override public GenericChild newDelegate() { return new GenericChild(); diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AdministrationLinksResource2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AdministrationLinksResource2_0.java index 907d1182b..f1049d24f 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AdministrationLinksResource2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AdministrationLinksResource2_0.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.api.context.Context; import org.openmrs.messagesource.MessageSourceService; import org.openmrs.module.Extension; @@ -118,18 +113,6 @@ public static Map getLinks(AdministrationSectionLinks instance) return instance.getLinks(); } - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property(MODULE_TITLE, new StringProperty()) - .property(LINKS, new ArrayProperty(new ObjectProperty())); - } - - return model; - } - @Override public NeedsPaging doGetAll(RequestContext context) throws ResponseException { return new NeedsPaging<>(getAllAdministrationLinks(), context); diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertRecipientResource2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertRecipientResource2_0.java index 6990bb361..8940debc4 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertRecipientResource2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertRecipientResource2_0.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateTimeProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.User; import org.openmrs.api.context.Context; @@ -99,44 +93,6 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe return description; } - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = ((ModelImpl) super.getGETModel(rep)) - .property(UUID, new StringProperty()) - .property(DISPLAY, new StringProperty()); - - if (rep instanceof DefaultRepresentation) { - modelImpl - .property(RECIPIENT, new RefProperty("#/definitions/UserGetRef")) - .property(ALERT_READ, new BooleanProperty()) - .property(DATE_CHANGED, new DateTimeProperty()); - } - if (rep instanceof FullRepresentation) { - modelImpl - .property(RECIPIENT, new RefProperty("#/definitions/UserGet")) - .property(ALERT_READ, new BooleanProperty()) - .property(DATE_CHANGED, new DateTimeProperty()); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl modelImpl = new ModelImpl() - .property(RECIPIENT, new StringProperty().example("uuid")); - - if (rep instanceof FullRepresentation) { - modelImpl - .property(RECIPIENT, new RefProperty("#/definitions/UserCreate")); - } - return modelImpl; - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - @Override public AlertRecipient newDelegate() { return new AlertRecipient(); diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertResource2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertResource2_0.java index 6107cc925..39e95342d 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertResource2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/AlertResource2_0.java @@ -9,16 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.DateTimeProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -148,54 +138,6 @@ public List getPropertiesToExposeAsSubResources() { return Collections.singletonList(RECIPIENTS); } - @Override - public Model getGETModel(Representation rep) { - ModelImpl modelImpl = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property(ALERT_ID, new IntegerProperty()); - - if (rep instanceof DefaultRepresentation) { - modelImpl - .property(TEXT, new StringProperty()) - .property(SATISFIED_BY_ANY, new BooleanProperty()) - .property(ALERT_READ, new BooleanProperty()) - .property(DATE_TO_EXPIRE, new DateProperty()) - .property(RECIPIENTS, new ArrayProperty(new RefProperty("#/definitions/AlertRecipientGetRef"))); - } - if (rep instanceof FullRepresentation) { - modelImpl - .property(TEXT, new StringProperty()) - .property(SATISFIED_BY_ANY, new BooleanProperty()) - .property(ALERT_READ, new BooleanProperty()) - .property(DATE_TO_EXPIRE, new DateProperty()) - .property(CREATOR, new ObjectProperty()) - .property(DATE_CREATED, new DateTimeProperty()) - .property(CHANGED_BY, new ObjectProperty()) - .property(DATE_CHANGED, new DateTimeProperty()) - .property(RECIPIENTS, new ArrayProperty(new RefProperty("#/definitions/AlertRecipientGetRef"))); - } - return modelImpl; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property(TEXT, new StringProperty()) - .property(RECIPIENTS, new ArrayProperty(new RefProperty("#/definitions/AlertRecipientCreate"))) - .property(SATISFIED_BY_ANY, new BooleanProperty()) - .property(DATE_TO_EXPIRE, new DateProperty()); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property(TEXT, new StringProperty()) - .property(RECIPIENTS, new ArrayProperty(new RefProperty("#/definitions/AlertRecipientCreate"))) - .property(SATISFIED_BY_ANY, new BooleanProperty()) - .property(DATE_TO_EXPIRE, new DateProperty()); - } - @Override public DelegatingResourceDescription getCreatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = new DelegatingResourceDescription(); diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptProposalResource2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptProposalResource2_0.java index 2f7bf47db..732d251f9 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptProposalResource2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptProposalResource2_0.java @@ -9,11 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Concept; import org.openmrs.ConceptProposal; import org.openmrs.User; @@ -112,49 +107,6 @@ public DelegatingResourceDescription getRepresentationDescription(Representation return null; } - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model.property("uuid", new StringProperty().example("uuid")); - model.property("display", new StringProperty()); - model.property("encounter", new RefProperty("#/definitions/EncounterGetRef")); - model.property("originalText", new StringProperty()); - model.property("finalText", new StringProperty()); - model.property("state", new StringProperty()); - model.property("comments", new StringProperty()); - model.property("occurrences", new StringProperty()); - model.property("creator", new RefProperty("#/definitions/UserGetRef")); - model.property("dateCreated", new DateProperty()); - } else if (rep instanceof FullRepresentation) { - model.property("uuid", new StringProperty().example("uuid")); - model.property("display", new StringProperty()); - model.property("encounter", new RefProperty("#/definitions/EncounterGet")); - model.property("obsConcept", new RefProperty("#/definitions/ConceptGet")); - model.property("obs", new RefProperty("#/definitions/ObsGet")); - model.property("mappedConcept", new RefProperty("#/definitions/ConceptGet")); - model.property("originalText", new StringProperty()); - model.property("finalText", new StringProperty()); - model.property("state", new StringProperty()); - model.property("comments", new StringProperty()); - model.property("occurrences", new StringProperty()); - model.property("creator", new RefProperty("#/definitions/UserGet")); - model.property("dateCreated", new DateProperty()); - model.property("changedBy", new RefProperty("#/definitions/UserGet")); - model.property("dateChanged", new DateProperty()); - } else if (rep instanceof RefRepresentation) { - model.property("uuid", new StringProperty().example("uuid")); - model.property("display", new StringProperty()); - model.property("encounter", new RefProperty("#/definitions/EncounterGetRef")); - model.property("originalText", new StringProperty()); - model.property("state", new StringProperty()); - model.property("occurrences", new StringProperty()); - model.property("changedBy", new RefProperty("#/definitions/UserGetRef")); - model.property("dateChanged", new DateProperty()); - } - return model; - } - @PropertyGetter("occurrences") public Integer getOccurrencesProperty(ConceptProposal proposal) { Map> proposalsMap = getProposalsMapByOriginalText(false); @@ -176,15 +128,6 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe return description; } - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("originalText", new StringProperty()) - .property("mappedConcept", new RefProperty("#/definitions/ConceptCreate")) - .property("encounter", new RefProperty("#/definitions/EncounterCreate")) - .property("obsConcept", new RefProperty("#/definitions/ConceptCreate")); - } - @Override public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = new DelegatingResourceDescription(); @@ -196,17 +139,6 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe return description; } - @Override - public Model getUPDATEModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getUPDATEModel(rep); - return model - .property("finalText", new StringProperty()) - .property("mappedConcept", new RefProperty("#/definitions/ConceptCreate")) - .property("encounter", new RefProperty("#/definitions/EncounterCreate")) - .property("obsConcept", new RefProperty("#/definitions/ConceptCreate")) - .property("comments", new StringProperty()); - } - @Override public ConceptProposal getByUniqueId(String uniqueId) { return Context.getConceptService().getConceptProposalByUuid(uniqueId); diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptStateConversionResource2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptStateConversionResource2_0.java index 13d6398f0..4ca167494 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptStateConversionResource2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/ConceptStateConversionResource2_0.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.RefProperty; import org.openmrs.ConceptStateConversion; import org.openmrs.api.context.Context; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -87,50 +83,6 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe return description; } - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("programWorkflow", new ArrayProperty(new RefProperty("#/definitions/WorkflowGetRef"))) - .property("programWorkflowState", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateGetRef"))); - } else if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("programWorkflow", new ArrayProperty(new RefProperty("#/definitions/WorkflowGetRef"))) - .property("programWorkflowState", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateGetRef"))); - } else if (rep instanceof RefRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptGetRef")) - .property("programWorkflow", new ArrayProperty(new RefProperty("#/definitions/WorkflowGetRef"))) - .property("programWorkflowState", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateGetRef"))); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - ModelImpl model = new ModelImpl(); - if (rep instanceof DefaultRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptCreate")) - .property("programWorkflow", new ArrayProperty(new RefProperty("#/definitions/WorkflowCreate"))) - .property("programWorkflowState", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateCreate"))); - } else if (rep instanceof FullRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptCreateFull")) - .property("programWorkflow", new ArrayProperty(new RefProperty("#/definitions/WorkflowCreateFull"))) - .property("programWorkflowState", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateGet"))); - } else if (rep instanceof RefRepresentation) { - model - .property("concept", new RefProperty("#/definitions/ConceptCreate")) - .property("programWorkflow", new ArrayProperty(new RefProperty("#/definitions/WorkflowCreate"))) - .property("programWorkflowState", new ArrayProperty(new RefProperty("#/definitions/WorkflowStateCreate"))); - } - return model; - } - @Override public ConceptStateConversion newDelegate() { return new ConceptStateConversion(); diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/DatabaseChangeResource2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/DatabaseChangeResource2_0.java index 4bf7fb11e..3e9781d47 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/DatabaseChangeResource2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/DatabaseChangeResource2_0.java @@ -9,12 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.StringProperty; -import liquibase.changelog.ChangeSet; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; 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; @@ -115,33 +109,6 @@ public static String getDisplay(DatabaseUpdater.OpenMRSChangeSet instance) { return instance.getAuthor() + " " + instance.getDescription(); } - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation) { - model - .property(UUID, new StringProperty()) - .property(DISPLAY, new StringProperty()) - .property(AUTHOR, new StringProperty()) - .property(DESCRIPTION, new StringProperty()) - .property(RUN_STATUS, new EnumProperty(ChangeSet.RunStatus.class)); - } else if (rep instanceof FullRepresentation) { - model - .property(UUID, new StringProperty()) - .property(DISPLAY, new StringProperty()) - .property(AUTHOR, new StringProperty()) - .property(DESCRIPTION, new StringProperty()) - .property(RUN_STATUS, new EnumProperty(ChangeSet.RunStatus.class)) - .property(COMMENTS, new StringProperty()) - .property(RAN_DATE, new DateProperty()); - } else if (rep instanceof RefRepresentation) { - model - .property(UUID, new StringProperty()) - .property(DISPLAY, new StringProperty()); - } - return model; - } - @Override public DatabaseUpdater.OpenMRSChangeSet newDelegate() { return null; diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/PatientAllergyResource2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/PatientAllergyResource2_0.java index 4d70a749f..686017a06 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/PatientAllergyResource2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_0/PatientAllergyResource2_0.java @@ -12,12 +12,6 @@ import java.util.ArrayList; import java.util.List; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Allergy; import org.openmrs.Allergies; import org.openmrs.AllergyReaction; @@ -95,48 +89,7 @@ public DelegatingResourceDescription getCreatableProperties() { public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("display", new StringProperty()) - .property("uuid", new StringProperty()) - .property("allergen", new ObjectProperty()) //FIXME type - .property("severity", new RefProperty("#/definitions/ConceptGetRef")) - .property("comment", new StringProperty()) - .property("reactions", new ArrayProperty(new RefProperty("#/definitions/ConceptGetRef"))) - .property("patient", new RefProperty("#/definitions/PatientGetRef")); - } - if (rep instanceof FullRepresentation) { - model - .property("severity", new RefProperty("#/definitions/ConceptGet")) - .property("reactions", new ArrayProperty(new RefProperty("#/definitions/ConceptGet"))) - .property("patient", new RefProperty("#/definitions/PatientGet")); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("allergen", new ObjectProperty()) //FIXME type - .property("severity", new ObjectProperty() - .property("uuid", new StringProperty())) - .property("comment", new StringProperty()) - .property("reactions", new ArrayProperty(new ObjectProperty() - .property("allergy", new ObjectProperty().property("uuid", new StringProperty())) - .property("reaction", new ObjectProperty().property("uuid", new StringProperty())))) - - .required("allergen"); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingSubResource#getParent(java.lang.Object) */ diff --git a/omod-2.0/src/test/java/org/openmrs/module/unrelatedtest/rest/resource/UnrelatedGenericChildResource.java b/omod-2.0/src/test/java/org/openmrs/module/unrelatedtest/rest/resource/UnrelatedGenericChildResource.java index 29377bcc9..f8535db94 100644 --- a/omod-2.0/src/test/java/org/openmrs/module/unrelatedtest/rest/resource/UnrelatedGenericChildResource.java +++ b/omod-2.0/src/test/java/org/openmrs/module/unrelatedtest/rest/resource/UnrelatedGenericChildResource.java @@ -9,12 +9,13 @@ */ package org.openmrs.module.unrelatedtest.rest.resource; -import io.swagger.models.Model; import org.openmrs.module.unrelatedtest.UnrelatedGenericChild; import org.openmrs.module.webservices.rest.doc.SwaggerSpecificationCreatorTest; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.annotation.Resource; import org.openmrs.module.webservices.rest.web.representation.Representation; +import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; +import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException; import org.openmrs.module.webservices.rest.web.v1_0.test.GenericChildResource; /** @@ -25,33 +26,27 @@ @Resource(name = RestConstants.VERSION_1 + "/unrelated", supportedClass = UnrelatedGenericChild.class, supportedOpenmrsVersions = { "1.9.* - 9.*" }) public class UnrelatedGenericChildResource extends GenericChildResource { - public static boolean getGETCalled = false; + public static boolean getRepresentationDescription = false; - public static boolean getCREATECalled = false; - - public static boolean getUPDATECalled = false; - - /******************************* - * TEST METHOD IMPLEMENTATIONS * These methods are the ones we want to test against. There - * implementaion is unimportant, they just set flags so we can assert the methods were called - * correctly by the reflector. - */ + public static boolean getCreatableProperties = false; + public static boolean getUpdatableProperties = false; + @Override - public Model getGETModel(Representation rep) { - getGETCalled = true; - return super.getGETModel(rep); + public DelegatingResourceDescription getRepresentationDescription(Representation rep) { + getRepresentationDescription = true; + return new DelegatingResourceDescription(); } - + @Override - public Model getCREATEModel(Representation rep) { - getCREATECalled = true; - return super.getCREATEModel(rep); + public DelegatingResourceDescription getCreatableProperties() { + getCreatableProperties = true; + return new DelegatingResourceDescription(); } - + @Override - public Model getUPDATEModel(Representation rep) { - getUPDATECalled = true; - return super.getUPDATEModel(rep); + public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { + getUpdatableProperties = true; + return new DelegatingResourceDescription(); } } diff --git a/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/doc/SwaggerSpecificationCreatorTest.java b/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/doc/SwaggerSpecificationCreatorTest.java index 8d95d79d8..88f39e592 100644 --- a/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/doc/SwaggerSpecificationCreatorTest.java +++ b/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/doc/SwaggerSpecificationCreatorTest.java @@ -25,6 +25,7 @@ import org.dbunit.database.DatabaseConnection; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.openmrs.GlobalProperty; import org.openmrs.Patient; @@ -272,15 +273,17 @@ public void createOnlySubresourceDefinitions() { } /** + * TODO: To be fixed in follow up pull request + *

* Ensure that resources not directly related to the webservices.rest package are successfully * defined in the swagger documentation. */ - @Test + @Ignore public void testUnrelatedResourceDefinitions() { // ensure the statics are false first - UnrelatedGenericChildResource.getGETCalled = false; - UnrelatedGenericChildResource.getCREATECalled = false; - UnrelatedGenericChildResource.getUPDATECalled = false; + UnrelatedGenericChildResource.getRepresentationDescription = false; + UnrelatedGenericChildResource.getCreatableProperties = false; + UnrelatedGenericChildResource.getUpdatableProperties = false; // make sure to reset the cache for multiple tests in the same run if (SwaggerSpecificationCreator.isCached()) { @@ -291,9 +294,9 @@ public void testUnrelatedResourceDefinitions() { ssc.getJSON(); // check our custom methods were called - assertTrue(UnrelatedGenericChildResource.getGETCalled); - assertTrue(UnrelatedGenericChildResource.getCREATECalled); - assertTrue(UnrelatedGenericChildResource.getUPDATECalled); + assertTrue(UnrelatedGenericChildResource.getRepresentationDescription); + assertTrue(UnrelatedGenericChildResource.getCreatableProperties); + assertTrue(UnrelatedGenericChildResource.getUpdatableProperties); // assert the definition is now in the swagger object Swagger swagger = ssc.getSwagger(); diff --git a/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/resource/SubDetailsResource.java b/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/resource/SubDetailsResource.java index 26f76a9df..c95447f25 100644 --- a/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/resource/SubDetailsResource.java +++ b/omod-2.0/src/test/java/org/openmrs/module/webservices/rest/resource/SubDetailsResource.java @@ -9,7 +9,6 @@ */ package org.openmrs.module.webservices.rest.resource; -import io.swagger.models.Model; import org.openmrs.GlobalProperty; import org.openmrs.module.webservices.rest.doc.SwaggerSpecificationCreatorTest; import org.openmrs.module.webservices.rest.web.RequestContext; @@ -63,7 +62,12 @@ public void purge(SubDetails delegate, RequestContext context) throws ResponseEx public DelegatingResourceDescription getRepresentationDescription(Representation rep) { return new DelegatingResourceDescription(); } - + + @Override + public DelegatingResourceDescription getCreatableProperties() throws ResourceDoesNotSupportOperationException { + return new DelegatingResourceDescription(); + } + @Override public SubDetails newDelegate() { return new SubDetails(); @@ -73,9 +77,5 @@ public SubDetails newDelegate() { public SubDetails save(SubDetails delegate) { return delegate; } - - @Override - public Model getCREATEModel(Representation rep) { - return super.getGETModel(rep); - } + } diff --git a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortMembershipResource2_1.java b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortMembershipResource2_1.java index 1cc6999e0..2b5243162 100644 --- a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortMembershipResource2_1.java +++ b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortMembershipResource2_1.java @@ -11,10 +11,6 @@ import java.util.ArrayList; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.DateProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.Cohort; import org.openmrs.CohortMembership; import org.openmrs.Patient; @@ -97,37 +93,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe d.addProperty("endDate"); return d; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()) - .property("patientUuid", new StringProperty()); - } - //FIXME missing props - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("patientUuid", new StringProperty()) - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("startDate", new DateProperty()) - .property("endDate", new DateProperty()); - } - + @PropertyGetter("display") public String getDisplay(CohortMembership cohortMembership) { return "Patient in cohort (see link with rel=patient)"; diff --git a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortResource2_1.java b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortResource2_1.java index da424571f..84c22dc8a 100644 --- a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortResource2_1.java +++ b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/CohortResource2_1.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_1; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.IntegerProperty; import org.openmrs.Cohort; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.annotation.Resource; @@ -32,15 +29,7 @@ public class CohortResource2_1 extends CohortResource1_8 { public String getResourceVersion() { return RestConstants2_1.RESOURCE_VERSION; } - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - model.getProperties().remove("memberIds"); - model.property("size", new IntegerProperty()); - return model; - } - + @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { // We do not override the CohortResource1_8 representation, because we want to basically do a clean-slate diff --git a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ConceptSourceResource2_1.java b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ConceptSourceResource2_1.java index 16ca83737..624802eae 100644 --- a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ConceptSourceResource2_1.java +++ b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ConceptSourceResource2_1.java @@ -9,9 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_1; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.openmrs.ConceptSource; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.annotation.Resource; @@ -28,23 +25,7 @@ @Resource(name = RestConstants.VERSION_1 + "/conceptsource", supportedClass = ConceptSource.class, supportedOpenmrsVersions = { "2.1.* - 9.*" }) public class ConceptSourceResource2_1 extends ConceptSourceResource2_0 { - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uniqueId", new StringProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation representation) { - return ((ModelImpl) super.getCREATEModel(representation)) - .property("uniqueId", new StringProperty()); - } - + /** * @see DelegatingCrudResource#getRepresentationDescription(Representation) */ diff --git a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ObsResource2_1.java b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ObsResource2_1.java index ec7ba7398..fe82e4904 100644 --- a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ObsResource2_1.java +++ b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/ObsResource2_1.java @@ -9,10 +9,7 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_1; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; import org.openmrs.Obs; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.RestConstants; import org.openmrs.module.webservices.rest.web.annotation.Resource; import org.openmrs.module.webservices.rest.web.representation.Representation; @@ -25,21 +22,7 @@ */ @Resource(name = RestConstants.VERSION_1 + "/obs", supportedClass = Obs.class, supportedOpenmrsVersions = { "2.1.* - 9.*" }) public class ObsResource2_1 extends ObsResource1_11 { - - @Override - public Model getGETModel(Representation rep) { - return ((ModelImpl) super.getGETModel(rep)) - .property("status", new EnumProperty(Obs.Status.class)) - .property("interpretation", new EnumProperty(Obs.Interpretation.class)); - } - - @Override - public Model getCREATEModel(Representation rep) { - return ((ModelImpl) super.getCREATEModel(rep)) - .property("status", new EnumProperty(Obs.Status.class)) - .property("interpretation", new EnumProperty(Obs.Interpretation.class)); - } - + @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription description = super.getRepresentationDescription(rep); diff --git a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/PersonNameResource2_1.java b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/PersonNameResource2_1.java index 1907a621e..5bf5f565e 100644 --- a/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/PersonNameResource2_1.java +++ b/omod-2.1/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_1/PersonNameResource2_1.java @@ -9,10 +9,8 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_1; -import io.swagger.models.Model; import org.openmrs.PersonName; import org.openmrs.module.webservices.rest.web.annotation.SubResource; -import org.openmrs.module.webservices.rest.web.representation.Representation; import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription; import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_11.PersonResource1_11; import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0.PersonNameResource2_0; @@ -27,11 +25,5 @@ public DelegatingResourceDescription getCreatableProperties() { resourceDescription.getProperties().get("familyName").setRequired(false); return resourceDescription; } - - @Override - public Model getCREATEModel(Representation rep) { - Model model = super.getCREATEModel(rep); - model.getProperties().get("familyName").setRequired(false); - return model; - } + } diff --git a/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/ConditionResource2_2.java b/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/ConditionResource2_2.java index eef3438d4..e2d27d74f 100644 --- a/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/ConditionResource2_2.java +++ b/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/ConditionResource2_2.java @@ -9,10 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_2; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.openmrs.Condition; @@ -83,61 +79,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - /** - * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getGETModel(Representation) - */ - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("display", new StringProperty()) - .property("condition", new StringProperty()) - .property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("clinicalStatus", new StringProperty()) - .property("verificationStatus", new StringProperty()) - .property("previousVersion", new StringProperty()) - .property("onsetDate", new StringProperty()) - .property("endDate", new StringProperty()) - .property("additionalDetail", new StringProperty()) - .property("voided", new StringProperty()); - } - return model; - } - - /** - * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getCREATEModel(Representation) - */ - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("condition", new StringProperty()) - .property("patient", new StringProperty().example("uuid")) - .property("clinicalStatus", new StringProperty()) - .property("verificationStatus", new StringProperty()) - .property("previousVersion", new StringProperty()) - .property("onsetDate", new StringProperty()) - .property("endDate", new StringProperty()) - .property("additionalDetail", new StringProperty()); - } - - /** - * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getUPDATEModel(Representation) - */ - @Override - public Model getUPDATEModel(Representation representation) { - return new ModelImpl() - .property("condition", new StringProperty()) - .property("clinicalStatus", new StringProperty()) - .property("verificationStatus", new StringProperty()) - .property("previousVersion", new StringProperty()) - .property("onsetDate", new StringProperty()) - .property("endDate", new StringProperty()) - .property("additionalDetail", new StringProperty()) - .property("voided", new StringProperty()); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ diff --git a/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/DiagnosisResource2_2.java b/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/DiagnosisResource2_2.java index 4be563061..d265d534f 100644 --- a/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/DiagnosisResource2_2.java +++ b/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/DiagnosisResource2_2.java @@ -12,11 +12,9 @@ import java.util.Date; import org.apache.commons.lang3.StringUtils; -import org.openmrs.ConditionVerificationStatus; import org.openmrs.Diagnosis; import org.openmrs.Patient; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.ConversionUtil; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.RestConstants; @@ -34,12 +32,6 @@ import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException; import org.openmrs.module.webservices.rest.web.response.ResponseException; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8.PatientResource1_8; /** @@ -127,26 +119,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation } return null; } - - /** - * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getGETModel(Representation) - */ - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = (ModelImpl) super.getGETModel(rep); - if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { - model - .property("uuid", new StringProperty()) - .property("diagnosis", new StringProperty()) - .property("condition", new StringProperty()) - .property("certainty", new EnumProperty(ConditionVerificationStatus.class)) - .property("rank", new IntegerProperty()) - .property("patient", new RefProperty("#/definitions/PatientGetRef")) - .property("voided", new BooleanProperty()); - } - return model; - } - + /** * @param diagnosis * @return Diagnosis's name @@ -179,23 +152,7 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe return description; } - - /** - * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getCREATEModel(Representation) - */ - @Override - public Model getCREATEModel(Representation rep) { - - return new ModelImpl() - .property("diagnosis", new StringProperty()) - .property("encounter", new StringProperty()) - .property("condition", new StringProperty()) - .property("certainty", new StringProperty()) - .property("patient", new StringProperty().example("uuid")) - .property("rank", new IntegerProperty()); - } - /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getUpdatableProperties() */ @@ -212,20 +169,6 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe return description; } - - /** - * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getUPDATEModel(Representation) - */ - @Override - public Model getUPDATEModel(Representation rep) { - return new ModelImpl() - .property("diagnosis", new StringProperty()) - .property("condition", new StringProperty()) - .property("encounter", new StringProperty()) - .property("certainty", new EnumProperty(ConditionVerificationStatus.class)) - .property("rank", new IntegerProperty()) - .property("voided", new BooleanProperty()); - } @Override protected PageableResult doSearch(RequestContext context) { diff --git a/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/FulfillerDetailsResource2_2.java b/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/FulfillerDetailsResource2_2.java index 5d2bfe57a..4cd85bc2d 100644 --- a/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/FulfillerDetailsResource2_2.java +++ b/omod-2.2/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_2/FulfillerDetailsResource2_2.java @@ -9,12 +9,8 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_2; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.openmrs.Order; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.annotation.Resource; import org.openmrs.module.webservices.rest.web.annotation.SubResource; @@ -53,13 +49,6 @@ public DelegatingResourceDescription getRepresentationDescription(Representation return delegatingResourceDescription; } - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("fulfillerComment", new StringProperty()) - .property("fulfillerStatus", new EnumProperty(Order.FulfillerStatus.class)); - } - @Override public Order getParent(FulfillerDetails2_2 instance) { return instance.getOrder(); diff --git a/omod-2.3/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_3/FulfillerDetailsResource2_3.java b/omod-2.3/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_3/FulfillerDetailsResource2_3.java index c68e39b50..2d27e0efb 100644 --- a/omod-2.3/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_3/FulfillerDetailsResource2_3.java +++ b/omod-2.3/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_3/FulfillerDetailsResource2_3.java @@ -9,12 +9,8 @@ */ package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_3; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.StringProperty; import org.openmrs.Order; import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.docs.swagger.core.property.EnumProperty; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.annotation.Resource; import org.openmrs.module.webservices.rest.web.annotation.SubResource; @@ -56,14 +52,6 @@ public DelegatingResourceDescription getRepresentationDescription(Representation return delegatingResourceDescription; } - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("fulfillerComment", new StringProperty()) - .property("fulfillerStatus", new EnumProperty(Order.FulfillerStatus.class)) - .property("accessionNumber", new StringProperty()); - } - @Override public Order getParent(FulfillerDetails2_3 instance) { return instance.getOrder(); diff --git a/omod-2.5/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5.java b/omod-2.5/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5.java index 010a4ed5e..16b4049a8 100644 --- a/omod-2.5/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5.java +++ b/omod-2.5/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5.java @@ -67,21 +67,6 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe return description; } - @Override - public Model getGETModel(Representation rep) { - return addNewProperties(super.getGETModel(rep), rep); - } - - @Override - public Model getCREATEModel(Representation rep) { - return addNewProperties(super.getCREATEModel(rep), rep); - } - - @Override - public Model getUPDATEModel(Representation rep) { - return addNewProperties(super.getUPDATEModel(rep), rep); - } - private Model addNewProperties(Model model, Representation rep) { if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { ((ModelImpl) model) diff --git a/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java b/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java index d0232bf2f..c9db7de27 100644 --- a/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java +++ b/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java @@ -49,7 +49,6 @@ import org.openmrs.module.webservices.rest.web.annotation.Resource; import org.openmrs.module.webservices.rest.web.annotation.SubResource; import org.openmrs.module.webservices.rest.web.api.RestService; -import org.openmrs.module.webservices.rest.web.representation.Representation; import org.openmrs.module.webservices.rest.web.resource.api.SearchHandler; import org.openmrs.module.webservices.rest.web.resource.api.SearchParameter; import org.openmrs.module.webservices.rest.web.resource.api.SearchQuery; @@ -77,6 +76,8 @@ public class SwaggerSpecificationCreator { private static Swagger swagger; + private static String cachedJson; + private String host; private String basePath; @@ -146,14 +147,15 @@ private void BuildJSON() { } public String getJSON() { - if (isCached()) { + if (isCached() && cachedJson != null) { log.info("Returning a cached copy of Swagger specification"); - initSwagger(); - } else { - swagger = new Swagger(); - BuildJSON(); + return cachedJson; } - return createJSON(); + + swagger = new Swagger(); + BuildJSON(); + cachedJson = createJSON(); + return cachedJson; } private void addDefaultDefinitions() { @@ -832,12 +834,12 @@ private void addSubclassOperations() { Map properties = definition.getProperties(); // 2. merge subclass properties into definition - for (Map.Entry prop : resourceHandler.getGETModel(Representation.FULL).getProperties() - .entrySet()) { - if (properties.get(prop.getKey()) == null) { - properties.put(prop.getKey(), prop.getValue()); - } - } +// for (Map.Entry prop : resourceHandler.getGETModel(Representation.FULL).getProperties() +// .entrySet()) { +// if (properties.get(prop.getKey()) == null) { +// properties.put(prop.getKey(), prop.getValue()); +// } +// } // 3. update description post.setDescription("Certain properties may be required depending on type"); @@ -994,19 +996,17 @@ private void createDefinition(OperationEnum operationEnum, String resourceName, DelegatingResourceHandler resourceHandler) { String definitionName = getSchemaName(resourceName, resourceParentName, operationEnum); + System.out.println("definition-name:" + definitionName); Model model = null; Model modelRef = null; Model modelFull = null; if (definitionName.endsWith("Get")) { - model = resourceHandler.getGETModel(Representation.DEFAULT); - modelRef = resourceHandler.getGETModel(Representation.REF); - modelFull = resourceHandler.getGETModel(Representation.FULL); + //TODO: To be fixed in follow up pull request } else if (definitionName.endsWith("Create")) { - model = resourceHandler.getCREATEModel(Representation.DEFAULT); - modelFull = resourceHandler.getCREATEModel(Representation.FULL); + //TODO: To be fixed in follow up pull request } else if (definitionName.endsWith("Update")) { - model = resourceHandler.getUPDATEModel(Representation.DEFAULT); + //TODO: To be fixed in follow up pull request } if (model != null) { @@ -1025,7 +1025,6 @@ private void createDefinition(OperationEnum operationEnum, String resourceName, * @param operationName get, post, delete * @param resourceName * @param resourceParentName - * @param representation * @param operationEnum * @return */ @@ -1230,11 +1229,12 @@ public Swagger getSwagger() { * @return true if and only if swagger is not null, and its paths are also set. */ public static boolean isCached() { - return swagger != null && swagger.getPaths() != null; + return swagger != null && swagger.getPaths() != null && !swagger.getPaths().isEmpty(); } public static void clearCache() { swagger = null; + cachedJson = null; } } diff --git a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingResource.java b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingResource.java index 179b0327a..195bbfeb7 100644 --- a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingResource.java +++ b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingResource.java @@ -42,8 +42,6 @@ import org.openmrs.module.webservices.rest.web.annotation.SubClassHandler; import org.openmrs.module.webservices.rest.web.api.RestService; import org.openmrs.module.webservices.rest.web.representation.CustomRepresentation; -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.NamedRepresentation; import org.openmrs.module.webservices.rest.web.representation.RefRepresentation; import org.openmrs.module.webservices.rest.web.representation.Representation; @@ -56,12 +54,6 @@ import org.openmrs.util.OpenmrsConstants; import org.openmrs.util.OpenmrsUtil; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.ObjectProperty; -import io.swagger.models.properties.StringProperty; - /** * A base implementation of a resource or sub-resource that delegates operations to a wrapped * object. Implementations generally should extend either {@link DelegatingCrudResource} or @@ -72,35 +64,7 @@ public abstract class BaseDelegatingResource extends BaseDelegatingConverter implements Converter, Resource, DelegatingResourceHandler { private final Log log = LogFactory.getLog(getClass()); - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = new ModelImpl(); - if (rep instanceof DefaultRepresentation) { - model - .property("links", new ArrayProperty() - .items(new ObjectProperty() - .property("rel", new StringProperty().example("self|full")) - .property("uri", new StringProperty(StringProperty.Format.URI)))); - - } else if (rep instanceof FullRepresentation) { - model - .property("auditInfo", new StringProperty()) - .property("links", new ArrayProperty() - .items(new ObjectProperty() - .property("rel", new StringProperty()).example("self") - .property("uri", new StringProperty(StringProperty.Format.URI)))); - - } else if (rep instanceof RefRepresentation) { - model - .property("links", new ArrayProperty() - .items(new ObjectProperty() - .property("rel", new StringProperty().example("self")) - .property("uri", new StringProperty(StringProperty.Format.URI)))); - } - return model; - } - + protected Set propertiesIgnoredWhenUpdating = new HashSet(); /** @@ -301,12 +265,7 @@ protected T undelete(T delegate, RequestContext context) throws ResponseExceptio public DelegatingResourceDescription getCreatableProperties() throws ResourceDoesNotSupportOperationException { throw new ResourceDoesNotSupportOperationException(); } - - @Override - public Model getCREATEModel(Representation rep) { - return null; - } - + /** * Gets a description of resource's properties which can be edited. *

@@ -324,16 +283,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe } return description; } - - @Override - public Model getUPDATEModel(Representation rep) { - ModelImpl model = (ModelImpl) getCREATEModel(rep); - for (String property : getPropertiesToExposeAsSubResources()) { - model.getProperties().remove(property); - } - return model; - } - + /** * Implementations should override this method if they support sub-resources * diff --git a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingSubclassHandler.java b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingSubclassHandler.java index c7796267a..68d7d016c 100644 --- a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingSubclassHandler.java +++ b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/BaseDelegatingSubclassHandler.java @@ -9,7 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.resource.impl; -import io.swagger.models.Model; import org.openmrs.OpenmrsData; import org.openmrs.OpenmrsMetadata; import org.openmrs.api.context.Context; @@ -22,7 +21,6 @@ import org.openmrs.module.webservices.rest.web.annotation.RepHandler; import org.openmrs.module.webservices.rest.web.api.RestService; import org.openmrs.module.webservices.rest.web.representation.RefRepresentation; -import org.openmrs.module.webservices.rest.web.representation.Representation; import org.openmrs.module.webservices.rest.web.resource.api.Resource; import org.openmrs.module.webservices.rest.web.response.ConversionException; import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException; @@ -76,13 +74,8 @@ public Class getSubclassHandled() { public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { return getCreatableProperties(); } - - @Override - public Model getUPDATEModel(Representation rep) { - return getCREATEModel(rep); - } - - /** + + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#save(java.lang.Object) */ @SuppressWarnings("unchecked") diff --git a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/DelegatingResourceHandler.java b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/DelegatingResourceHandler.java index 23aa4f01d..31a48144a 100644 --- a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/DelegatingResourceHandler.java +++ b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/DelegatingResourceHandler.java @@ -9,7 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.resource.impl; -import io.swagger.models.Model; import org.openmrs.module.webservices.rest.SimpleObject; import org.openmrs.module.webservices.rest.web.RequestContext; import org.openmrs.module.webservices.rest.web.representation.Representation; @@ -89,39 +88,5 @@ public interface DelegatingResourceHandler extends DelegatingPropertyAccessor * @throws ResponseException if this resource does not support the operation */ DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException; - - /** - * Returns a {@link Model} object representing GET representation schema for the resource. - * - * @param rep representation type under which the resource {@link Model} should be fetched. It - * can take {@link Representation#DEFAULT}, {@link Representation#REF}, or - * {@link Representation#FULL} - * @return a {@link Model} object or null in case if such model does not exist or not - * documented. - */ - Model getGETModel(Representation rep); - - /** - * Returns a {@link Model} object representing CREATE representation schema for the resource. - * The returned model object will hold properties (and example values) required to create the - * underlying resource. - * - * @param rep representation type under which the resource {@link Model} should be fetched. It - * can take {@link Representation#DEFAULT}, or {@link Representation#FULL} - * @return a {@link Model} object or null in case if such model does not exist or not - * documented. - */ - Model getCREATEModel(Representation rep); - - /** - * Returns a {@link Model} object representing UPDATE representation schema for the resource. - * The returned model object will hold properties (and example values) required to update the - * underlying resource. - * - * @param rep representation type under which the resource {@link Model} should be fetched. It - * can take {@link Representation#DEFAULT}, or {@link Representation#FULL} - * @return a {@link Model} object or null in case if such model does not exist or not - * documented. - */ - Model getUPDATEModel(Representation rep); + } diff --git a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResource.java b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResource.java index bf4defa25..a6d503c53 100644 --- a/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResource.java +++ b/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResource.java @@ -11,10 +11,6 @@ import java.util.Date; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import io.swagger.models.properties.StringProperty; import org.apache.commons.lang.StringUtils; import org.openmrs.OpenmrsMetadata; import org.openmrs.api.context.Context; @@ -37,29 +33,7 @@ * @param */ public abstract class MetadataDelegatingCrudResource extends DelegatingCrudResource { - - @Override - public Model getGETModel(Representation rep) { - ModelImpl model = ((ModelImpl) super.getGETModel(rep)) - .property("uuid", new StringProperty()) - .property("display", new StringProperty()); - if (rep instanceof FullRepresentation) { - model - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .property("retired", new BooleanProperty()); - } - return model; - } - - @Override - public Model getCREATEModel(Representation rep) { - return new ModelImpl() - .property("name", new StringProperty()) - .property("description", new StringProperty()) - .required("name"); - } - + /** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingConverter#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ diff --git a/omod-common/src/test/java/org/mockingbird/test/rest/resource/CatSubclassHandler_1_9.java b/omod-common/src/test/java/org/mockingbird/test/rest/resource/CatSubclassHandler_1_9.java index 8ce4ad0ba..55191bc5b 100644 --- a/omod-common/src/test/java/org/mockingbird/test/rest/resource/CatSubclassHandler_1_9.java +++ b/omod-common/src/test/java/org/mockingbird/test/rest/resource/CatSubclassHandler_1_9.java @@ -9,7 +9,6 @@ */ package org.mockingbird.test.rest.resource; -import io.swagger.models.Model; import org.mockingbird.test.Animal; import org.mockingbird.test.Cat; import org.openmrs.module.webservices.rest.SimpleObject; @@ -89,19 +88,5 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { return null; } - - @Override - public Model getGETModel(Representation representation) { - return null; - } - - @Override - public Model getCREATEModel(Representation representation) { - return null; - } - - @Override - public Model getUPDATEModel(Representation representation) { - return null; - } + } diff --git a/omod-common/src/test/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResourceTest.java b/omod-common/src/test/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResourceTest.java index 7ff2fce86..df0e8067b 100644 --- a/omod-common/src/test/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResourceTest.java +++ b/omod-common/src/test/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResourceTest.java @@ -9,7 +9,6 @@ */ package org.openmrs.module.webservices.rest.web.resource.impl; -import io.swagger.models.Model; import org.junit.Test; import org.openmrs.Location; import org.openmrs.api.context.ServiceContext; @@ -101,21 +100,7 @@ public void purge(Location delegate, RequestContext context) throws ResponseExce public DelegatingResourceDescription getRepresentationDescription(Representation rep) { return null; } - - @Override - public Model getGETModel(Representation representation) { - return null; - } - - @Override - public Model getCREATEModel(Representation representation) { - return null; - } - - @Override - public Model getUPDATEModel(Representation representation) { - return null; - } + } }