From 25131b13418240f1a3cb97c30fab7dfa780a237b Mon Sep 17 00:00:00 2001
From: Alexandre Pocinho <apo@kereval.com>
Date: Wed, 7 Aug 2024 11:26:30 +0200
Subject: [PATCH] Remove hardcoded mandatory targetSytem + upgrade HAPI FHIR
 version

---
 .gitlab-ci.yml                                |   2 +-
 README.md                                     |   4 +-
 .../provider/IhePatientResourceProvider.java  |  12 +-
 pom.xml                                       | 470 +++++++++---------
 4 files changed, 244 insertions(+), 244 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3c7a18a..ce38c28 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ stages:
 
 # Define global variables
 variables:
-  P_NAME: "pixm-connector"
+  P_NAME: "gazelle-pixm-connector"
   P_APP_TYPE: "java"
   P_CODE_SRC_PATH: "."
   P_MAVEN_IMAGE_TAG: "3.8.1-openjdk-17-slim"
diff --git a/README.md b/README.md
index b713a87..cc65d05 100644
--- a/README.md
+++ b/README.md
@@ -46,8 +46,8 @@ A `deployment.properties` file has to be created in folder `/opt/pixm-connector`
   PROFILE_ID_GET_ITI_83="IHE_ITI-83_GET_PIXm_Query"
   APP_HTTP_VALIDATOR_SERVER="https://{{host}}/http-validator"
   APP_IG_FHIR_SERVER="https://{{host}}/matchboxv3/fhir"
-  PIXM_PATIENT_PROFILE="https://profiles.ihe.net/ITI/PIXm/StructureDefinition/IHE.PIXm.Patient"
-  PIXM_PARAMETERS_PROFILE="https://profiles.ihe.net/ITI/PIXm/StructureDefinition/IHE.PIXm.Parameters"%
+  PIXM_PATIENT_PROFILE="http://profiles.ihe.net/ITI/PIXm/StructureDefinition/IHE.PIXm.Patient"
+  PIXM_PARAMETERS_PROFILE="http://profiles.ihe.net/ITI/PIXm/StructureDefinition/IHE.PIXm.Parameters"
 ```
 
 
diff --git a/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java b/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java
index 8ca812c..fd2fa68 100644
--- a/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java
+++ b/pixm-connector-service/src/main/java/net/ihe/gazelle/business/provider/IhePatientResourceProvider.java
@@ -267,13 +267,13 @@ public class IhePatientResourceProvider implements IResourceProvider {
 
     private List<String> createTargetSystemListFromParam(StringAndListParam targetSystemParam) {
         List<String> targetSystemList = new ArrayList<>();
-        if (targetSystemParam == null || targetSystemParam.size() == 0) {
-            throw new UnprocessableEntityException(TARGET_SYSTEM_NOT_FOUND);
-        }
-        for (StringOrListParam listParam : targetSystemParam.getValuesAsQueryTokens()) {
-            List<StringParam> queryStrings = listParam.getValuesAsQueryTokens();
-            buildTargetSystemList(queryStrings, targetSystemList);
+        if (targetSystemParam != null && targetSystemParam.size() > 0) {
+            for (StringOrListParam listParam : targetSystemParam.getValuesAsQueryTokens()) {
+                List<StringParam> queryStrings = listParam.getValuesAsQueryTokens();
+                buildTargetSystemList(queryStrings, targetSystemList);
+            }
         }
+
         return targetSystemList;
     }
 
diff --git a/pom.xml b/pom.xml
index acb6773..7e7327f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,248 +1,248 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>net.ihe.gazelle</groupId>
-    <artifactId>pixm-connector</artifactId>
-    <packaging>pom</packaging>
-    <modules>
-        <module>pixm-connector-service</module>
-        <module>matchbox-client</module>
-        <module>http-validator-client</module>
-    </modules>
-    <version>3.0.1-SNAPSHOT</version>
-    <name>Pixm Connector</name>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>net.ihe.gazelle</groupId>
+	<artifactId>pixm-connector</artifactId>
+	<packaging>pom</packaging>
+	<modules>
+		<module>pixm-connector-service</module>
+		<module>matchbox-client</module>
+		<module>http-validator-client</module>
+	</modules>
+	<version>3.0.1-SNAPSHOT</version>
+	<name>Pixm Connector</name>
 
-    <properties>
-        <allure.junit5.version>2.25.0</allure.junit5.version>
-        <allure.maven.version>2.12.0</allure.maven.version>
-        <aspectj.version>1.9.7</aspectj.version>
-        <caffeine.version>3.1.8</caffeine.version>
-        <cors.filter.version>1.0.1</cors.filter.version>
-        <cvss.score.level.tolerate>8</cvss.score.level.tolerate>
-        <dependency.check.version>5.2.4</dependency.check.version>
-        <dependency.check.skip>true</dependency.check.skip>
-        <maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
-        <nexus.url>https://gazelle.ihe.net/nexus</nexus.url>
-        <nexus.path>/content/groups/public/</nexus.path>
-        <git.user.name>gitlab-ci</git.user.name>
-        <git.user.token>changeit</git.user.token>
-        <git.project.url>
-            https://${git.user.name}:${git.user.token}@gitlab.inria.fr/gazelle/applications/test-execution/simulator/pixm-connector.git
-        </git.project.url>
-        <hapi.fhir.version>7.0.0-BETA</hapi.fhir.version>
-        <maven.release.plugin.version>2.5.3</maven.release.plugin.version>
-        <nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version>
-        <sonar.maven.plugin>3.9.0.2155</sonar.maven.plugin>
-        <java.version>17</java.version>
-        <junit.jupiter.version>5.10.1</junit.jupiter.version>
-        <jacoco.maven.plugin.version>0.8.11</jacoco.maven.plugin.version>
-        <junit.platform.commons.version>1.7.2</junit.platform.commons.version>
-        <junit.platform.launcher.version>1.7.2</junit.platform.launcher.version>
-        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
-        <maven.surefire.plugin.version>3.2.3</maven.surefire.plugin.version>
-        <mockito.core.version>5.8.0</mockito.core.version>
-        <mockito.junit.jupiter.version>5.8.0</mockito.junit.jupiter.version>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <phloc.schematron.version>2.7.1</phloc.schematron.version>
-        <java.string.similarity.version>2.0.0</java.string.similarity.version>
-        <logback.classic.version>1.4.11</logback.classic.version>
-        <javaee.api.version>8.0.1</javaee.api.version>
-        <thymeleaf.version>3.1.2.RELEASE</thymeleaf.version>
-        <ucum.version>1.0.8</ucum.version>
-        <system.stubs.jupiter.version>2.1.5</system.stubs.jupiter.version>
-        <jakarta.servlet.api.version>6.1.0-M1</jakarta.servlet.api.version>
-        <jakarta.jakartaee.api.version>10.0.0</jakarta.jakartaee.api.version>
-        <jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
-        <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
-    </properties>
+	<properties>
+		<allure.junit5.version>2.25.0</allure.junit5.version>
+		<allure.maven.version>2.12.0</allure.maven.version>
+		<aspectj.version>1.9.7</aspectj.version>
+		<caffeine.version>3.1.8</caffeine.version>
+		<cors.filter.version>1.0.1</cors.filter.version>
+		<cvss.score.level.tolerate>8</cvss.score.level.tolerate>
+		<dependency.check.version>5.2.4</dependency.check.version>
+		<dependency.check.skip>true</dependency.check.skip>
+		<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
+		<nexus.url>https://gazelle.ihe.net/nexus</nexus.url>
+		<nexus.path>/content/groups/public/</nexus.path>
+		<git.user.name>gitlab-ci</git.user.name>
+		<git.user.token>changeit</git.user.token>
+		<git.project.url>
+			https://${git.user.name}:${git.user.token}@gitlab.inria.fr/gazelle/applications/test-execution/simulator/pixm-connector.git
+		</git.project.url>
+		<hapi.fhir.version>7.2.2</hapi.fhir.version>
+		<maven.release.plugin.version>2.5.3</maven.release.plugin.version>
+		<nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version>
+		<sonar.maven.plugin>3.9.0.2155</sonar.maven.plugin>
+		<java.version>17</java.version>
+		<junit.jupiter.version>5.10.1</junit.jupiter.version>
+		<jacoco.maven.plugin.version>0.8.11</jacoco.maven.plugin.version>
+		<junit.platform.commons.version>1.7.2</junit.platform.commons.version>
+		<junit.platform.launcher.version>1.7.2</junit.platform.launcher.version>
+		<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
+		<maven.surefire.plugin.version>3.2.3</maven.surefire.plugin.version>
+		<mockito.core.version>5.8.0</mockito.core.version>
+		<mockito.junit.jupiter.version>5.8.0</mockito.junit.jupiter.version>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<phloc.schematron.version>2.7.1</phloc.schematron.version>
+		<java.string.similarity.version>2.0.0</java.string.similarity.version>
+		<logback.classic.version>1.4.11</logback.classic.version>
+		<javaee.api.version>8.0.1</javaee.api.version>
+		<thymeleaf.version>3.1.2.RELEASE</thymeleaf.version>
+		<ucum.version>1.0.8</ucum.version>
+		<system.stubs.jupiter.version>2.1.5</system.stubs.jupiter.version>
+		<jakarta.servlet.api.version>6.1.0-M1</jakarta.servlet.api.version>
+		<jakarta.jakartaee.api.version>10.0.0</jakarta.jakartaee.api.version>
+		<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
+		<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
+	</properties>
 
-    <scm>
-        <connection>scm:git:${git.project.url}</connection>
-        <url>scm:git:${git.project.url}</url>
-        <developerConnection>scm:git:${git.project.url}</developerConnection>
-        <tag>HEAD</tag>
-    </scm>
+	<scm>
+		<connection>scm:git:${git.project.url}</connection>
+		<url>scm:git:${git.project.url}</url>
+		<developerConnection>scm:git:${git.project.url}</developerConnection>
+		<tag>HEAD</tag>
+	</scm>
 
-    <repositories>
-        <repository>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-            </releases>
-            <snapshots>
-                <enabled>true</enabled>
-            </snapshots>
-            <id>IHE</id>
-            <name>IHE Public Maven Repository Group</name>
-            <url>https://gazelle.ihe.net/nexus/content/groups/public/</url>
-            <layout>default</layout>
-        </repository>
-    </repositories>
-    <distributionManagement>
-        <repository>
-            <id>nexus-releases</id>
-            <url>https://gazelle.ihe.net/nexus/content/repositories/releases</url>
-        </repository>
-    </distributionManagement>
+	<repositories>
+		<repository>
+			<releases>
+				<enabled>true</enabled>
+				<updatePolicy>always</updatePolicy>
+			</releases>
+			<snapshots>
+				<enabled>true</enabled>
+			</snapshots>
+			<id>IHE</id>
+			<name>IHE Public Maven Repository Group</name>
+			<url>https://gazelle.ihe.net/nexus/content/groups/public/</url>
+			<layout>default</layout>
+		</repository>
+	</repositories>
+	<distributionManagement>
+		<repository>
+			<id>nexus-releases</id>
+			<url>https://gazelle.ihe.net/nexus/content/repositories/releases</url>
+		</repository>
+	</distributionManagement>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <version>${jacoco-maven-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <id>pre-unit-test</id>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>post-unit-test</id>
-                        <phase>test</phase>
-                        <goals>
-                            <goal>report</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>${maven-surefire-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <id>default-test</id>
-                        <phase>test</phase>
-                        <goals>
-                            <goal>test</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.jacoco</groupId>
+				<artifactId>jacoco-maven-plugin</artifactId>
+				<version>${jacoco-maven-plugin.version}</version>
+				<executions>
+					<execution>
+						<id>pre-unit-test</id>
+						<goals>
+							<goal>prepare-agent</goal>
+						</goals>
+					</execution>
+					<execution>
+						<id>post-unit-test</id>
+						<phase>test</phase>
+						<goals>
+							<goal>report</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<version>${maven-surefire-plugin.version}</version>
+				<executions>
+					<execution>
+						<id>default-test</id>
+						<phase>test</phase>
+						<goals>
+							<goal>test</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
 
-        </plugins>
-    </build>
+		</plugins>
+	</build>
 
-    <profiles>
-        <profile>
-            <id>dev</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-        </profile>
-        <profile>
-            <id>sonar</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.sonarsource.scanner.maven</groupId>
-                        <artifactId>sonar-maven-plugin</artifactId>
-                        <version>${sonar.maven.plugin}</version>
-                        <executions>
-                            <execution>
-                                <phase>verify</phase>
-                                <goals>
-                                    <goal>sonar</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-        <profile>
-            <id>release</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.sonatype.plugins</groupId>
-                        <artifactId>nexus-staging-maven-plugin</artifactId>
-                        <version>${nexus.staging.maven.plugin.version}</version>
-                        <executions>
-                            <execution>
-                                <id>default-deploy</id>
-                                <phase>deploy</phase>
-                                <goals>
-                                    <goal>deploy</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                        <configuration>
-                            <serverId>nexus-releases</serverId>
-                            <nexusUrl>https://gazelle.ihe.net/nexus</nexusUrl>
-                            <skipStaging>true</skipStaging>
-                        </configuration>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
+	<profiles>
+		<profile>
+			<id>dev</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+		</profile>
+		<profile>
+			<id>sonar</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.sonarsource.scanner.maven</groupId>
+						<artifactId>sonar-maven-plugin</artifactId>
+						<version>${sonar.maven.plugin}</version>
+						<executions>
+							<execution>
+								<phase>verify</phase>
+								<goals>
+									<goal>sonar</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
+			<id>release</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.sonatype.plugins</groupId>
+						<artifactId>nexus-staging-maven-plugin</artifactId>
+						<version>${nexus.staging.maven.plugin.version}</version>
+						<executions>
+							<execution>
+								<id>default-deploy</id>
+								<phase>deploy</phase>
+								<goals>
+									<goal>deploy</goal>
+								</goals>
+							</execution>
+						</executions>
+						<configuration>
+							<serverId>nexus-releases</serverId>
+							<nexusUrl>https://gazelle.ihe.net/nexus</nexusUrl>
+							<skipStaging>true</skipStaging>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
 
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.mockito</groupId>
-                <artifactId>mockito-core</artifactId>
-                <version>${mockito.core.version}</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.mockito</groupId>
-                <artifactId>mockito-junit-jupiter</artifactId>
-                <version>${mockito.junit.jupiter.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>net.ihe.gazelle</groupId>
-                <artifactId>validation-jaxrs-api</artifactId>
-                <version>1.0.0</version>
-            </dependency>
-            <dependency>
-                <groupId>net.ihe.gazelle</groupId>
-                <artifactId>validation-api</artifactId>
-                <version>1.0.0</version>
-            </dependency>
-            <!-- This dependency includes the core HAPI-FHIR classes -->
-            <dependency>
-                <groupId>ca.uhn.hapi.fhir</groupId>
-                <artifactId>hapi-fhir-base</artifactId>
-                <version>${hapi.fhir.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>ca.uhn.hapi.fhir</groupId>
-                <artifactId>hapi-fhir-server</artifactId>
-                <version>${hapi.fhir.version}</version>
-            </dependency>
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.mockito</groupId>
+				<artifactId>mockito-core</artifactId>
+				<version>${mockito.core.version}</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.mockito</groupId>
+				<artifactId>mockito-junit-jupiter</artifactId>
+				<version>${mockito.junit.jupiter.version}</version>
+			</dependency>
+			<dependency>
+				<groupId>net.ihe.gazelle</groupId>
+				<artifactId>validation-jaxrs-api</artifactId>
+				<version>1.0.0</version>
+			</dependency>
+			<dependency>
+				<groupId>net.ihe.gazelle</groupId>
+				<artifactId>validation-api</artifactId>
+				<version>1.0.0</version>
+			</dependency>
+			<!-- This dependency includes the core HAPI-FHIR classes -->
+			<dependency>
+				<groupId>ca.uhn.hapi.fhir</groupId>
+				<artifactId>hapi-fhir-base</artifactId>
+				<version>${hapi.fhir.version}</version>
+			</dependency>
+			<dependency>
+				<groupId>ca.uhn.hapi.fhir</groupId>
+				<artifactId>hapi-fhir-server</artifactId>
+				<version>${hapi.fhir.version}</version>
+			</dependency>
 
-            <!-- At least one "structures" JAR must also be included -->
-            <dependency>
-                <groupId>ca.uhn.hapi.fhir</groupId>
-                <artifactId>hapi-fhir-structures-r4</artifactId>
-                <version>${hapi.fhir.version}</version>
-            </dependency>
+			<!-- At least one "structures" JAR must also be included -->
+			<dependency>
+				<groupId>ca.uhn.hapi.fhir</groupId>
+				<artifactId>hapi-fhir-structures-r4</artifactId>
+				<version>${hapi.fhir.version}</version>
+			</dependency>
 
-            <!-- Used for validation -->
-            <dependency>
-                <groupId>ca.uhn.hapi.fhir</groupId>
-                <artifactId>hapi-fhir-validation-resources-r4</artifactId>
-                <version>${hapi.fhir.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>jakarta.platform</groupId>
-                <artifactId>jakarta.jakartaee-api</artifactId>
-                <version>${jakarta.jakartaee.api.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>jakarta.servlet</groupId>
-                <artifactId>jakarta.servlet-api</artifactId>
-                <version>${jakarta.servlet.api.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.fhir</groupId>
-                <artifactId>ucum</artifactId>
-                <version>${ucum.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
+			<!-- Used for validation -->
+			<dependency>
+				<groupId>ca.uhn.hapi.fhir</groupId>
+				<artifactId>hapi-fhir-validation-resources-r4</artifactId>
+				<version>${hapi.fhir.version}</version>
+			</dependency>
+			<dependency>
+				<groupId>jakarta.platform</groupId>
+				<artifactId>jakarta.jakartaee-api</artifactId>
+				<version>${jakarta.jakartaee.api.version}</version>
+			</dependency>
+			<dependency>
+				<groupId>jakarta.servlet</groupId>
+				<artifactId>jakarta.servlet-api</artifactId>
+				<version>${jakarta.servlet.api.version}</version>
+			</dependency>
+			<dependency>
+				<groupId>org.fhir</groupId>
+				<artifactId>ucum</artifactId>
+				<version>${ucum.version}</version>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
 
 </project>
-- 
GitLab