diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index ac1ede75193..7c58e6bb409 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -91,11 +91,6 @@ hapi-fhir-validation-resources-r4 ${project.version} - - ${project.groupId} - hapi-fhir-igpacks - ${project.version} - ${project.groupId} hapi-fhir-jpaserver-model diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index 0e81dae9734..a23b30eccf9 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -33,11 +33,6 @@ jar classes - - ca.uhn.hapi.fhir - hapi-fhir-igpacks - ${project.version} - ca.uhn.hapi.fhir hapi-fhir-jpaserver-migrate diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseApp.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseApp.java index 6d20c21779e..082e973c763 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseApp.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseApp.java @@ -169,7 +169,6 @@ public abstract class BaseApp { commands.add(new ValidationDataUploader()); commands.add(new WebsocketSubscribeCommand()); commands.add(new UploadTerminologyCommand()); - commands.add(new IgPackUploader()); commands.add(new ExportConceptMapToCsvCommand()); commands.add(new ImportCsvToConceptMapCommand()); commands.add(new HapiFlywayMigrateDatabaseCommand()); diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java deleted file mode 100644 index 17ca4c9b26c..00000000000 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java +++ /dev/null @@ -1,116 +0,0 @@ -package ca.uhn.fhir.cli; - -/*- - * #%L - * HAPI FHIR - Command Line Client - API - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.igpacks.parser.IgPackParserDstu3; -import ca.uhn.fhir.rest.client.api.IGenericClient; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; -import org.hl7.fhir.dstu3.model.StructureDefinition; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IPrimitiveType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Collection; - -public class IgPackUploader extends BaseCommand { - // TODO: Don't use qualified names for loggers in HAPI CLI. - private static final Logger ourLog = LoggerFactory.getLogger(IgPackUploader.class); - - @Override - public String getCommandDescription() { - return "Uploads an Implementation Guide Validation Pack"; - } - - @Override - public String getCommandName() { - return "upload-igpack"; - } - - @Override - public Options getOptions() { - Options options = new Options(); - addFhirVersionOption(options); - - Option opt = new Option("t", "target", true, "Base URL for the target server (e.g. \"http://example.com/fhir\")"); - opt.setRequired(false); - options.addOption(opt); - - opt = new Option("u", "url", true, "The URL to the validation.pack file, e.g. http://hl7.org/fhir/us/core/validator.pack"); - opt.setRequired(true); - options.addOption(opt); - - return options; - } - - @Override - public void run(CommandLine theCommandLine) throws ParseException{ - parseFhirContext(theCommandLine); - - IGenericClient client = newClient(theCommandLine); - - String url = theCommandLine.getOptionValue("u"); - - Collection files = null; - try { - files = loadFile(url, null, false); - } catch (IOException e) { - throw new CommandFailureException(e); - } - - for (File nextFile : files) { - FhirContext ctx = getFhirContext(); - switch (ctx.getVersion().getVersion()) { - case DSTU3: - IgPackParserDstu3 packParser = new IgPackParserDstu3(ctx); - IValidationSupport ig = null; - try { - ig = packParser.parseIg(new FileInputStream(nextFile), nextFile.getName()); - } catch (FileNotFoundException e) { - throw new CommandFailureException(e); - } - Iterable conformanceResources = ig.fetchAllConformanceResources(); - for (IBaseResource nextResource : conformanceResources) { - String nextResourceUrl = ((IPrimitiveType)ctx.newTerser().getSingleValueOrNull(nextResource, "url")).getValueAsString(); - ourLog.info("Uploading resource: {}", nextResourceUrl); - client - .update() - .resource(nextResource) - .conditional() - .and(StructureDefinition.URL.matches().value(nextResourceUrl)) - .execute(); - } - break; - default: - throw new ParseException("This command does not support FHIR version " + ctx.getVersion().getVersion()); - } - } - } -} diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java index efc48664636..fad2d8a955f 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java @@ -23,10 +23,7 @@ package ca.uhn.fhir.cli; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.DefaultProfileValidationSupport; import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.igpacks.parser.IgPackParserDstu2; -import ca.uhn.fhir.igpacks.parser.IgPackParserDstu3; import ca.uhn.fhir.parser.DataFormatException; -import ca.uhn.fhir.parser.LenientErrorHandler; import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.SingleValidationMessage; import ca.uhn.fhir.validation.ValidationResult; @@ -147,25 +144,11 @@ public class ValidateCommand extends BaseCommand { localProfileResource = ca.uhn.fhir.rest.api.EncodingEnum.detectEncodingNoDefault(input).newParser(ctx).parseResource(input); } - byte[] igPack = null; - String igpackFilename = null; - if (theCommandLine.hasOption("igpack")) { - igpackFilename = theCommandLine.getOptionValue("igpack"); - igPack = loadFileAsByteArray(igpackFilename); - } - if (theCommandLine.hasOption("p")) { switch (ctx.getVersion().getVersion()) { case DSTU2: { ValidationSupportChain validationSupport = new ValidationSupportChain( new DefaultProfileValidationSupport(ctx), new InMemoryTerminologyServerValidationSupport(ctx)); - if (igPack != null) { - FhirContext hl7orgCtx = FhirContext.forDstu2Hl7Org(); - hl7orgCtx.setParserErrorHandler(new LenientErrorHandler(false)); - IgPackParserDstu2 parser = new IgPackParserDstu2(hl7orgCtx); - IValidationSupport igValidationSupport = parser.parseIg(igPack, igpackFilename); - validationSupport.addValidationSupport(igValidationSupport); - } if (theCommandLine.hasOption("r")) { validationSupport.addValidationSupport((IValidationSupport) new LoadingValidationSupportDstu2()); @@ -180,11 +163,6 @@ public class ValidateCommand extends BaseCommand { FhirInstanceValidator instanceValidator = new FhirInstanceValidator(ctx); val.registerValidatorModule(instanceValidator); ValidationSupportChain validationSupport = new ValidationSupportChain(new DefaultProfileValidationSupport(ctx), new InMemoryTerminologyServerValidationSupport(ctx)); - if (igPack != null) { - IgPackParserDstu3 parser = new IgPackParserDstu3(getFhirContext()); - IValidationSupport igValidationSupport = parser.parseIg(igPack, igpackFilename); - validationSupport.addValidationSupport(igValidationSupport); - } if (theCommandLine.hasOption("r")) { validationSupport.addValidationSupport((IValidationSupport) new LoadingValidationSupportDstu3()); diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/InstallIgPackTest.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/InstallIgPackTest.java deleted file mode 100644 index 3bb24dcd1c1..00000000000 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/InstallIgPackTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package ca.uhn.fhir.cli; - -import org.junit.jupiter.api.Test; - -public class InstallIgPackTest { - - @Test - public void testInstallIgPack() { - - } - - -} diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ValidateCommandTest.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ValidateCommandTest.java index 92729e49db3..6b10c9f2bf7 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ValidateCommandTest.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/ValidateCommandTest.java @@ -1,11 +1,8 @@ package ca.uhn.fhir.cli; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.fail; - public class ValidateCommandTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ValidateCommandTest.class); @@ -25,38 +22,4 @@ public class ValidateCommandTest { "-p", "-n", resourcePath}); } - - @Test - @Disabled - public void testValidateUsingIgPackSucceedingDstu2() { - String resourcePath = ValidateCommandTest.class.getResource("/argo-dstu2-observation-good.json").getFile(); - ourLog.info(resourcePath); - - App.main(new String[] { - "validate", - "-v", "dstu2", - "-p", - "--igpack", "src/test/resources/argo-dstu2.pack", - "-n", resourcePath}); - } - - @Test - public void testValidateUsingIgPackFailingDstu2() { - String resourcePath = ValidateCommandTest.class.getResource("/argo-dstu2-observation-bad.json").getFile(); - ourLog.info(resourcePath); - - try { - App.main(new String[] { - "validate", - "-v", "dstu2", - "-p", - "--igpack", "src/test/resources/argo-dstu2.pack", - "-n", resourcePath}); - // Should not get here - fail(); - } catch (CommandFailureException e) { - // good - } - } - } diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2229-remove-upload-igpack-command.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2229-remove-upload-igpack-command.yaml new file mode 100644 index 00000000000..33ca9df4dc5 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2229-remove-upload-igpack-command.yaml @@ -0,0 +1,4 @@ +--- +type: remove +issue: 2229 +title: "Remove support for the `upload-igpack` command. This command is no longer supported, as the IGPack format has been withdrawn and replaced with the FHIR NPM Package specification, which is also supported by HAPI FHIR" diff --git a/hapi-fhir-igpacks/pom.xml b/hapi-fhir-igpacks/pom.xml deleted file mode 100644 index a7decf39576..00000000000 --- a/hapi-fhir-igpacks/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - hapi-deployable-pom - ca.uhn.hapi.fhir - 5.3.0-SNAPSHOT - ../hapi-deployable-pom/pom.xml - - 4.0.0 - - hapi-fhir-igpacks - - - - ca.uhn.hapi.fhir - hapi-fhir-base - ${project.version} - - - ca.uhn.hapi.fhir - hapi-fhir-jpaserver-base - ${project.version} - - - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu3 - ${project.version} - true - - - - ch.qos.logback - logback-classic - - - - - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - - true - - - - org.jacoco - jacoco-maven-plugin - - true - - - - default-prepare-agent - - prepare-agent - - - - - - - - diff --git a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/BaseIgPackParser.java b/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/BaseIgPackParser.java deleted file mode 100644 index 9b8ee7f79df..00000000000 --- a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/BaseIgPackParser.java +++ /dev/null @@ -1,166 +0,0 @@ -package ca.uhn.fhir.igpacks.parser; - -/*- - * #%L - * hapi-fhir-igpacks - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; -import ca.uhn.fhir.parser.LenientErrorHandler; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; -import ca.uhn.fhir.util.StopWatch; -import org.apache.commons.lang3.Validate; -import org.hl7.fhir.dstu3.model.IdType; -import org.hl7.fhir.dstu3.model.ImplementationGuide; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IIdType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -public abstract class BaseIgPackParser { - - private static final Logger ourLog = LoggerFactory.getLogger(BaseIgPackParser.class); - private final FhirContext myCtx; - - public BaseIgPackParser(FhirContext theCtx) { - FhirVersionEnum expectedVersion = provideExpectedVersion(); - Validate.isTrue(theCtx.getVersion().getVersion() == expectedVersion, "theCtx is not for the correct version, expecting " + expectedVersion); - - myCtx = theCtx; - } - - public FhirContext getCtx() { - return myCtx; - } - - protected abstract T createValidationSupport(Map theIgResources); - - private IBaseResource findResource(Map theCandidateResources, IIdType theId) { - IBaseResource retVal = theCandidateResources.get(theId.toUnqualifiedVersionless().getValue()); - if (retVal == null) { - throw new InternalErrorException("Unknown reference in ImplementationGuide: " + theId); - } - return retVal; - } - - /** - * @param theIgInputStream The "validator.pack" ZIP file - * @param theDescription A description (just used for logs) - */ - public T parseIg(InputStream theIgInputStream, String theDescription) { - Validate.notNull(theIgInputStream, "theIdInputStream must not be null"); - String igResourceName = "ImplementationGuide-ig.json"; - - ourLog.info("Parsing IGPack: {}", theDescription); - StopWatch sw = new StopWatch(); - - ZipInputStream zipInputStream = new ZipInputStream(theIgInputStream); - ZipEntry entry; - try { - - Map candidateResources = new HashMap<>(); - Map igResources = new HashMap<>(); - - while ((entry = zipInputStream.getNextEntry()) != null) { - if (entry.getName().endsWith(".json")) { - - IBaseResource parsed; - InputStreamReader nextReader = new InputStreamReader(zipInputStream, Constants.CHARSET_UTF8); - - if (entry.getName().equals(igResourceName)) { - parsed = FhirContext.forDstu3().newJsonParser().parseResource(ImplementationGuide.class, nextReader); - } else { - LenientErrorHandler errorHandler = new LenientErrorHandler(); - errorHandler.setErrorOnInvalidValue(false); - parsed = myCtx.newJsonParser().setParserErrorHandler(errorHandler).parseResource(nextReader); - } - - candidateResources.put(entry.getName(), parsed); - } - } - - ourLog.info("Parsed {} candidateResources in {}ms", candidateResources.size(), sw.getMillis()); - - ImplementationGuide ig = (ImplementationGuide) candidateResources.get(igResourceName); - - if (ig == null) { - throw new InternalErrorException("IG Pack '" + theDescription + "' does not contain a resource named: " + igResourceName); - } - - HashMap newCandidateResources = new HashMap<>(); - for (IBaseResource next : candidateResources.values()) { - newCandidateResources.put(next.getIdElement().toUnqualifiedVersionless().getValue(), next); - } - candidateResources = newCandidateResources; - - for (ImplementationGuide.ImplementationGuidePackageComponent nextPackage : ig.getPackage()) { - ourLog.info("Processing package {}", nextPackage.getName()); - - for (ImplementationGuide.ImplementationGuidePackageResourceComponent nextResource : nextPackage.getResource()) { - if (isNotBlank(nextResource.getSourceReference().getReference())) { - IdType id = new IdType(nextResource.getSourceReference().getReference()); - if (isNotBlank(id.getResourceType())) { - switch (id.getResourceType()) { - case "CodeSystem": - case "ConceptMap": - case "StructureDefinition": - case "ValueSet": - IBaseResource resource = findResource(candidateResources, id); - igResources.put(id.toUnqualifiedVersionless(), resource); - break; - } - } - } - } - - } - - ourLog.info("IG contains {} resources", igResources.size()); - return createValidationSupport(igResources); - - } catch (Exception e) { - throw new InternalErrorException("Failure while parsing IG: " + e, e); - } - - - } - - /** - * @param theIgPack The "validator.pack" ZIP file - * @param theDescription A description (just used for logs) - */ - public T parseIg(byte[] theIgPack, String theDescription) { - return parseIg(new ByteArrayInputStream(theIgPack), theDescription); - } - - protected abstract FhirVersionEnum provideExpectedVersion(); - -} diff --git a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackParserDstu2.java b/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackParserDstu2.java deleted file mode 100644 index 5b6f54c8861..00000000000 --- a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackParserDstu2.java +++ /dev/null @@ -1,56 +0,0 @@ -package ca.uhn.fhir.igpacks.parser; - -/*- - * #%L - * hapi-fhir-igpacks - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; -import ca.uhn.fhir.context.support.IValidationSupport; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IIdType; - -import java.util.Map; - -public class IgPackParserDstu2 extends BaseIgPackParser { - - public IgPackParserDstu2(FhirContext theCtx) { - super(massage(theCtx)); - } - - @Override - protected IValidationSupport createValidationSupport(Map theIgResources) { - return new IgPackValidationSupportDstu2(getCtx(), theIgResources); - } - - @Override - protected FhirVersionEnum provideExpectedVersion() { - return FhirVersionEnum.DSTU2_HL7ORG; - } - - private static FhirContext massage(FhirContext theCtx) { - if (theCtx.getVersion().getVersion() == FhirVersionEnum.DSTU2) { - return FhirContext.forDstu2Hl7Org(); - } else { - return theCtx; - } - } - -} diff --git a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackParserDstu3.java b/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackParserDstu3.java deleted file mode 100644 index 075646b0204..00000000000 --- a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackParserDstu3.java +++ /dev/null @@ -1,48 +0,0 @@ -package ca.uhn.fhir.igpacks.parser; - -/*- - * #%L - * hapi-fhir-igpacks - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; -import ca.uhn.fhir.context.support.IValidationSupport; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IIdType; - -import java.util.Map; - -public class IgPackParserDstu3 extends BaseIgPackParser { - - public IgPackParserDstu3(FhirContext theCtx) { - super(theCtx); - } - - @Override - protected IValidationSupport createValidationSupport(Map theIgResources) { - return new IgPackValidationSupportDstu3(getCtx(), theIgResources); - } - - @Override - protected FhirVersionEnum provideExpectedVersion() { - return FhirVersionEnum.DSTU3; - } - -} diff --git a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackValidationSupportDstu2.java b/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackValidationSupportDstu2.java deleted file mode 100644 index 9dd922dd703..00000000000 --- a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackValidationSupportDstu2.java +++ /dev/null @@ -1,88 +0,0 @@ -package ca.uhn.fhir.igpacks.parser; - -/*- - * #%L - * hapi-fhir-igpacks - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.context.support.ValidationSupportContext; -import org.hl7.fhir.dstu2.model.ConceptMap; -import org.hl7.fhir.dstu2.model.StructureDefinition; -import org.hl7.fhir.dstu2.model.ValueSet; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IIdType; - -import java.util.Map; - -public class IgPackValidationSupportDstu2 implements IValidationSupport { - private final Map myIgResources; - private FhirContext myCtx; - - public IgPackValidationSupportDstu2(FhirContext theCtx, Map theIgResources) { - myCtx = theCtx; - myIgResources = theIgResources; - } - - - - @Override - public T fetchResource(Class theClass, String theUri) { - for (Map.Entry next : myIgResources.entrySet()) { - if (theClass.equals(ConceptMap.class)) { - if (theClass.isAssignableFrom(next.getValue().getClass())) { - ConceptMap sd = ((ConceptMap) next.getValue()); - if (sd.getUrl().equals(theUri)) { - return (T) sd; - } - } - } - if (theClass.equals(StructureDefinition.class)) { - if (theClass.isAssignableFrom(next.getValue().getClass())) { - StructureDefinition sd = ((StructureDefinition) next.getValue()); - if (sd.getUrl().equals(theUri)) { - return (T) sd; - } - } - } - if (theClass.equals(ValueSet.class)) { - if (theClass.isAssignableFrom(next.getValue().getClass())) { - ValueSet sd = ((ValueSet) next.getValue()); - if (sd.getUrl().equals(theUri)) { - return (T) sd; - } - } - } - } - - return null; - } - - - @Override - public boolean isCodeSystemSupported(ValidationSupportContext theValidationSupportContext, String theSystem) { - return false; - } - - @Override - public FhirContext getFhirContext() { - return myCtx; - } - -} diff --git a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackValidationSupportDstu3.java b/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackValidationSupportDstu3.java deleted file mode 100644 index 61efc0ee630..00000000000 --- a/hapi-fhir-igpacks/src/main/java/ca/uhn/fhir/igpacks/parser/IgPackValidationSupportDstu3.java +++ /dev/null @@ -1,124 +0,0 @@ -package ca.uhn.fhir.igpacks.parser; - -/*- - * #%L - * hapi-fhir-igpacks - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.support.ConceptValidationOptions; -import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.context.support.ValidationSupportContext; -import org.hl7.fhir.dstu3.model.CodeSystem; -import org.hl7.fhir.dstu3.model.ConceptMap; -import org.hl7.fhir.dstu3.model.StructureDefinition; -import org.hl7.fhir.dstu3.model.ValueSet; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IIdType; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class IgPackValidationSupportDstu3 implements IValidationSupport { - private final Map myIgResources; - private FhirContext myCtx; - - public IgPackValidationSupportDstu3(FhirContext theCtx, Map theIgResources) { - myIgResources = theIgResources; - myCtx = theCtx; - } - - - @Override - public List fetchAllConformanceResources() { - return new ArrayList<>(myIgResources.values()); - } - - - @Override - public ValueSet fetchValueSet(String theSystem) { - return fetchResource(ValueSet.class, theSystem); - } - - @Override - public T fetchResource(Class theClass, String theUri) { - for (Map.Entry next : myIgResources.entrySet()) { - if (theClass.equals(CodeSystem.class)) { - if (theClass.isAssignableFrom(next.getValue().getClass())) { - CodeSystem sd = ((CodeSystem) next.getValue()); - if (sd.getUrl().equals(theUri)) { - return (T) sd; - } - } - } - if (theClass.equals(ConceptMap.class)) { - if (theClass.isAssignableFrom(next.getValue().getClass())) { - ConceptMap sd = ((ConceptMap) next.getValue()); - if (sd.getUrl().equals(theUri)) { - return (T) sd; - } - } - } - if (theClass.equals(StructureDefinition.class)) { - if (theClass.isAssignableFrom(next.getValue().getClass())) { - StructureDefinition sd = ((StructureDefinition) next.getValue()); - if (sd.getUrl().equals(theUri)) { - return (T) sd; - } - } - } - if (theClass.equals(ValueSet.class)) { - if (theClass.isAssignableFrom(next.getValue().getClass())) { - ValueSet sd = ((ValueSet) next.getValue()); - if (sd.getUrl().equals(theUri)) { - return (T) sd; - } - } - } - } - - return null; - } - - @Override - public StructureDefinition fetchStructureDefinition(String theUrl) { - return fetchResource(StructureDefinition.class, theUrl); - } - - @Override - public boolean isCodeSystemSupported(ValidationSupportContext theValidationSupportContext, String theSystem) { - return false; - } - - @Override - public CodeValidationResult validateCode(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl) { - return null; - } - - @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { - return null; - } - - @Override - public FhirContext getFhirContext() { - return myCtx; - } - -} diff --git a/hapi-fhir-igpacks/src/test/java/ca/uhn/fhir/igpack/parser/IgPackParserDstu3Test.java b/hapi-fhir-igpacks/src/test/java/ca/uhn/fhir/igpack/parser/IgPackParserDstu3Test.java deleted file mode 100644 index 84b263dafe3..00000000000 --- a/hapi-fhir-igpacks/src/test/java/ca/uhn/fhir/igpack/parser/IgPackParserDstu3Test.java +++ /dev/null @@ -1,30 +0,0 @@ -package ca.uhn.fhir.igpack.parser; - - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.igpacks.parser.IgPackParserDstu3; -import org.hl7.fhir.dstu3.model.ValueSet; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public class IgPackParserDstu3Test { - private static final Logger ourLog = LoggerFactory.getLogger(IgPackParserDstu3Test.class); - - @Test - public void testParseIg() { - - FhirContext ctx = FhirContext.forDstu3(); - IgPackParserDstu3 igParser = new IgPackParserDstu3(ctx); - - IValidationSupport result = igParser.parseIg(IgPackParserDstu3Test.class.getResourceAsStream("/us-core-stu3-validator.pack"), "US-Core STU3"); - - assertNotNull(result.fetchResource(ValueSet.class, "http://hl7.org/fhir/us/core/ValueSet/simple-language")); - assertEquals(50, result.fetchAllConformanceResources().size()); - } - -} diff --git a/hapi-fhir-igpacks/src/test/resources/argo-dstu2.pack b/hapi-fhir-igpacks/src/test/resources/argo-dstu2.pack deleted file mode 100644 index 0672174b27e..00000000000 Binary files a/hapi-fhir-igpacks/src/test/resources/argo-dstu2.pack and /dev/null differ diff --git a/hapi-fhir-igpacks/src/test/resources/logback-test.xml b/hapi-fhir-igpacks/src/test/resources/logback-test.xml deleted file mode 100644 index e5cbbb9c22e..00000000000 --- a/hapi-fhir-igpacks/src/test/resources/logback-test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} [%file:%line] - %msg%n - - - - - - - - - - - - - - - - - - - - - diff --git a/hapi-fhir-igpacks/src/test/resources/us-core-stu3-validator.pack b/hapi-fhir-igpacks/src/test/resources/us-core-stu3-validator.pack deleted file mode 100644 index 3c027fe61c6..00000000000 Binary files a/hapi-fhir-igpacks/src/test/resources/us-core-stu3-validator.pack and /dev/null differ diff --git a/pom.xml b/pom.xml index 7a476466b86..5651537fca7 100644 --- a/pom.xml +++ b/pom.xml @@ -2530,7 +2530,6 @@ hapi-fhir-validation-resources-r4 hapi-fhir-structures-r5 hapi-fhir-validation-resources-r5 - hapi-fhir-igpacks hapi-fhir-elasticsearch-6 hapi-fhir-jpaserver-api hapi-fhir-jpaserver-model