Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix the stream close bug caused by the REL fetch check #120

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -5,12 +5,7 @@

import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the use of wildcard import intentional?

import java.util.stream.Collectors;

import org.apache.commons.collections4.CollectionUtils;
Expand All @@ -19,11 +14,7 @@
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.util.TextUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.ListResource;
import org.hl7.fhir.r4.model.Location;
import org.hl7.fhir.r4.model.OperationOutcome;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.*;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the use of wildcard import intentional?

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartregister.helpers.LocationHelper;
Expand Down Expand Up @@ -239,7 +230,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 +246,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