diff --git a/exec/pom.xml b/exec/pom.xml index d20e49de..c5f30f52 100755 --- a/exec/pom.xml +++ b/exec/pom.xml @@ -4,7 +4,7 @@ org.smartregister opensrp-gateway-plugin - 3.0.0 + 3.0.1 exec @@ -70,7 +70,7 @@ org.smartregister plugins - 3.0.0 + 3.0.1 diff --git a/plugins/pom.xml b/plugins/pom.xml index b0f31f7c..d3a7b9f5 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -4,7 +4,7 @@ org.smartregister opensrp-gateway-plugin - 3.0.0 + 3.0.1 plugins diff --git a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/Constants.java b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/Constants.java index 98c1d480..783c0a23 100644 --- a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/Constants.java +++ b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/Constants.java @@ -71,6 +71,17 @@ public interface SyncStrategy { String CARE_TEAM = "CareTeam"; } + public interface ResourceType { + String LOCATION = "Location"; + } + + public interface HttpMethods { + String POST = "POST"; + String GET = "GET"; + String PUT = "PUT"; + String PATCH = "PATCH"; + } + public interface Header { @Deprecated String FHIR_GATEWAY_MODE = "fhir-gateway-mode"; String MODE = "mode"; diff --git a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java index 6ea91050..94ebb37f 100755 --- a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java +++ b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java @@ -239,7 +239,9 @@ public String postProcess(RequestDetailsReader request, HttpResponse response) resultContent = this.fhirR4JsonParser.encodeResourceToString(resultContentBundle); - } else if (Constants.SyncStrategy.RELATED_ENTITY_LOCATION.equals(syncStrategy)) { + } else if (Constants.SyncStrategy.RELATED_ENTITY_LOCATION.equals(syncStrategy) + && (Constants.HttpMethods.GET.equals(request.getRequestType().name()) + || Constants.HttpMethods.PATCH.equals(request.getRequestType().name()))) { IBaseResource responseResource = processRelatedEntityLocationSyncStrategy(request, response); @@ -253,9 +255,10 @@ public String postProcess(RequestDetailsReader request, HttpResponse response) resultContent = this.fhirR4JsonParser.encodeResourceToString(practitionerDetailsBundle); } - if (Constants.SyncStrategy.LOCATION.equals(request.getResourceName()) - && ("POST".equals(request.getRequestType().name()) - || "PUT".equals(request.getRequestType().name()))) { + if (Constants.ResourceType.LOCATION.equals(request.getResourceName()) + && (Constants.HttpMethods.POST.equals(request.getRequestType().name()) + || Constants.HttpMethods.PUT.equals(request.getRequestType().name()))) { + resultContent = new BasicResponseHandler().handleResponse(response); String requestPath = request.getRequestPath(); String locationId = getLocationId(requestPath, resultContent); diff --git a/pom.xml b/pom.xml index d769f7f9..1c9206b7 100755 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.smartregister opensrp-gateway-plugin - 3.0.0 + 3.0.1 pom