diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java index a4c2017ece5..80283e37b3d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java @@ -25,7 +25,7 @@ public final class Msg { /** * IMPORTANT: Please update the following comment after you add a new code - * Last code value: 2023 + * Last code value: 2024 */ private Msg() {} diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/3347-add-file-support-for-loading-igs.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/3347-add-file-support-for-loading-igs.yaml new file mode 100644 index 00000000000..4d8664295ba --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/3347-add-file-support-for-loading-igs.yaml @@ -0,0 +1,4 @@ +--- +type: add +issue: 3347 +title: "Added ability to load Implementation Guide packages from filesystem by supporting the file:/ syntax of url." diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/changes.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/changes.yaml index a8c23850b6f..f67dc4444c3 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/changes.yaml +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_7_0/changes.yaml @@ -12,6 +12,7 @@
  • Guava (All): 30.1.1-jre -> 31.0.1-jre
  • JDOM (XML Patch Support): 2.0.6 -> 2.0.6.1 (Addresses CVE-2021-33813)
  • Spring (JPA): 5.3.7 -> 5.3.15
  • +
  • Spring (JPA): 5.3.7 -> 5.3.15
  • Spring-Data (JPA): 2.5.0 -> 2.6.1
  • Hibernate ORM (JPA): 5.4.30.Final -> 5.6.2.Final
  • Flyway (JPA): 6.5.4 -> 8.4.1
  • @@ -26,6 +27,8 @@
  • Spring Boot (Boot): 2.5.0 -> 2.6.2
  • Swagger UI (OpenAPI): 3.46.0 -> 4.1.3
  • Resteasy (JAX-RS): 4.0.0.Beta3 -> 5.0.2.Final
  • +
  • Postgresql (JPA): 42.3.1 -> 42.3.2
  • +
  • Spring Security Oauth2(Oauth): 2.0.2.RELEASE -> 2.0.17.RELEASE
  • " diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java index 67fc194a738..3d7ddd25c6c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java @@ -88,7 +88,11 @@ import javax.transaction.Transactional; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -473,7 +477,14 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac protected byte[] loadPackageUrlContents(String thePackageUrl) { if (thePackageUrl.startsWith("classpath:")) { - return ClasspathUtil.loadResourceAsByteArray(thePackageUrl.substring("classpath:".length())); + return ClasspathUtil.loadResourceAsByteArray(thePackageUrl.substring("classpath:" .length())); + } else if (thePackageUrl.startsWith("file:")) { + try { + byte[] bytes = Files.readAllBytes(Paths.get(new URI(thePackageUrl))); + return bytes; + } catch (IOException | URISyntaxException e) { + throw new InternalErrorException(Msg.code(2024) + "Error loading \"" + thePackageUrl + "\": " + e.getMessage()); + } } else { HttpClientConnectionManager connManager = new BasicHttpClientConnectionManager(); try (CloseableHttpResponse request = HttpClientBuilder diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java index eada70a648e..2a1552f7ed9 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java @@ -59,6 +59,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -924,20 +926,39 @@ public class NpmR4Test extends BaseJpaR4Test { map.add(StructureDefinition.SP_URL, new UriParam("https://www.medizininformatik-initiative.de/fhir/core/modul-labor/StructureDefinition/LogicalModel/Laborbefund")); IBundleProvider result = myStructureDefinitionDao.search(map); assertEquals(1, result.sizeOrThrowNpe()); - List resources = result.getResources(0,1); - assertFalse(((StructureDefinition)resources.get(0)).hasSnapshot()); + List resources = result.getResources(0, 1); + assertFalse(((StructureDefinition) resources.get(0)).hasSnapshot()); // Confirm that DiagnosticLab (a resource StructureDefinition with differential but no snapshot) was created with a generated snapshot. map = SearchParameterMap.newSynchronous(); map.add(StructureDefinition.SP_URL, new UriParam("https://www.medizininformatik-initiative.de/fhir/core/modul-labor/StructureDefinition/DiagnosticReportLab")); result = myStructureDefinitionDao.search(map); assertEquals(1, result.sizeOrThrowNpe()); - resources = result.getResources(0,1); - assertTrue(((StructureDefinition)resources.get(0)).hasSnapshot()); + resources = result.getResources(0, 1); + assertTrue(((StructureDefinition) resources.get(0)).hasSnapshot()); }); } + @Test + public void testInstallR4PackageFromFile() { + + Path currentRelativePath = Paths.get(""); + String s = currentRelativePath.toAbsolutePath().toString(); + System.out.println("Current absolute path is: " + s); + + String fileUrl = "file:" + s + "/src/test/resources/packages/de.basisprofil.r4-1.2.0.tgz"; + + myPackageInstallerSvc.install(new PackageInstallationSpec() + .setName("de.basisprofil.r4") + .setVersion("1.2.0") + .setPackageUrl(fileUrl) + ); + runInTransaction(() -> { + assertTrue(myPackageVersionDao.findByPackageIdAndVersion("de.basisprofil.r4", "1.2.0").isPresent()); + }); + } + static class FakeNpmServlet extends HttpServlet { private final Map myResponses = new HashMap<>(); diff --git a/hapi-fhir-jpaserver-base/src/test/resources/packages/de.basisprofil.r4-1.2.0.tgz b/hapi-fhir-jpaserver-base/src/test/resources/packages/de.basisprofil.r4-1.2.0.tgz new file mode 100644 index 00000000000..14ff91a48f2 Binary files /dev/null and b/hapi-fhir-jpaserver-base/src/test/resources/packages/de.basisprofil.r4-1.2.0.tgz differ diff --git a/hapi-fhir-oauth2/pom.xml b/hapi-fhir-oauth2/pom.xml index 128e87b5a6c..f4696c30639 100644 --- a/hapi-fhir-oauth2/pom.xml +++ b/hapi-fhir-oauth2/pom.xml @@ -36,7 +36,7 @@ org.springframework.security.oauth spring-security-oauth2 - 2.0.2.RELEASE + 2.0.17.RELEASE diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index 2f2b53361f9..6d1979afda2 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -188,7 +188,7 @@ org.apache.ant ant - 1.10.10 + 1.10.11 diff --git a/pom.xml b/pom.xml index c3686c2540f..e6b0aca0ff1 100644 --- a/pom.xml +++ b/pom.xml @@ -852,7 +852,7 @@ UTF-8 1.0.1 - 1.24.0 + 1.28.4 1.5.1 1.2.0 @@ -1716,7 +1716,7 @@ org.postgresql postgresql - 42.3.1 + 42.3.2 org.quartz-scheduler diff --git a/vagrant/chef/cookbooks/apt/Gemfile b/vagrant/chef/cookbooks/apt/Gemfile index e1b8fa0e3be..1c021016eff 100644 --- a/vagrant/chef/cookbooks/apt/Gemfile +++ b/vagrant/chef/cookbooks/apt/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' group :lint do gem 'foodcritic', '~> 3.0' - gem 'rubocop', '~> 0.23' + gem 'rubocop', '~> 0.49.0' gem 'rainbow', '< 2.0' end diff --git a/vagrant/chef/cookbooks/java/Gemfile b/vagrant/chef/cookbooks/java/Gemfile index c874ab20f13..74fb5ddfec9 100644 --- a/vagrant/chef/cookbooks/java/Gemfile +++ b/vagrant/chef/cookbooks/java/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' gem 'berkshelf', '~> 2.0' gem 'chefspec', '~> 3.1' gem 'foodcritic', '~> 3.0' -gem 'rubocop', '~> 0.12' +gem 'rubocop', '~> 0.49.0' group :integration do gem 'test-kitchen', '~> 1.2.1'