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 1b278fafb..1554871c5 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 @@ -16,6 +16,7 @@ import org.openmrs.Diagnosis; import org.openmrs.Patient; import org.openmrs.api.context.Context; +import org.openmrs.module.ModuleUtil; 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; @@ -98,6 +99,9 @@ public void purge(Diagnosis diagnosis, RequestContext requestContext) throws Res public DelegatingResourceDescription getRepresentationDescription(Representation representation) { if (representation instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); + if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { + description.addProperty("formNamespaceAndPath"); + } description.addProperty("uuid"); description.addProperty("diagnosis", Representation.REF); description.addProperty("condition", Representation.REF); @@ -112,6 +116,9 @@ public DelegatingResourceDescription getRepresentationDescription(Representation return description; } else if (representation instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); + if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { + description.addProperty("formNamespaceAndPath"); + } description.addProperty("uuid"); description.addProperty("diagnosis"); description.addProperty("patient", Representation.REF); @@ -135,6 +142,9 @@ public DelegatingResourceDescription getRepresentationDescription(Representation public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { + if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { + model.property("formNamespaceAndPath", new StringProperty()); + } model .property("uuid", new StringProperty()) .property("diagnosis", new StringProperty()) @@ -169,7 +179,10 @@ public String getDisplayString(Diagnosis diagnosis) { @Override public DelegatingResourceDescription getCreatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = new DelegatingResourceDescription(); - + if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { + description.addProperty("formNamespaceAndPath"); + } + description.addRequiredProperty("diagnosis"); description.addRequiredProperty("encounter"); description.addRequiredProperty("condition"); @@ -185,15 +198,18 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe */ @Override public Model getCREATEModel(Representation rep) { - - return new ModelImpl() + ModelImpl model = (ModelImpl) super.getCREATEModel(rep); + if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { + model.property("formNamespaceAndPath", new StringProperty()); + } + model .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()); - + return model; } /** @@ -202,6 +218,9 @@ public Model getCREATEModel(Representation rep) { @Override public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = new DelegatingResourceDescription(); + if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { + description.addProperty("formNamespaceAndPath"); + } description.addRequiredProperty("diagnosis"); description.addRequiredProperty("condition"); description.addRequiredProperty("rank"); @@ -209,7 +228,7 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe description.addRequiredProperty("voided"); description.addRequiredProperty("certainty"); description.addRequiredProperty("encounter"); - + return description; } @@ -218,13 +237,18 @@ public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoe */ @Override public Model getUPDATEModel(Representation rep) { - return new ModelImpl() + ModelImpl model = (ModelImpl) super.getUPDATEModel(rep); + if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { + model.property("formNamespaceAndPath", new StringProperty()); + } + model .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()); + return model; } @Override diff --git a/omod-2.5/pom.xml b/omod-2.5/pom.xml deleted file mode 100644 index 871e7cac1..000000000 --- a/omod-2.5/pom.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - 4.0.0 - - webservices.rest - org.openmrs.module - 2.44.0-SNAPSHOT - - webservices.rest-omod-2.5 - jar - Rest Web Services 2.5 OMOD - OpenMRS module project for Rest Web Services - - - 2.5.0 - 1.8 - 1.8 - - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-common - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-common - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.8 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.8 - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.9 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.9 - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.10 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.10 - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.11 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-1.11 - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.0 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.0 - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.2 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.2 - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.3 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.3 - ${project.parent.version} - tests - test - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.4 - ${project.parent.version} - - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.4 - ${project.parent.version} - tests - test - - - - org.openmrs.api - openmrs-api - ${openmrs.version.2.5.0} - - - - org.openmrs.api - openmrs-api - test-jar - test - ${openmrs.version.2.5.0} - - - - org.openmrs.web - openmrs-web - ${openmrs.version.2.5.0} - - - - org.openmrs.web - openmrs-web - test-jar - test - ${openmrs.version.2.5.0} - - - - org.openmrs.test - openmrs-test - pom - test - ${openmrs.version.2.5.0} - - - - javax.servlet - javax.servlet-api - ${javaxVersion} - test - - - - org.apache.tomcat - jasper - ${apacheTomcatVersion} - provided - - - - - - - - org.jacoco - jacoco-maven-plugin - - - com.mycila - license-maven-plugin - -
${project.parent.basedir}/license-header.txt
-
-
-
-
-
\ No newline at end of file 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 deleted file mode 100644 index 30d70159e..000000000 --- a/omod-2.5/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_5; - -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.properties.BooleanProperty; -import org.openmrs.Diagnosis; -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.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.impl.BaseDelegatingResource; -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.response.ResourceDoesNotSupportOperationException; -import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_2.DiagnosisResource2_2; - -/** - * {@link Resource} for Diagnosis, supporting standard CRUD operations - */ -@Resource(name = RestConstants.VERSION_1 + "/patientdiagnoses", order = 1, supportedClass = Diagnosis.class, supportedOpenmrsVersions = { - "2.5.* - 9.*" }) -public class DiagnosisResource2_5 extends DiagnosisResource2_2 { - - /** - * @see DelegatingCrudResource#getRepresentationDescription(Representation) - */ - @Override - public DelegatingResourceDescription getRepresentationDescription(Representation rep) { - DelegatingResourceDescription description = super.getRepresentationDescription(rep); - if (description != null) { - description.addProperty("formNamespaceAndPath"); - } - return description; - } - - /** - * @see BaseDelegatingResource#getCreatableProperties() - */ - @Override - public DelegatingResourceDescription getCreatableProperties() { - DelegatingResourceDescription description = super.getCreatableProperties(); - description.addProperty("formNamespaceAndPath"); - return description; - } - - /** - * @see BaseDelegatingResource#getUpdatableProperties() - */ - @Override - public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { - DelegatingResourceDescription description = super.getUpdatableProperties(); - description.addProperty("formNamespaceAndPath"); - 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).property("formNamespaceAndPath", new BooleanProperty()._default(false)); - } - return model; - } - -} diff --git a/omod-2.5/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5Test.java b/omod-2.5/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5Test.java deleted file mode 100644 index 6321d5b61..000000000 --- a/omod-2.5/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs2_5/DiagnosisResource2_5Test.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_5; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.openmrs.Diagnosis; -import org.openmrs.api.DiagnosisService; -import org.openmrs.api.EncounterService; -import org.openmrs.api.PatientService; -import org.openmrs.api.context.Context; -import org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest; -import org.openmrs.module.webservices.rest.web.v1_0.RestTestConstants2_2; - -/** - * Tests functionality of {@link DiagnosisResource2_5}. - */ -public class DiagnosisResource2_5Test extends BaseDelegatingResourceTest { - - - private DiagnosisService diagnosisService; - - private EncounterService encounterService; - - private PatientService patientService; - - - @Before - public void before() { - this.diagnosisService = Context.getDiagnosisService(); - this.encounterService = Context.getEncounterService(); - this.patientService = Context.getPatientService(); - executeDataSet("DiagnosisResourceTestDataset.xml"); - } - - @Override - public Diagnosis newObject() { - return diagnosisService.getDiagnosisByUuid(getUuidProperty()); - } - - @Override - public String getUuidProperty() { - return RestTestConstants2_2.DIAGNOSIS_UUID; - } - - @Override - public void validateDefaultRepresentation() throws Exception { - super.validateDefaultRepresentation(); - assertPropEquals("formNamespaceAndPath", getObject().getFormNamespaceAndPath()); - } - - @Override - public void validateFullRepresentation() throws Exception { - super.validateFullRepresentation(); - assertPropEquals("formNamespaceAndPath", getObject().getFormNamespaceAndPath()); - } - - @Override - public String getDisplayProperty() { - return ""; - } - - @Test - public void testFormFieldNamespace() { - String uuid = "a303bbfb-w5w4-25d1-9f11-4f33f99d456r"; - Diagnosis diagnosis = new Diagnosis(); - diagnosis.setUuid(uuid); - diagnosis.setEncounter(encounterService.getEncounter(1)); - diagnosis.setPatient(patientService.getPatient(1)); - diagnosis.setRank(2); - - final String NAMESPACE = "namespace"; - final String FORMFIELD_PATH = "formFieldPath"; - diagnosis.setFormField(NAMESPACE, FORMFIELD_PATH); - diagnosisService.save(diagnosis); - - Diagnosis savedDiagnosis = diagnosisService.getDiagnosisByUuid(uuid); - String formFieldNameSpace = savedDiagnosis.getFormFieldNamespace(); - String formFieldPath = savedDiagnosis.getFormFieldPath(); - - Assert.assertEquals("namespace", formFieldNameSpace); - Assert.assertEquals("formFieldPath", formFieldPath); - Assert.assertNotNull(savedDiagnosis.getFormNamespaceAndPath()); - } -} diff --git a/omod-2.5/src/test/resources/DiagnosisResourceTestDataset.xml b/omod-2.5/src/test/resources/DiagnosisResourceTestDataset.xml deleted file mode 100644 index 8105dcc0e..000000000 --- a/omod-2.5/src/test/resources/DiagnosisResourceTestDataset.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/omod/pom.xml b/omod/pom.xml index ce479593e..aab184439 100644 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -143,18 +143,6 @@ tests test - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.5 - ${project.parent.version} - - - ${project.parent.groupId} - ${project.parent.artifactId}-omod-2.5 - ${project.parent.version} - tests - test - diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml index 2b0fc0cc7..0b2d6222f 100644 --- a/omod/src/main/resources/config.xml +++ b/omod/src/main/resources/config.xml @@ -50,10 +50,6 @@ /lib/webservices.rest-omod-2.4.* 2.4.* - 9.* - - /lib/webservices.rest-omod-2.5.* - 2.5.* - 9.* - diff --git a/pom.xml b/pom.xml index 6506e0ff2..b734d08d2 100644 --- a/pom.xml +++ b/pom.xml @@ -428,7 +428,6 @@ omod-2.2 omod-2.3 omod-2.4 - omod-2.5 omod integration-tests @@ -502,7 +501,6 @@ omod-2.2 omod-2.3 omod-2.4 - omod-2.5 omod integration-tests