Skip to content

Commit

Permalink
Merge pull request #171 from samply/release-7.6.2
Browse files Browse the repository at this point in the history
Release 7.6.2
  • Loading branch information
MLambarki authored Apr 11, 2022
2 parents d851780 + b34ac87 commit 64e7b7a
Show file tree
Hide file tree
Showing 8 changed files with 350 additions and 138 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [7.6.2 - 2022-04-11]
### Added
- Use log4j implementation of slf4j-api (exclude all slf4j-simple dependencies)
- Solving the problem with the nNGM POST request
- Adaptations to the new MS-nNGM profiles
- Removal of the composition profiles
- Test HttpConnector Http Clients (Jersey 3 und Apache)
- Allow false value configuration for bypass proxy for private networks property


## [7.6.1 - 2022-02-28]
### Fixed
- Add Jersey 1 libraries for JSF 2
Expand Down
67 changes: 58 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>

<artifactId>share-client</artifactId>
<version>7.6.1</version>
<version>7.6.2</version>
<packaging>war</packaging>

<name>Connector</name>
Expand Down Expand Up @@ -58,12 +58,12 @@
<properties>

<!-- Samply dependencies -->
<common-config.version>5.1.0</common-config.version>
<common-config.version>5.2.0</common-config.version>
<share-common.version>4.4.0</share-common.version>
<share-dto.version>5.2.0</share-dto.version>
<jsf-renderer.version>2.0.0</jsf-renderer.version>
<common-mailing.version>3.0.0</common-mailing.version>
<common-http.version>7.4.2</common-http.version>
<common-http.version>7.4.4</common-http.version>
<common-ldmclient.centraxx.version>6.2.0</common-ldmclient.centraxx.version>
<common-ldmclient.samplystore.biobank.version>3.0.0
</common-ldmclient.samplystore.biobank.version>
Expand Down Expand Up @@ -97,30 +97,30 @@
<datatables.version>1.11.3</datatables.version>
<twbs-pagination.version>1.4.1</twbs-pagination.version>
<jqplot.version>1.0.9.d96a669-1</jqplot.version>
<hapi.version>5.6.2</hapi.version>
<hapi.version>5.7.2</hapi.version>
<directory-sync.version>0.1.0</directory-sync.version>
<togglz.version>2.8.0</togglz.version>
<swagger-ui.version>4.1.3</swagger-ui.version>
<microprofile-openapi-api.version>3.0</microprofile-openapi-api.version>
<postgresql.version>42.3.2</postgresql.version>
<postgresql.version>42.3.3</postgresql.version>
<commons-validator.version>1.7</commons-validator.version>
<jsf.version>2.2.20</jsf.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<tink.version>1.6.1</tink.version>
<jaxb2-maven-plugin.version>2.5.0</jaxb2-maven-plugin.version>
<json-path.version>2.6.0</json-path.version>
<json-path.version>2.7.0</json-path.version>
<primefaces.version>11.0.0</primefaces.version>
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<mockito-core.version>4.2.0</mockito-core.version>
<jackson-dataformat-xml.version>2.13.1</jackson-dataformat-xml.version>
<jackson-dataformat-xml.version>2.13.2</jackson-dataformat-xml.version>

<sonar.organization>samply</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<commons-io.version>2.11.0</commons-io.version>
<log4j.version>2.17.1</log4j.version>
<log4j.version>2.17.2</log4j.version>
<slf4j.version>1.7.36</slf4j.version>

<protobuf-java.version>3.19.3</protobuf-java.version>
<protobuf-java.version>3.19.4</protobuf-java.version>

<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>

Expand Down Expand Up @@ -154,13 +154,33 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>${jackson-dataformat-xml.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.2.2</version>
</dependency>

<dependency>
<groupId>de.samply</groupId>
<artifactId>common-http</artifactId>
Expand All @@ -175,6 +195,10 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -202,6 +226,10 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -213,6 +241,10 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -244,6 +276,12 @@
<groupId>de.samply</groupId>
<artifactId>directory-sync</artifactId>
<version>${directory-sync.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- JSF 2 -->
Expand Down Expand Up @@ -289,6 +327,11 @@
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>

<!-- Third party libraries -->
<dependency>
Expand Down Expand Up @@ -468,6 +511,12 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>${hapi.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>de.samply</groupId>
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/de/samply/share/client/fhir/FhirUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ public Bundle parseBundleResource(String bundleString, MediaType mediaType)
return (Bundle) ctx.newXmlParser().parseResource(bundleString);
}
} catch (ConfigurationException | DataFormatException e) {
logger.error(e.getMessage(),e);
throw new FhirParseException("Error while parsing a " + mediaType.getSubtype() + " bundle.",
e);
throw new FhirParseException("Error while parsing a "
+ mediaType.getSubtype() + " bundle: " + e.getMessage(), e);
}
}

Expand All @@ -56,7 +55,6 @@ public String encodeResourceToJson(Resource resource) throws FhirEncodeException
try {
return ctx.newJsonParser().encodeResourceToString(resource);
} catch (DataFormatException e) {
logger.error(e.getMessage(),e);
throw new FhirEncodeException("Error while encoding a bundle to json.", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,10 @@
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpHost;
import org.apache.http.NameValuePair;
import org.apache.http.StatusLine;
import org.apache.http.client.CookieStore;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.cookie.Cookie;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Bundle;
Expand All @@ -60,13 +50,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* A connector that handles all communication with the EDC system.
*/
public class CtsConnector {

private static final Logger logger = LoggerFactory.getLogger(CtsConnector.class);
private static final String CONTENT_TYPE_CTS_FHIR_JSON = "application/fhir+json; fhirVersion=4.0";
private static final String CONTENT_TYPE_CTS_FHIR_JSON = "application/fhir+json";
private static final String X_BK_PSEUDONYM_JSONPATHS = "X-BK-pseudonym-jsonpaths";
private static final String X_BK_TARGET_URL = "X-BK-target-url";

Expand Down Expand Up @@ -128,10 +119,11 @@ public Response postPseudonmToCts(String bundleString, MediaType mediaType)
HttpEntity entity = new StringEntity(pseudonymBundleAsString, Consts.UTF_8);
HttpPost httpPost = new HttpPost(ctsBaseUrl);
httpPost.setHeader(HttpHeaders.CONTENT_TYPE, CONTENT_TYPE_CTS_FHIR_JSON);
httpPost.setHeader("X-API-KEY", apiKey);
httpPost.setHeader(HttpHeaders.AUTHORIZATION, apiKey);
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpClient.execute(httpPost);
int statusCode = response.getStatusLine().getStatusCode();
String message =
"CTS server response: statusCode:" + statusCode + "; response: " + response.toString();
Expand All @@ -141,7 +133,7 @@ public Response postPseudonmToCts(String bundleString, MediaType mediaType)
}
return Response.status(statusCode).entity(message).build();
} catch (IOException e) {
logger.error(e.getMessage(),e);
logger.error(e.getMessage(), e);
throw new IOException(e);
} finally {
closeResponse(response);
Expand All @@ -167,7 +159,7 @@ public Response postLocalPatientToCentralCts(String patient)
HttpEntity entity = new StringEntity(pseudonimisedPatient.toString(), Consts.UTF_8);
HttpPost httpPost = new HttpPost(ctsBaseUrl);
httpPost.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
httpPost.setHeader("X-API-KEY", apiKey);
httpPost.setHeader(HttpHeaders.AUTHORIZATION, apiKey);
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
Expand All @@ -181,7 +173,7 @@ public Response postLocalPatientToCentralCts(String patient)
}
return Response.status(statusCode).entity(message).build();
} catch (IOException e) {
logger.error(e.getMessage(),e);
logger.error(e.getMessage(), e);
throw new IOException(e);
} finally {
closeResponse(response);
Expand Down Expand Up @@ -220,7 +212,7 @@ public Response postLocalPatientToCentralCts(String patient,
// Set up the API call
HttpPost httpPost = new HttpPost(urlTarget);
httpPost.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
httpPost.setHeader("X-API-KEY", apiKey);
httpPost.setHeader(HttpHeaders.AUTHORIZATION, apiKey);
for (Entry<String, Object> entry : headerMapToSend.entrySet()) {
httpPost.setHeader(entry.getKey(), entry.getValue().toString());
}
Expand All @@ -247,10 +239,10 @@ public Response postLocalPatientToCentralCts(String patient,
logger.error("PostLocalPatientToCentralCts response: " + message);
return Response.status(statusCode).entity(message).build();
} catch (IOException e) {
logger.error(e.getMessage(),e);
logger.error(e.getMessage(), e);
throw new IOException(e);
} catch (StringIndexOutOfBoundsException | PathNotFoundException e) {
logger.error(e.getMessage(),e);
logger.error(e.getMessage(), e);
throw new CtsConnectorException(e.getMessage());
} finally {
closeResponse(response);
Expand Down Expand Up @@ -350,7 +342,7 @@ private String replaceIdsWithEncryptedIds(String patientJson, List<String> ids,
* @param bundle the patient bundle
* @param encrypt if the ids should encrypted or decrypted
* @return the encrypted/decrypted bundle
* @throws GeneralSecurityException GeneralSecurityException
* @throws CtsConnectorException CtsConnectorException
*/
private String cryptIds(Bundle bundle, boolean encrypt) throws CtsConnectorException {
Crypt crypt = ApplicationBean.getCrypt();
Expand Down
Loading

0 comments on commit 64e7b7a

Please sign in to comment.