Skip to content

Commit

Permalink
Merge pull request #120 from onaio/feature/fix_stream_close
Browse files Browse the repository at this point in the history
🐛 Fix the stream close bug caused by the REL fetch check
  • Loading branch information
dubdabasoduba authored Feb 12, 2025
2 parents 6fe8901 + c943ae1 commit ec516bf
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions exec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.smartregister</groupId>
<artifactId>opensrp-gateway-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</parent>

<artifactId>exec</artifactId>
Expand Down Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>org.smartregister</groupId>
<artifactId>plugins</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.smartregister</groupId>
<artifactId>opensrp-gateway-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</parent>

<artifactId>plugins</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.smartregister</groupId>
<artifactId>opensrp-gateway-plugin</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<packaging>pom</packaging>

<modules>
Expand Down

0 comments on commit ec516bf

Please sign in to comment.