diff --git a/dsf-bpe/dsf-bpe-process-api-v1-base/pom.xml b/dsf-bpe/dsf-bpe-process-api-v1-base/pom.xml index de9a68458..4ba06cd2a 100644 --- a/dsf-bpe/dsf-bpe-process-api-v1-base/pom.xml +++ b/dsf-bpe/dsf-bpe-process-api-v1-base/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml b/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml index 0ff1367c5..4b4cd3075 100644 --- a/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml +++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-process-api-v1-operaton/pom.xml b/dsf-bpe/dsf-bpe-process-api-v1-operaton/pom.xml index 02f7a2318..4dabec411 100644 --- a/dsf-bpe/dsf-bpe-process-api-v1-operaton/pom.xml +++ b/dsf-bpe/dsf-bpe-process-api-v1-operaton/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-process-api-v1/pom.xml b/dsf-bpe/dsf-bpe-process-api-v1/pom.xml index 4462fa5de..6089bd256 100644 --- a/dsf-bpe/dsf-bpe-process-api-v1/pom.xml +++ b/dsf-bpe/dsf-bpe-process-api-v1/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml b/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml index bd1c39cf5..48f9eefe9 100644 --- a/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml +++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-process-api-v2/pom.xml b/dsf-bpe/dsf-bpe-process-api-v2/pom.xml index 33535b8ca..90e7df882 100644 --- a/dsf-bpe/dsf-bpe-process-api-v2/pom.xml +++ b/dsf-bpe/dsf-bpe-process-api-v2/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-process-api/pom.xml b/dsf-bpe/dsf-bpe-process-api/pom.xml index e3bbb2ea1..d98ec42c9 100644 --- a/dsf-bpe/dsf-bpe-process-api/pom.xml +++ b/dsf-bpe/dsf-bpe-process-api/pom.xml @@ -25,7 +25,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-server-jetty/pom.xml b/dsf-bpe/dsf-bpe-server-jetty/pom.xml index cf6e36391..07d1be7ee 100755 --- a/dsf-bpe/dsf-bpe-server-jetty/pom.xml +++ b/dsf-bpe/dsf-bpe-server-jetty/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-server/pom.xml b/dsf-bpe/dsf-bpe-server/pom.xml index 901e152f6..c9c6803dc 100755 --- a/dsf-bpe/dsf-bpe-server/pom.xml +++ b/dsf-bpe/dsf-bpe-server/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-test-plugin-v1/pom.xml b/dsf-bpe/dsf-bpe-test-plugin-v1/pom.xml index 058b096ee..4020e0310 100644 --- a/dsf-bpe/dsf-bpe-test-plugin-v1/pom.xml +++ b/dsf-bpe/dsf-bpe-test-plugin-v1/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-test-plugin-v2/pom.xml b/dsf-bpe/dsf-bpe-test-plugin-v2/pom.xml index c6d4f3dba..08cd642c8 100644 --- a/dsf-bpe/dsf-bpe-test-plugin-v2/pom.xml +++ b/dsf-bpe/dsf-bpe-test-plugin-v2/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/dsf-bpe-test-plugin/pom.xml b/dsf-bpe/dsf-bpe-test-plugin/pom.xml index 399b208d0..1017c2aec 100644 --- a/dsf-bpe/dsf-bpe-test-plugin/pom.xml +++ b/dsf-bpe/dsf-bpe-test-plugin/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-bpe-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-bpe/pom.xml b/dsf-bpe/pom.xml index 7e31cbd06..8ab9fae24 100755 --- a/dsf-bpe/pom.xml +++ b/dsf-bpe/pom.xml @@ -24,7 +24,7 @@ dev.dsf dsf-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-auth/pom.xml b/dsf-common/dsf-common-auth/pom.xml index 8c0c57af3..b557a4c77 100644 --- a/dsf-common/dsf-common-auth/pom.xml +++ b/dsf-common/dsf-common-auth/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-build-info-reader/pom.xml b/dsf-common/dsf-common-build-info-reader/pom.xml index 002bfe06e..b690b28a5 100644 --- a/dsf-common/dsf-common-build-info-reader/pom.xml +++ b/dsf-common/dsf-common-build-info-reader/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-config/pom.xml b/dsf-common/dsf-common-config/pom.xml index 7a29e0f45..111a5e8a2 100644 --- a/dsf-common/dsf-common-config/pom.xml +++ b/dsf-common/dsf-common-config/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-db/pom.xml b/dsf-common/dsf-common-db/pom.xml index 59abdd66e..9ae4dea2e 100644 --- a/dsf-common/dsf-common-db/pom.xml +++ b/dsf-common/dsf-common-db/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-docker-secrets-reader/pom.xml b/dsf-common/dsf-common-docker-secrets-reader/pom.xml index 115de13dc..855d4f8a0 100644 --- a/dsf-common/dsf-common-docker-secrets-reader/pom.xml +++ b/dsf-common/dsf-common-docker-secrets-reader/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-documentation/pom.xml b/dsf-common/dsf-common-documentation/pom.xml index 55e247a6b..66809838d 100644 --- a/dsf-common/dsf-common-documentation/pom.xml +++ b/dsf-common/dsf-common-documentation/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-jetty/pom.xml b/dsf-common/dsf-common-jetty/pom.xml index 4a566d6b9..a979af181 100644 --- a/dsf-common/dsf-common-jetty/pom.xml +++ b/dsf-common/dsf-common-jetty/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-oidc/pom.xml b/dsf-common/dsf-common-oidc/pom.xml index 039fd19cc..2fbaf0712 100644 --- a/dsf-common/dsf-common-oidc/pom.xml +++ b/dsf-common/dsf-common-oidc/pom.xml @@ -25,7 +25,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-status/pom.xml b/dsf-common/dsf-common-status/pom.xml index 9a0a21b13..b4f6f48ee 100644 --- a/dsf-common/dsf-common-status/pom.xml +++ b/dsf-common/dsf-common-status/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/dsf-common-ui/pom.xml b/dsf-common/dsf-common-ui/pom.xml index 6aa5bc15b..37a62d63b 100644 --- a/dsf-common/dsf-common-ui/pom.xml +++ b/dsf-common/dsf-common-ui/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-common-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-common/pom.xml b/dsf-common/pom.xml index c7bfb4615..0828d199f 100644 --- a/dsf-common/pom.xml +++ b/dsf-common/pom.xml @@ -24,7 +24,7 @@ dev.dsf dsf-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-fhir/dsf-fhir-rest-adapter/pom.xml b/dsf-fhir/dsf-fhir-rest-adapter/pom.xml index 4b2f6d78f..5e59af2e2 100755 --- a/dsf-fhir/dsf-fhir-rest-adapter/pom.xml +++ b/dsf-fhir/dsf-fhir-rest-adapter/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-fhir-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-fhir/dsf-fhir-server-jetty/pom.xml b/dsf-fhir/dsf-fhir-server-jetty/pom.xml index 730f0f1f6..e96120cf1 100755 --- a/dsf-fhir/dsf-fhir-server-jetty/pom.xml +++ b/dsf-fhir/dsf-fhir-server-jetty/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-fhir-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-fhir/dsf-fhir-server/pom.xml b/dsf-fhir/dsf-fhir-server/pom.xml index 29dbd3613..81eef9e07 100755 --- a/dsf-fhir/dsf-fhir-server/pom.xml +++ b/dsf-fhir/dsf-fhir-server/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-fhir-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-fhir/dsf-fhir-validation/pom.xml b/dsf-fhir/dsf-fhir-validation/pom.xml index 4dbf2d925..0c3132efc 100644 --- a/dsf-fhir/dsf-fhir-validation/pom.xml +++ b/dsf-fhir/dsf-fhir-validation/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-fhir-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-fhir/dsf-fhir-validation/src/main/java/dev/dsf/fhir/validation/ValidationSupportRule.java b/dsf-fhir/dsf-fhir-validation/src/main/java/dev/dsf/fhir/validation/ValidationSupportRule.java index 443cbc91b..b76ea1631 100644 --- a/dsf-fhir/dsf-fhir-validation/src/main/java/dev/dsf/fhir/validation/ValidationSupportRule.java +++ b/dsf-fhir/dsf-fhir-validation/src/main/java/dev/dsf/fhir/validation/ValidationSupportRule.java @@ -40,6 +40,7 @@ import org.hl7.fhir.r4.model.ValueSet; import org.junit.rules.ExternalResource; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.DefaultProfileValidationSupport; @@ -50,6 +51,8 @@ public class ValidationSupportRule extends ExternalResource { + private static final Logger logger = LoggerFactory.getLogger(ValidationSupportRule.class); + private static final String VERSION_PATTERN_STRING1 = "#{version}"; private static final Pattern VERSION_PATTERN1 = Pattern.compile(Pattern.quote(VERSION_PATTERN_STRING1)); // ${...} pattern to be backwards compatible @@ -122,6 +125,10 @@ public Locale getLocale() customValidationSupport, new DefaultProfileValidationSupport(context), new CommonCodeSystemsTerminologyService(context))); + warnForDeprecatedResources("StructureDefinition", structureDefinitions); + warnForDeprecatedResources("CodeSystem", codeSystems); + warnForDeprecatedResources("ValueSet", valueSets); + readProfilesAndGenerateSnapshots(context, version, date, customValidationSupport, new SnapshotGeneratorImpl(context, validationSupport), structureDefinitions.stream()); @@ -129,6 +136,27 @@ customValidationSupport, new DefaultProfileValidationSupport(context), readValueSets(context, version, date, customValidationSupport, valueSets.stream()); } + private void warnForDeprecatedResources(String resource, List file) + { + file.stream().forEach(f -> + { + try (InputStream in = ValidationSupportRule.class + .getResourceAsStream("/fhir/" + resource + "/" + f + ".ignore")) + { + if (in == null) + return; + + logger.warn("FHIR {} resource {} is deprecated, use {}", resource, f, + new String(in.readAllBytes(), StandardCharsets.UTF_8)); + } + catch (IOException e) + { + logger.warn("FHIR resource " + f + " is deprecated, unable to read replacement message: {}", + e.getMessage()); + } + }); + } + private static void readProfilesAndGenerateSnapshots(FhirContext context, String version, LocalDate date, ValidationSupportWithCustomResources vSupport, SnapshotGenerator snapshotGenerator, Stream structureDefinitions) diff --git a/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.0.0.xml.ignore b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.0.0.xml.ignore new file mode 100644 index 000000000..422cae009 --- /dev/null +++ b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.0.0.xml.ignore @@ -0,0 +1 @@ +dsf-task-2.1.0.xml \ No newline at end of file diff --git a/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.0.0.xml.post b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.0.0.xml.post deleted file mode 100644 index 254f9596a..000000000 --- a/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.0.0.xml.post +++ /dev/null @@ -1 +0,0 @@ -url=http://dsf.dev/fhir/StructureDefinition/task&version=2.0.0 \ No newline at end of file diff --git a/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.1.0.xml b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.1.0.xml new file mode 100644 index 000000000..e2b115bf4 --- /dev/null +++ b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.1.0.xml @@ -0,0 +1,318 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.1.0.xml.post b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.1.0.xml.post new file mode 100644 index 000000000..33d5ff742 --- /dev/null +++ b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-2.1.0.xml.post @@ -0,0 +1 @@ +url=http://dsf.dev/fhir/StructureDefinition/task&version=2.1.0 \ No newline at end of file diff --git a/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/resources.delete b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/resources.delete index b77fd71c0..64688b894 100644 --- a/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/resources.delete +++ b/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/resources.delete @@ -36,6 +36,7 @@ StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/organization-aff StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/organization-parent&version=1.0.0 StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/organization-reference&version=1.0.0 StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/task-base&version=1.0.0 +StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/task&version=2.0.0 StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/questionnaire&version=1.0.0 StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/questionnaire&version=1.5.0 StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/questionnaire-response&version=1.0.0 diff --git a/dsf-fhir/dsf-fhir-validation/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/dsf-fhir/dsf-fhir-validation/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 0bc54fab3..1d5c92f1f 100755 --- a/dsf-fhir/dsf-fhir-validation/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-fhir/dsf-fhir-validation/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -46,7 +46,7 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule( - List.of("dsf-task-2.0.0.xml", "dsf-task-test.xml", "dsf-task-test-v2.xml"), + List.of("dsf-task-2.1.0.xml", "dsf-task-test.xml", "dsf-task-test-v2.xml"), List.of("dsf-bpmn-message-2.0.0.xml", "dsf-test.xml", "dsf-test-v2.xml"), List.of("dsf-bpmn-message-2.0.0.xml", "dsf-test.xml", "dsf-test-v2.xml")); @@ -239,4 +239,44 @@ public void testTaskValidationWithAdditionalInputNotInDsfBaseTaskVersion2_0() assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + + @Test + public void testTaskValidDraft() + { + Task task = createDraftTask(); + task.addIdentifier().setSystem("http://dsf.dev/sid/task-identifier").setValue("Test"); + + testTaskValid(task); + } + + @Test + public void testTaskValidDraftNoIdentifier() + { + Task task = createDraftTask(); + + ValidationResult result = validate(task); + + assertEquals(1, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + && m.getMessage().contains("identifier-if-status-draft")).count()); + } + + private Task createDraftTask() + { + Task task = new Task(); + task.getMeta().addProfile("http://dsf.dev/fhir/StructureDefinition/task-test|2.0"); + task.setInstantiatesCanonical("http://dsf.dev/bpe/Process/test|2.0"); + task.setStatus(TaskStatus.DRAFT); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem("http://dsf.dev/sid/organization-identifier").setValue("Test_DIC_1"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem("http://dsf.dev/sid/organization-identifier").setValue("Test_DIC_1"); + + task.addInput().setValue(new StringType("test_v2")).getType().getCodingFirstRep() + .setSystem("http://dsf.dev/fhir/CodeSystem/bpmn-message").setCode("message-name"); + task.addInput().setValue(new IntegerType(42)).getType().getCodingFirstRep() + .setSystem("http://dsf.dev/fhir/CodeSystem/test|2.0").setCode("integer-example"); + return task; + } } diff --git a/dsf-fhir/dsf-fhir-webservice-client/pom.xml b/dsf-fhir/dsf-fhir-webservice-client/pom.xml index c998fa711..61260f30b 100755 --- a/dsf-fhir/dsf-fhir-webservice-client/pom.xml +++ b/dsf-fhir/dsf-fhir-webservice-client/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-fhir-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-fhir/dsf-fhir-websocket-client/pom.xml b/dsf-fhir/dsf-fhir-websocket-client/pom.xml index ecc9c9673..834bb315d 100755 --- a/dsf-fhir/dsf-fhir-websocket-client/pom.xml +++ b/dsf-fhir/dsf-fhir-websocket-client/pom.xml @@ -23,7 +23,7 @@ dev.dsf dsf-fhir-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-fhir/pom.xml b/dsf-fhir/pom.xml index 37ebec37c..65f373b24 100755 --- a/dsf-fhir/pom.xml +++ b/dsf-fhir/pom.xml @@ -24,7 +24,7 @@ dev.dsf dsf-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-maven/dsf-maven-plugin/pom.xml b/dsf-maven/dsf-maven-plugin/pom.xml index 504e9d284..d210601fd 100644 --- a/dsf-maven/dsf-maven-plugin/pom.xml +++ b/dsf-maven/dsf-maven-plugin/pom.xml @@ -26,7 +26,7 @@ dev.dsf dsf-maven-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleEntryFileVisitor.java b/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleEntryFileVisitor.java index e64c86c23..0632fee00 100755 --- a/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleEntryFileVisitor.java +++ b/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleEntryFileVisitor.java @@ -21,6 +21,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; +import java.util.Objects; +import java.util.stream.Stream; import org.hl7.fhir.r4.model.Resource; import org.slf4j.Logger; @@ -33,14 +35,17 @@ public class BundleEntryFileVisitor implements FileVisitor private final Path baseFolder; private final BundleEntryPutReader putReader; private final BundleEntryPostReader postReader; + private final BundleEntryIgnoreReader ignoreReader; private Class resource; - public BundleEntryFileVisitor(Path baseFolder, BundleEntryPutReader putReader, BundleEntryPostReader postReader) + public BundleEntryFileVisitor(Path baseFolder, BundleEntryPutReader putReader, BundleEntryPostReader postReader, + BundleEntryIgnoreReader ignoreReader) { - this.baseFolder = baseFolder; - this.putReader = putReader; - this.postReader = postReader; + this.baseFolder = Objects.requireNonNull(baseFolder, "baseFolder"); + this.putReader = Objects.requireNonNull(putReader, "putReader"); + this.postReader = Objects.requireNonNull(postReader, "postReader"); + this.ignoreReader = Objects.requireNonNull(ignoreReader, "ignoreReader"); } @Override @@ -84,28 +89,30 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO { Path putFile = file.resolveSibling(file.getFileName().toString() + ".put"); Path postFile = file.resolveSibling(file.getFileName().toString() + ".post"); - if (!Files.isReadable(putFile) && !Files.isReadable(postFile)) + Path ignoreFile = file.resolveSibling(file.getFileName().toString() + ".ignore"); + + if (!Files.isReadable(putFile) && !Files.isReadable(postFile) && !Files.isReadable(ignoreFile)) { - logger.error("put or post file for {} at {} not readable. Redable file {} or {} expected", - resource.getSimpleName(), file.toString(), putFile.toString(), postFile.toString()); - throw new IOException( - "put file " + putFile.toString() + " or post file " + postFile.toString() + " not readable"); + logger.error("put, post or ignore file for {} at {} not readable. Redable file {}, {} or {} expected", + resource.getSimpleName(), file.toString(), putFile.toString(), postFile.toString(), + ignoreFile.toString()); + throw new IOException("put file " + putFile.toString() + ", post file " + postFile.toString() + + " or ignore file " + postFile.toString() + " not readable"); } - else if (Files.isReadable(putFile) && Files.isReadable(postFile)) + else if (Stream.of(Files.isReadable(putFile), Files.isReadable(postFile), Files.isReadable(ignoreFile)) + .filter(b -> b).count() > 1) { - logger.error("put and post file for {} at {} readable. One redable file {} or {} expected", - resource.getSimpleName(), file.toString(), putFile.toString(), postFile.toString()); - throw new IOException( - "put file " + putFile.toString() + " and post file " + postFile.toString() + " readable"); + logger.error("For {} at {} only one redable file {}, {} or {} expected", resource.getSimpleName(), + file.toString(), putFile.toString(), postFile.toString(), ignoreFile.toString()); + throw new IOException("More then one of the put file " + putFile.toString() + ", post file " + + postFile.toString() + " and ignore file " + ignoreFile.toString() + " readable"); } else if (Files.isReadable(putFile)) - { putReader.read(resource, file, putFile); - } else if (Files.isReadable(postFile)) - { postReader.read(resource, file, postFile); - } + else if (Files.isReadable(ignoreFile)) + ignoreReader.read(resource, file, ignoreFile); } else logger.debug("Ignoring {}", file.toString()); diff --git a/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleEntryIgnoreReader.java b/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleEntryIgnoreReader.java new file mode 100644 index 000000000..17f2b2e71 --- /dev/null +++ b/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleEntryIgnoreReader.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018-2025 Heilbronn University of Applied Sciences + * + * 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. + */ +package dev.dsf.maven.bundle; + +import java.nio.file.Path; + +import org.hl7.fhir.r4.model.Resource; + +public interface BundleEntryIgnoreReader +{ + void read(Class resource, Path resourceFile, Path putFile); +} diff --git a/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleGenerator.java b/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleGenerator.java index 577b3a1ad..2ff170308 100755 --- a/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleGenerator.java +++ b/dsf-maven/dsf-maven-plugin/src/main/java/dev/dsf/maven/bundle/BundleGenerator.java @@ -218,7 +218,13 @@ public Bundle generateBundle() throws IOException } }; - FileVisitor visitor = new BundleEntryFileVisitor(baseFolder, putReader, postReader); + BundleEntryIgnoreReader ignoreReader = (resource, resourceFile, postFile) -> + { + logger.info("Ignore file {} detected, not reading {} at {}", relativeToProjectDir(postFile).toString(), + resource.getSimpleName(), relativeToProjectDir(resourceFile).toString()); + }; + + FileVisitor visitor = new BundleEntryFileVisitor(baseFolder, putReader, postReader, ignoreReader); Files.walkFileTree(baseFolder, visitor); sortBundleEntries(bundle); diff --git a/dsf-maven/pom.xml b/dsf-maven/pom.xml index 378410cfc..2dc20ba04 100644 --- a/dsf-maven/pom.xml +++ b/dsf-maven/pom.xml @@ -26,7 +26,7 @@ dev.dsf dsf-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 2aa29ca54..d7d874f74 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ dev.dsf dsf-pom - 2.0.3-SNAPSHOT + 2.1.0-SNAPSHOT pom