From 7e82e63fc2094849e23c2d9916d6b9a1dbad2038 Mon Sep 17 00:00:00 2001 From: Jens Kristian Villadsen Date: Wed, 14 Feb 2024 08:32:27 +0100 Subject: [PATCH] added missing uninstall (#643) --- .../ig/IImplementationGuideOperationProvider.java | 4 ++++ .../ig/ImplementationGuideR4OperationProvider.java | 9 +++++++++ .../ig/ImplementationGuideR5OperationProvider.java | 11 ++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/ig/IImplementationGuideOperationProvider.java b/src/main/java/ca/uhn/fhir/jpa/starter/ig/IImplementationGuideOperationProvider.java index b35b1f660b9..13a659ef078 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/ig/IImplementationGuideOperationProvider.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/ig/IImplementationGuideOperationProvider.java @@ -20,5 +20,9 @@ static PackageInstallationSpec toPackageInstallationSpec(byte[] npmPackageAsByte // The following declaration is the one that counts but cannot be used across different versions as stating // Base64BinaryType would bind to a separate version // @Operation(name = "$install", typeName = "ImplementationGuide") + // Parameters install(@OperationParam(name = "npmContent",min = 1, max = 1) Base64BinaryType implementationGuide); + + // Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) ; + } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR4OperationProvider.java b/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR4OperationProvider.java index 145924d933d..0c9405fb8a0 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR4OperationProvider.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR4OperationProvider.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.jpa.starter.ig; import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc; +import ca.uhn.fhir.jpa.packages.PackageInstallationSpec; import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; import ca.uhn.fhir.rest.annotation.Operation; import ca.uhn.fhir.rest.annotation.OperationParam; @@ -33,4 +34,12 @@ public Parameters install( } return new Parameters(); } + + @Operation(name = "$uninstall", typeName = "ImplementationGuide") + public Parameters uninstall( + @OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) { + + packageInstallerSvc.uninstall(new PackageInstallationSpec().setName(name).setVersion(version)); + return new Parameters(); + } } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR5OperationProvider.java b/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR5OperationProvider.java index 794bf72a62f..50ba6b6eb66 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR5OperationProvider.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/ig/ImplementationGuideR5OperationProvider.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.jpa.starter.ig; import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc; +import ca.uhn.fhir.jpa.packages.PackageInstallationSpec; import ca.uhn.fhir.jpa.starter.annotations.OnR5Condition; import ca.uhn.fhir.rest.annotation.Operation; import ca.uhn.fhir.rest.annotation.OperationParam; @@ -13,7 +14,7 @@ @Conditional({OnR5Condition.class, IgConfigCondition.class}) @Service -public class ImplementationGuideR5OperationProvider { +public class ImplementationGuideR5OperationProvider implements IImplementationGuideOperationProvider { IPackageInstallerSvc packageInstallerSvc; @@ -33,4 +34,12 @@ public Parameters install( } return new Parameters(); } + + @Operation(name = "$uninstall", typeName = "ImplementationGuide") + public org.hl7.fhir.r4.model.Parameters uninstall( + @OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) { + + packageInstallerSvc.uninstall(new PackageInstallationSpec().setName(name).setVersion(version)); + return new org.hl7.fhir.r4.model.Parameters(); + } }