This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit f3517a76db8d9a2478c2fd0ccef96a94470aa091 Author: jpoth <poth.j...@gmail.com> AuthorDate: Thu Feb 1 20:14:42 2018 +0100 [CAMEL-12221] Let's create a camel-fhir component --- apache-camel/pom.xml | 4 + apache-camel/src/main/descriptors/common-bin.xml | 1 + bom/camel-bom/pom.xml | 5 + .../org/apache/camel/builder/DataFormatClause.java | 30 +++ .../org/apache/camel/model/MarshalDefinition.java | 4 + .../apache/camel/model/UnmarshalDefinition.java | 4 + .../model/dataformat/DataFormatsDefinition.java | 2 + .../camel/model/dataformat/FhirJsonDataFormat.java | 55 ++++++ .../camel/model/dataformat/FhirXmlDataFormat.java | 55 ++++++ .../DataFormatTransformerDefinition.java | 4 + .../org/apache/camel/model/dataformat/jaxb.index | 2 + components/camel-fhir/pom.xml | 133 ++++++++++++++ .../src/main/docs/fhirJson-dataformat.adoc | 21 +++ .../src/main/docs/fhirXml-dataformat.adoc | 21 +++ .../camel/component/fhir/FhirJsonDataFormat.java | 98 ++++++++++ .../camel/component/fhir/FhirXmlDataFormat.java | 98 ++++++++++ .../services/org/apache/camel/dataformat/fhirJson | 18 ++ .../services/org/apache/camel/dataformat/fhirXml | 18 ++ .../fhir/FhirJsonDataFormatSpringTest.java | 81 ++++++++ .../component/fhir/FhirJsonDataFormatTest.java | 92 ++++++++++ .../fhir/FhirXmlDataFormatSpringTest.java | 83 +++++++++ .../component/fhir/FhirXmlDataFormatTest.java | 93 ++++++++++ .../fhir/Hl7v2PatientToFhirPatientIT.java | 93 ++++++++++ .../camel/component/fhir/PatientProcessor.java | 79 ++++++++ .../src/test/resources/log4j2.properties | 60 ++---- .../fhir/json/FhirJsonDataFormatSpringTest.xml | 43 +++++ .../fhir/xml/FhirXmlDataFormatSpringTest.xml | 42 +++++ components/pom.xml | 1 + parent/pom.xml | 6 + .../components-starter/camel-fhir-starter/pom.xml | 53 ++++++ .../FhirJsonDataFormatAutoConfiguration.java | 129 +++++++++++++ .../FhirJsonDataFormatConfiguration.java | 50 +++++ .../FhirXmlDataFormatAutoConfiguration.java | 129 +++++++++++++ .../springboot/FhirXmlDataFormatConfiguration.java | 50 +++++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 ++ .../src/main/resources/META-INF/spring.factories | 53 +----- .../src/main/resources/META-INF/spring.provides | 49 +---- platforms/spring-boot/components-starter/pom.xml | 1 + 39 files changed, 1839 insertions(+), 135 deletions(-) diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index ae1bd55..18a7e31 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -316,6 +316,10 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-fhir</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-flatpack</artifactId> </dependency> <dependency> diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 8333ea2..6b21ecf 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -93,6 +93,7 @@ <include>org.apache.camel:camel-exec</include> <include>org.apache.camel:camel-facebook</include> <include>org.apache.camel:camel-fastjson</include> + <include>org.apache.camel:camel-fhir</include> <include>org.apache.camel:camel-flatpack</include> <include>org.apache.camel:camel-flink</include> <include>org.apache.camel:camel-fop</include> diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 6a3af3c..d9f6960 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -765,6 +765,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-fhir</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-flatpack</artifactId> <version>${project.version}</version> </dependency> diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java index 0f03f86..239ae9a 100644 --- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java +++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java @@ -34,6 +34,8 @@ import org.apache.camel.model.dataformat.BoonDataFormat; import org.apache.camel.model.dataformat.CastorDataFormat; import org.apache.camel.model.dataformat.CsvDataFormat; import org.apache.camel.model.dataformat.CustomDataFormat; +import org.apache.camel.model.dataformat.FhirJsonDataFormat; +import org.apache.camel.model.dataformat.FhirXmlDataFormat; import org.apache.camel.model.dataformat.GzipDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.HessianDataFormat; @@ -1183,6 +1185,34 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> { return dataFormat(new ASN1DataFormat(usingIterator)); } + /** + * Uses the FHIR JSON data format + */ + public T fhirJson(Object fhirContext) { + FhirJsonDataFormat jsonDataFormat = new FhirJsonDataFormat(); + jsonDataFormat.setFhirContext(fhirContext); + return dataFormat(jsonDataFormat); + } + + public T fhirJson() { + FhirJsonDataFormat jsonDataFormat = new FhirJsonDataFormat(); + return dataFormat(jsonDataFormat); + } + + /** + * Uses the FHIR XML data format + */ + public T fhirXml(Object fhirContext) { + FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat(); + fhirXmlDataFormat.setFhirContext(fhirContext); + return dataFormat(fhirXmlDataFormat); + } + + public T fhirXml() { + FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat(); + return dataFormat(fhirXmlDataFormat); + } + @SuppressWarnings("unchecked") private T dataFormat(DataFormatDefinition dataFormatType) { switch (operation) { diff --git a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java index e83f1c9..e7d160c 100644 --- a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java @@ -34,6 +34,8 @@ import org.apache.camel.model.dataformat.CastorDataFormat; import org.apache.camel.model.dataformat.CryptoDataFormat; import org.apache.camel.model.dataformat.CsvDataFormat; import org.apache.camel.model.dataformat.CustomDataFormat; +import org.apache.camel.model.dataformat.FhirJsonDataFormat; +import org.apache.camel.model.dataformat.FhirXmlDataFormat; import org.apache.camel.model.dataformat.FlatpackDataFormat; import org.apache.camel.model.dataformat.GzipDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; @@ -93,6 +95,8 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> { @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class), @XmlElement(required = false, name = "csv", type = CsvDataFormat.class), @XmlElement(required = false, name = "custom", type = CustomDataFormat.class), + @XmlElement(required = false, name = "fhirJson", type = FhirJsonDataFormat.class), + @XmlElement(required = false, name = "fhirXml", type = FhirXmlDataFormat.class), @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class), @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class), @XmlElement(required = false, name = "hessian", type = HessianDataFormat.class), diff --git a/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java b/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java index b69dd38..dda49f3 100644 --- a/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java @@ -34,6 +34,8 @@ import org.apache.camel.model.dataformat.CastorDataFormat; import org.apache.camel.model.dataformat.CryptoDataFormat; import org.apache.camel.model.dataformat.CsvDataFormat; import org.apache.camel.model.dataformat.CustomDataFormat; +import org.apache.camel.model.dataformat.FhirJsonDataFormat; +import org.apache.camel.model.dataformat.FhirXmlDataFormat; import org.apache.camel.model.dataformat.FlatpackDataFormat; import org.apache.camel.model.dataformat.GzipDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; @@ -92,6 +94,8 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition> @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class), @XmlElement(required = false, name = "csv", type = CsvDataFormat.class), @XmlElement(required = false, name = "custom", type = CustomDataFormat.class), + @XmlElement(required = false, name = "fhirJson", type = FhirJsonDataFormat.class), + @XmlElement(required = false, name = "fhirXml", type = FhirXmlDataFormat.class), @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class), @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class), @XmlElement(required = false, name = "hessian", type = HessianDataFormat.class), diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java index 11aa7b0..34e062c 100644 --- a/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java @@ -50,6 +50,8 @@ public class DataFormatsDefinition { @XmlElement(required = false, name = "csv", type = CsvDataFormat.class), // TODO: Camel 3.0 - Should be named customDataFormat to avoid naming clash with custom loadbalancer @XmlElement(required = false, name = "custom", type = CustomDataFormat.class), + @XmlElement(required = false, name = "fhirJson", type = FhirJsonDataFormat.class), + @XmlElement(required = false, name = "fhirXml", type = FhirXmlDataFormat.class), @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class), @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class), @XmlElement(required = false, name = "hessian", type = HessianDataFormat.class), diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java new file mode 100644 index 0000000..f477f9a --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.model.dataformat; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import org.apache.camel.CamelContext; +import org.apache.camel.model.DataFormatDefinition; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.Metadata; + +/** + * The FHIR JSON data format is used to marshall/unmarshall to/from FHIR objects to/from JSON. + */ +@Metadata(firstVersion = "2.21.0", label = "dataformat,transformation,json,hl7", title = "FHIR JSON") +@XmlRootElement(name = "fhirJson") +@XmlAccessorType(XmlAccessType.FIELD) +public class FhirJsonDataFormat extends DataFormatDefinition { + + private Object fhirContext; + + public FhirJsonDataFormat() { + super("fhirJson"); + } + + public Object getFhirContext() { + return fhirContext; + } + + public void setFhirContext(Object fhirContext) { + this.fhirContext = fhirContext; + } + + @Override + protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) { + if (getFhirContext() != null) { + setProperty(camelContext, dataFormat, "fhirContext", getFhirContext()); + } + } +} diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirXmlDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirXmlDataFormat.java new file mode 100644 index 0000000..09c168f --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirXmlDataFormat.java @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.model.dataformat; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import org.apache.camel.CamelContext; +import org.apache.camel.model.DataFormatDefinition; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.Metadata; + +/** + * The FHIR XML data format is used to marshall/unmarshall from/to FHIR objects to/from XML. + */ +@Metadata(firstVersion = "2.21.0", label = "dataformat,transformation,xml,hl7", title = "FHIR XML") +@XmlRootElement(name = "fhirXml") +@XmlAccessorType(XmlAccessType.FIELD) +public class FhirXmlDataFormat extends DataFormatDefinition { + + private Object fhirContext; + + public FhirXmlDataFormat() { + super("fhirXml"); + } + + public Object getFhirContext() { + return fhirContext; + } + + public void setFhirContext(Object fhirContext) { + this.fhirContext = fhirContext; + } + + @Override + protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) { + if (getFhirContext() != null) { + setProperty(camelContext, dataFormat, "fhirContext", getFhirContext()); + } + } +} diff --git a/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java index 755d9b4..9212a1e 100644 --- a/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java @@ -36,6 +36,8 @@ import org.apache.camel.model.dataformat.CastorDataFormat; import org.apache.camel.model.dataformat.CryptoDataFormat; import org.apache.camel.model.dataformat.CsvDataFormat; import org.apache.camel.model.dataformat.CustomDataFormat; +import org.apache.camel.model.dataformat.FhirJsonDataFormat; +import org.apache.camel.model.dataformat.FhirXmlDataFormat; import org.apache.camel.model.dataformat.FlatpackDataFormat; import org.apache.camel.model.dataformat.GzipDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; @@ -97,6 +99,8 @@ public class DataFormatTransformerDefinition extends TransformerDefinition { @XmlElement(required = false, name = "csv", type = CsvDataFormat.class), // TODO: Camel 3.0 - Should be named customDataFormat to avoid naming clash with custom loadbalancer @XmlElement(required = false, name = "custom", type = CustomDataFormat.class), + @XmlElement(required = false, name = "fhirJson", type = FhirJsonDataFormat.class), + @XmlElement(required = false, name = "fhirXml", type = FhirXmlDataFormat.class), @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class), @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class), @XmlElement(required = false, name = "hessian", type = HessianDataFormat.class), diff --git a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index index 3e046e1..01af6da 100644 --- a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index +++ b/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index @@ -25,6 +25,8 @@ CryptoDataFormat CsvDataFormat CustomDataFormat DataFormatsDefinition +FhirJsonDataFormat +FhirXmlDataFormat FlatpackDataFormat GzipDataFormat HessianDataFormat diff --git a/components/camel-fhir/pom.xml b/components/camel-fhir/pom.xml new file mode 100644 index 0000000..46ab716 --- /dev/null +++ b/components/camel-fhir/pom.xml @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>2.21.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-fhir</artifactId> + <packaging>jar</packaging> + + <name>Camel :: Fhir</name> + <description>Camel Fhir support</description> + + <properties> + <camel.osgi.export.service> + org.apache.camel.spi.DataFormatResolver;dataformat=fhirJson, + org.apache.camel.spi.DataFormatResolver;dataformat=fhirXml + </camel.osgi.export.service> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + </dependency> + + <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-client</artifactId> + <version>${hapi-fhir-version}</version> + </dependency> + + <!-- testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-hl7</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>ca.uhn.hapi</groupId> + <artifactId>hapi-structures-v24</artifactId> + <version>${hapi-version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>ca.uhn.hapi.fhir</groupId> + <artifactId>hapi-fhir-structures-dstu3</artifactId> + <version>${hapi-fhir-version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>ca.uhn.hapi.fhir</groupId> + <artifactId>hapi-fhir-structures-dstu2</artifactId> + <version>${hapi-fhir-version}</version> + <scope>test</scope> + </dependency> + + <!-- logging --> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <!--Let's skip over IT tests as they rely on a public external test server being up and running--> + <include>**/*Test</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + <profiles> + <profile> + <id>it.fhir</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>**/*</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/components/camel-fhir/src/main/docs/fhirJson-dataformat.adoc b/components/camel-fhir/src/main/docs/fhirJson-dataformat.adoc new file mode 100644 index 0000000..d82f982 --- /dev/null +++ b/components/camel-fhir/src/main/docs/fhirJson-dataformat.adoc @@ -0,0 +1,21 @@ +== FHIR JSON DataFormat +*Available as of Camel version 2.21* + +The FHIR-JSON Data Format leverages +link:https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java[HAPI-FHIR's] +JSON parser to parse to/from JSON format to/from a HAPI-FHIR's `IBaseResource`. + +### FHIR JSON Format Options + +// dataformat options: START +The FHIR JSON dataformat supports 2 options which are listed below. + + + +[width="100%",cols="2s,1m,1m,6",options="header"] +|=== +| Name | Default | Java Type | Description +| fhirContext | FhirContext.forDstu3() | FhirContext | The FhirContext to create the JsonParser with. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. +|=== +// dataformat options: END \ No newline at end of file diff --git a/components/camel-fhir/src/main/docs/fhirXml-dataformat.adoc b/components/camel-fhir/src/main/docs/fhirXml-dataformat.adoc new file mode 100644 index 0000000..4771554 --- /dev/null +++ b/components/camel-fhir/src/main/docs/fhirXml-dataformat.adoc @@ -0,0 +1,21 @@ +== FHIR XML DataFormat +*Available as of Camel version 2.21* + +The FHIR-XML Data Format leverages +link:https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java[HAPI-FHIR's] +XML parser to parse to/from XML format to/from a HAPI-FHIR's `IBaseResource`. + +### FHIR XML Format Options + +// dataformat options: START +The FHIR XML dataformat supports 2 options which are listed below. + + + +[width="100%",cols="2s,1m,1m,6",options="header"] +|=== +| Name | Default | Java Type | Description +| fhirContext | FhirContext.forDstu3() | FhirContext | The FhirContext to create the XmlParser with. +| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML or application/json for data formats marshalling to JSon etc. +|=== +// dataformat options: END \ No newline at end of file diff --git a/components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirJsonDataFormat.java b/components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirJsonDataFormat.java new file mode 100644 index 0000000..9551c93 --- /dev/null +++ b/components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirJsonDataFormat.java @@ -0,0 +1,98 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; + +import ca.uhn.fhir.context.FhirContext; +import org.apache.camel.Exchange; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatName; +import org.apache.camel.support.ServiceSupport; +import org.hl7.fhir.instance.model.api.IBaseResource; + +public class FhirJsonDataFormat extends ServiceSupport implements DataFormat, DataFormatName { + + private FhirContext fhirContext; + private boolean contentTypeHeader = true; + + + public FhirJsonDataFormat(FhirContext fhirContext) { + this.fhirContext = fhirContext; + } + + public FhirJsonDataFormat() { + this.fhirContext = FhirContext.forDstu3(); + } + + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + + public FhirContext getFhirContext() { + return fhirContext; + } + + public void setFhirContext(FhirContext fhirContext) { + this.fhirContext = fhirContext; + } + + @Override + public void marshal(Exchange exchange, Object o, OutputStream outputStream) throws Exception { + IBaseResource iBaseResource; + if (!(o instanceof IBaseResource)) { + iBaseResource = exchange.getContext().getTypeConverter().mandatoryConvertTo(IBaseResource.class, exchange, o); + } else { + iBaseResource = (IBaseResource) o; + } + fhirContext.newJsonParser().encodeResourceToWriter(iBaseResource, new OutputStreamWriter(outputStream)); + if (isContentTypeHeader()) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/json"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json"); + } + } + } + + @Override + public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception { + return fhirContext.newJsonParser().parseResource(new InputStreamReader(inputStream)); + } + + @Override + public String getDataFormatName() { + return "fhirJson"; + } + + @Override + protected void doStart() throws Exception { + // noop + } + + @Override + protected void doStop() throws Exception { + // noop + } +} diff --git a/components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirXmlDataFormat.java b/components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirXmlDataFormat.java new file mode 100644 index 0000000..429f926 --- /dev/null +++ b/components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirXmlDataFormat.java @@ -0,0 +1,98 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; + +import ca.uhn.fhir.context.FhirContext; +import org.apache.camel.Exchange; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatName; +import org.apache.camel.support.ServiceSupport; +import org.hl7.fhir.instance.model.api.IBaseResource; + +public class FhirXmlDataFormat extends ServiceSupport implements DataFormat, DataFormatName { + + private FhirContext fhirContext; + private boolean contentTypeHeader = true; + + + public FhirXmlDataFormat(FhirContext fhirContext) { + this.fhirContext = fhirContext; + } + + public FhirXmlDataFormat() { + this.fhirContext = FhirContext.forDstu3(); + } + + public boolean isContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } + + public FhirContext getFhirContext() { + return fhirContext; + } + + public void setFhirContext(FhirContext fhirContext) { + this.fhirContext = fhirContext; + } + + @Override + public void marshal(Exchange exchange, Object o, OutputStream outputStream) throws Exception { + IBaseResource iBaseResource; + if (!(o instanceof IBaseResource)) { + iBaseResource = exchange.getContext().getTypeConverter().mandatoryConvertTo(IBaseResource.class, exchange, o); + } else { + iBaseResource = (IBaseResource) o; + } + fhirContext.newXmlParser().encodeResourceToWriter(iBaseResource, new OutputStreamWriter(outputStream)); + if (isContentTypeHeader()) { + if (exchange.hasOut()) { + exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } else { + exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + } + } + } + + @Override + public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception { + return fhirContext.newXmlParser().parseResource(new InputStreamReader(inputStream)); + } + + @Override + public String getDataFormatName() { + return "fhirXml"; + } + + @Override + protected void doStart() throws Exception { + // noop + } + + @Override + protected void doStop() throws Exception { + // noop + } +} diff --git a/components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/dataformat/fhirJson b/components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/dataformat/fhirJson new file mode 100644 index 0000000..7783571 --- /dev/null +++ b/components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/dataformat/fhirJson @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +class=org.apache.camel.component.fhir.FhirJsonDataFormat diff --git a/components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/dataformat/fhirXml b/components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/dataformat/fhirXml new file mode 100644 index 0000000..dc4d791 --- /dev/null +++ b/components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/dataformat/fhirXml @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +class=org.apache.camel.component.fhir.FhirXmlDataFormat diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java new file mode 100644 index 0000000..87575fe --- /dev/null +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java @@ -0,0 +1,81 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.io.InputStream; +import java.io.InputStreamReader; +import ca.uhn.fhir.context.FhirContext; +import org.apache.camel.Exchange; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.CamelSpringTestSupport; +import org.hl7.fhir.dstu3.model.Address; +import org.hl7.fhir.dstu3.model.Base; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport { + + private static final String PATIENT = "{\"resourceType\":\"Patient\"," + + "\"name\":[{\"family\":\"Holmes\",\"given\":[\"Sherlock\"]}]," + + "\"address\":[{\"line\":[\"221b Baker St, Marylebone, London NW1 6XE, UK\"]}]}"; + + private MockEndpoint mockEndpoint; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); + } + + @Test + public void unmarshal() throws Exception { + template.sendBody("direct:unmarshal", PATIENT); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + Patient patient = (Patient) exchange.getIn().getBody(); + assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); + } + + @Test + public void marshal() throws Exception { + Patient patient = getPatient(); + mockEndpoint.expectedMessageCount(1); + template.sendBody("direct:marshal", patient); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + InputStream inputStream = exchange.getIn().getBody(InputStream.class); + IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream)); + assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource)); + } + + private Patient getPatient() { + Patient patient = new Patient(); + patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK")); + return patient; + } + + @Override + protected AbstractApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml"); + } +} \ No newline at end of file diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java new file mode 100644 index 0000000..8ecbcd4 --- /dev/null +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java @@ -0,0 +1,92 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.io.InputStream; +import java.io.InputStreamReader; +import ca.uhn.fhir.context.FhirContext; +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.hl7.fhir.dstu3.model.Address; +import org.hl7.fhir.dstu3.model.Base; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.junit.Before; +import org.junit.Test; + +public class FhirJsonDataFormatTest extends CamelTestSupport { + + private static final String PATIENT = "{\"resourceType\":\"Patient\"," + + "\"name\":[{\"family\":\"Holmes\",\"given\":[\"Sherlock\"]}]," + + "\"address\":[{\"line\":[\"221b Baker St, Marylebone, London NW1 6XE, UK\"]}]}"; + + private MockEndpoint mockEndpoint; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); + } + + @Test + public void unmarshal() throws Exception { + template.sendBody("direct:unmarshal", PATIENT); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + Patient patient = (Patient) exchange.getIn().getBody(); + assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); + } + + @Test + public void marshal() throws Exception { + Patient patient = getPatient(); + mockEndpoint.expectedMessageCount(1); + template.sendBody("direct:marshal", patient); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + InputStream inputStream = exchange.getIn().getBody(InputStream.class); + IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream)); + assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource)); + } + + private Patient getPatient() { + Patient patient = new Patient(); + patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK")); + return patient; + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + + from("direct:marshal") + .marshal().fhirJson() + .to("mock:result"); + + from("direct:unmarshal") + .unmarshal().fhirJson() + .to("mock:result"); + + } + }; + } + +} \ No newline at end of file diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java new file mode 100644 index 0000000..bc40013 --- /dev/null +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java @@ -0,0 +1,83 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.io.InputStream; +import java.io.InputStreamReader; +import ca.uhn.fhir.context.FhirContext; +import org.apache.camel.Exchange; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.CamelSpringTestSupport; +import org.hl7.fhir.dstu3.model.Address; +import org.hl7.fhir.dstu3.model.Base; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class FhirXmlDataFormatSpringTest extends CamelSpringTestSupport { + + private static final String PATIENT = + "<Patient xmlns=\"http://hl7.org/fhir\">" + + "<name><family value=\"Holmes\"/><given value=\"Sherlock\"/></name>" + + "<address><line value=\"221b Baker St, Marylebone, London NW1 6XE, UK\"/></address>" + + "</Patient>"; + + private MockEndpoint mockEndpoint; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); + } + + @Test + public void unmarshal() throws Exception { + template.sendBody("direct:unmarshal", PATIENT); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + Patient patient = (Patient) exchange.getIn().getBody(); + assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); + } + + @Test + public void marshal() throws Exception { + Patient patient = getPatient(); + mockEndpoint.expectedMessageCount(1); + template.sendBody("direct:marshal", patient); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + InputStream inputStream = exchange.getIn().getBody(InputStream.class); + final IBaseResource iBaseResource = FhirContext.forDstu3().newXmlParser().parseResource(new InputStreamReader(inputStream)); + assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource)); + } + + private Patient getPatient() { + Patient patient = new Patient(); + patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK")); + return patient; + } + + @Override + protected AbstractApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatSpringTest.xml"); + } +} \ No newline at end of file diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java new file mode 100644 index 0000000..b340470 --- /dev/null +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java @@ -0,0 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.io.InputStream; +import java.io.InputStreamReader; + +import ca.uhn.fhir.context.FhirContext; +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.hl7.fhir.dstu3.model.Address; +import org.hl7.fhir.dstu3.model.Base; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.junit.Before; +import org.junit.Test; + +public class FhirXmlDataFormatTest extends CamelTestSupport { + + private static final String PATIENT = + "<Patient xmlns=\"http://hl7.org/fhir\">" + + "<name><family value=\"Holmes\"/><given value=\"Sherlock\"/></name>" + + "<address><line value=\"221b Baker St, Marylebone, London NW1 6XE, UK\"/></address>" + + "</Patient>"; + private MockEndpoint mockEndpoint; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); + } + + @Test + public void unmarshal() throws Exception { + template.sendBody("direct:unmarshal", PATIENT); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + Patient patient = (Patient) exchange.getIn().getBody(); + assertTrue("Patients should be equal!", patient.equalsDeep(getPatient())); + } + + @Test + public void marshal() throws Exception { + Patient patient = getPatient(); + mockEndpoint.expectedMessageCount(1); + template.sendBody("direct:marshal", patient); + mockEndpoint.expectedMessageCount(1); + Exchange exchange = mockEndpoint.getExchanges().get(0); + InputStream inputStream = exchange.getIn().getBody(InputStream.class); + final IBaseResource iBaseResource = FhirContext.forDstu3().newXmlParser().parseResource(new InputStreamReader(inputStream)); + assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource)); + } + + private Patient getPatient() { + Patient patient = new Patient(); + patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK")); + return patient; + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + + from("direct:marshal") + .marshal().fhirXml() + .to("mock:result"); + + from("direct:unmarshal") + .unmarshal().fhirXml() + .to("mock:result"); + + } + }; + } +} \ No newline at end of file diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIT.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIT.java new file mode 100644 index 0000000..710e307 --- /dev/null +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIT.java @@ -0,0 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.io.ByteArrayInputStream; +import java.nio.charset.Charset; +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.hl7.HL7DataFormat; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.hl7.fhir.dstu3.model.Patient; +import org.junit.Test; + +/** + * This test demonstrates how to convert a HL7V2 patient to a FHIR dtsu3 Patient. + */ +public class Hl7v2PatientToFhirPatientIT extends CamelTestSupport { + + /* + Segment Purpose FHIR Resource + MSH Message header MessageHeader + PID Patient Identification Patient + PV1 Patient Visit Not used in this example + PV2 Patient Visit – Additional data Not used in this example + ORC Common Order Not used in this example + OBR Observation Request Observation + OBX Observation ObservationProvider + + See https://fhirblog.com/2014/10/05/mapping-hl7-version-2-to-fhir-messages for more information + */ + private static final String HL7_MESSAGE = "MSH|^~\\&|Amalga HIS|BUM|New Tester|MS|20111121103141||ORU^R01|2847970-2" + + "01111211031|P|2.4|||AL|NE|764|ASCII|||\r" + + "PID||100005056|100005056||Dasher^Mary^\"\"^^\"\"|\"\"|19810813000000|F||CA|Street 1^\"\"^\"\"^\"\"^34000^SGP^^" + + "\"\"~\"\"^\"\"^\"\"^\"\"^Danling Street 5th^THA^^\"\"||326-2275^PRN^PH^^66^675~476-5059^ORN^CP^^66^359~(123)" + + "456-7890^ORN^FX^^66^222~^NET^X.400^a@a.a~^NET^X.400^du...@hotmail.com|(123)456-7890^WPN^PH^^66|UNK|S|BUD||BP000111899|" + + "D99999^\"\"||CA|Bangkok|||THA||THA|\"\"|N\r" + + "PV1||OPD ||||\"\"^\"\"^\"\"||||CNSLT|||||C|VIP|||6262618|PB1||||||||||||||||||||||||20101208134638\r" + + "PV2|||^Unknown|\"\"^\"\"||||\"\"|\"\"|0||\"\"|||||||||||||||||||||||||||||HP1\r" + + "ORC|NW|\"\"|BMC1102771601|\"\"|CM||^^^^^\"\"|||||||||\"\"^\"\"^^^\"\"\r" + + "OBR|1|\"\"|BMC1102771601|\"\"^Brain (CT)||20111028124215||||||||||||||||||CTSCAN|F||^^^^^ROUTINE|||\"\"||||||\"\"|||||||||||^\"\"\r" + + "OBX|1|FT|\"\"^Brain (CT)||++++ text of report goes here +++|||REQAT|||FINAL|||20111121103040||75929^Gosselin^Angelina"; + + private FhirContext fhirContext = FhirContext.forDstu3(); + private IGenericClient client = fhirContext.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3"); + private HL7DataFormat hl7 = new HL7DataFormat(); + + @Test + public void testUnmarshalWithExplicitUTF16Charset() throws Exception { + // Message with explicit encoding in MSH + String charset = "ASCII"; + byte[] body = HL7_MESSAGE.getBytes(Charset.forName(charset)); + template.sendBodyAndHeader("direct:input", new ByteArrayInputStream(body), Exchange.CHARSET_NAME, charset); + + MockEndpoint mock = getMockEndpoint("mock:result"); + final MethodOutcome results = (MethodOutcome) mock.getExchanges().get(0).getIn().getBody(); + Patient patient = (Patient) results.getResource(); + assertNotNull(patient); + assertEquals("Dasher", patient.getNameFirstRep().getFamily()); + } + + protected RouteBuilder createRouteBuilder() throws Exception { + + return new RouteBuilder() { + public void configure() throws Exception { + + Processor patientProcessor = new PatientProcessor(client, getContext()); + from("direct:input") + .unmarshal(hl7) + .process(patientProcessor) + .to("mock:result"); + } + }; + } +} diff --git a/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/PatientProcessor.java b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/PatientProcessor.java new file mode 100644 index 0000000..e1c0416 --- /dev/null +++ b/components/camel-fhir/src/test/java/org/apache/camel/component/fhir/PatientProcessor.java @@ -0,0 +1,79 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir; + +import java.util.List; +import ca.uhn.fhir.model.base.resource.BaseOperationOutcome; +import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.rest.api.PreferReturnEnum; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.gclient.IClientExecutable; +import ca.uhn.hl7v2.model.v24.message.ORU_R01; +import ca.uhn.hl7v2.model.v24.segment.PID; +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.hl7.fhir.dstu3.model.Patient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Simple Patient precessor that converts the Patient segment of a {@link ORU_R01} message into a FHIR dtsu3 {@link Patient}. + */ +public class PatientProcessor implements Processor { + private final Logger log = LoggerFactory.getLogger(PatientProcessor.class.getName()); + private final IGenericClient client; + private final CamelContext camelContext; + + public PatientProcessor(IGenericClient client, CamelContext camelContext) { + this.client = client; + this.camelContext = camelContext; + } + + @Override + public void process(Exchange exchange) throws Exception { + ORU_R01 msg = exchange.getIn().getBody(ORU_R01.class); + //map to Patient + Patient patient = getPatient(msg); + log.info("Mapped Dtsu3 patient {}", camelContext.getTypeConverter().convertTo(String.class, exchange, patient)); + final IClientExecutable clientExecutable = client.create().resource(patient).prefer(PreferReturnEnum.REPRESENTATION); + Object result = clientExecutable.execute(); + if (result instanceof BaseOperationOutcome) { + List<? extends BaseOperationOutcome.BaseIssue> issues = ((BaseOperationOutcome) result).getIssue(); + if (!issues.isEmpty()) { + exchange.setException(new Exception("Error executing client operation: " + issues.get(0).getDetailsElement().getValue())); + } + } + exchange.getIn().setBody(result); + } + + /** + * Converts {@link ORU_R01} to {@link Patient} + */ + private Patient getPatient(ORU_R01 msg) { + Patient patient = new Patient(); + final PID pid = msg.getPATIENT_RESULT().getPATIENT().getPID(); + String surname = pid.getPatientName()[0].getFamilyName().getFn1_Surname().getValue(); + String name = pid.getPatientName()[0].getGivenName().getValue(); + String patientId = msg.getPATIENT_RESULT().getPATIENT().getPID().getPatientID().getCx1_ID().getValue(); + patient.addName() + .addGiven(name); + patient.getNameFirstRep().setFamily(surname); + patient.setId(patientId); + return patient; + } +} diff --git a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index b/components/camel-fhir/src/test/resources/log4j2.properties similarity index 52% copy from camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index copy to components/camel-fhir/src/test/resources/log4j2.properties index 3e046e1..3c6189a 100644 --- a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index +++ b/components/camel-fhir/src/test/resources/log4j2.properties @@ -1,4 +1,4 @@ -## ------------------------------------------------------------------------ +## --------------------------------------------------------------------------- ## Licensed to the Apache Software Foundation (ASF) under one or more ## contributor license agreements. See the NOTICE file distributed with ## this work for additional information regarding copyright ownership. @@ -6,53 +6,23 @@ ## (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 +## 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. -## ------------------------------------------------------------------------ -ASN1DataFormat -AvroDataFormat -Base64DataFormat -BeanioDataFormat -BindyDataFormat -BindyType -CastorDataFormat -CryptoDataFormat -CsvDataFormat -CustomDataFormat -DataFormatsDefinition -FlatpackDataFormat -GzipDataFormat -HessianDataFormat -HL7DataFormat -IcalDataFormat -JaxbDataFormat -JibxDataFormat -JsonDataFormat -JsonLibrary -LZFDataFormat -MimeMultipartDataFormat -ProtobufDataFormat -RssDataFormat -SerializationDataFormat -SoapJaxbDataFormat -StringDataFormat -SyslogDataFormat -TarFileDataFormat -ThriftDataFormat -TidyMarkupDataFormat -UniVocityCsvDataFormat -UniVocityFixedWidthDataFormat -UniVocityHeader -UniVocityTsvDataFormat -XMLBeansDataFormat -XMLSecurityDataFormat -XStreamDataFormat -YAMLDataFormat -YAMLLibrary -ZipDataFormat -ZipFileDataFormat +## --------------------------------------------------------------------------- + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-fhir-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +rootLogger.level = DEBUG +rootLogger.appenderRef.file.ref = file diff --git a/components/camel-fhir/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml b/components/camel-fhir/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml new file mode 100644 index 0000000..a1d3cf1 --- /dev/null +++ b/components/camel-fhir/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:marshal"/> + <marshal> + <fhirJson/> + </marshal> + <to uri="mock:result"/> + </route> + <route> + <from uri="direct:unmarshal"/> + <unmarshal> + <fhirJson/> + </unmarshal> + <to uri="mock:result"/> + </route> + </camelContext> +</beans> diff --git a/components/camel-fhir/src/test/resources/org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatSpringTest.xml b/components/camel-fhir/src/test/resources/org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatSpringTest.xml new file mode 100644 index 0000000..5e31c13 --- /dev/null +++ b/components/camel-fhir/src/test/resources/org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatSpringTest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:marshal"/> + <marshal> + <fhirXml/> + </marshal> + <to uri="mock:result"/> + </route> + <route> + <from uri="direct:unmarshal"/> + <unmarshal> + <fhirXml/> + </unmarshal> + <to uri="mock:result"/> + </route> + </camelContext> +</beans> diff --git a/components/pom.xml b/components/pom.xml index bd13135..3327b0d 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -127,6 +127,7 @@ <module>camel-exec</module> <module>camel-facebook</module> <module>camel-fastjson</module> + <module>camel-fhir</module> <module>camel-flatpack</module> <module>camel-flink</module> <module>camel-fop</module> diff --git a/parent/pom.xml b/parent/pom.xml index bb7bf9b..127b196 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -289,6 +289,7 @@ <hadoop2-protobuf-version>2.5.0</hadoop2-protobuf-version> <hamcrest-version>2.0.0.0</hamcrest-version> <hapi-version>2.3</hapi-version> + <hapi-fhir-version>3.2.0</hapi-fhir-version> <hawtbuf-version>1.11</hawtbuf-version> <hawtdb-version>1.6</hawtdb-version> <hawtdispatch-version>1.22</hawtdispatch-version> @@ -1178,6 +1179,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-fhir</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-flatpack</artifactId> <version>${project.version}</version> </dependency> diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/pom.xml b/platforms/spring-boot/components-starter/camel-fhir-starter/pom.xml new file mode 100644 index 0000000..1c7fd4d --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/pom.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> +<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> + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components-starter</artifactId> + <version>2.21.0-SNAPSHOT</version> + </parent> + <artifactId>camel-fhir-starter</artifactId> + <packaging>jar</packaging> + <name>Spring-Boot Starter :: Camel :: Fhir</name> + <description>Spring-Boot Starter for Camel Fhir Component</description> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-fhir</artifactId> + <version>${project.version}</version> + </dependency> + <!--START OF GENERATED CODE--> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-boot-starter</artifactId> + </dependency> + <!--END OF GENERATED CODE--> + </dependencies> +</project> diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatAutoConfiguration.java new file mode 100644 index 0000000..a01009d --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatAutoConfiguration.java @@ -0,0 +1,129 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.component.fhir.FhirJsonDataFormat; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatCustomizer; +import org.apache.camel.spi.DataFormatFactory; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.DataFormatConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + FhirJsonDataFormatAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties({DataFormatConfigurationProperties.class, + FhirJsonDataFormatConfiguration.class}) +public class FhirJsonDataFormatAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(FhirJsonDataFormatAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private FhirJsonDataFormatConfiguration configuration; + @Autowired(required = false) + private List<DataFormatCustomizer<FhirJsonDataFormat>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.dataformat", "camel.dataformat.fhirjson"); + } + } + + @Bean(name = "fhirJson-dataformat-factory") + @ConditionalOnMissingBean(FhirJsonDataFormat.class) + public DataFormatFactory configureFhirJsonDataFormatFactory() + throws Exception { + return new DataFormatFactory() { + @Override + public DataFormat newInstance() { + FhirJsonDataFormat dataformat = new FhirJsonDataFormat(); + if (CamelContextAware.class + .isAssignableFrom(FhirJsonDataFormat.class)) { + CamelContextAware contextAware = CamelContextAware.class + .cast(dataformat); + if (contextAware != null) { + contextAware.setCamelContext(camelContext); + } + } + try { + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, + parameters, null, false); + CamelPropertiesHelper.setCamelProperties(camelContext, + dataformat, parameters, false); + } catch (Exception e) { + throw new RuntimeCamelException(e); + } + if (ObjectHelper.isNotEmpty(customizers)) { + for (DataFormatCustomizer<FhirJsonDataFormat> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.fhirjson.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.fhirjson.customizer"); + if (useCustomizer) { + LOGGER.debug( + "Configure dataformat {}, with customizer {}", + dataformat, customizer); + customizer.customize(dataformat); + } + } + } + return dataformat; + } + }; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatConfiguration.java new file mode 100644 index 0000000..d3bedf0 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatConfiguration.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The FHIR JSON data format is used to marshall/unmarshall to/from FHIR objects + * to/from JSON. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.dataformat.fhirjson") +public class FhirJsonDataFormatConfiguration + extends + DataFormatConfigurationPropertiesCommon { + + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatAutoConfiguration.java new file mode 100644 index 0000000..286b470 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatAutoConfiguration.java @@ -0,0 +1,129 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.component.fhir.FhirXmlDataFormat; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatCustomizer; +import org.apache.camel.spi.DataFormatFactory; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.DataFormatConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + FhirXmlDataFormatAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties({DataFormatConfigurationProperties.class, + FhirXmlDataFormatConfiguration.class}) +public class FhirXmlDataFormatAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(FhirXmlDataFormatAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private FhirXmlDataFormatConfiguration configuration; + @Autowired(required = false) + private List<DataFormatCustomizer<FhirXmlDataFormat>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.dataformat", "camel.dataformat.fhirxml"); + } + } + + @Bean(name = "fhirXml-dataformat-factory") + @ConditionalOnMissingBean(FhirXmlDataFormat.class) + public DataFormatFactory configureFhirXmlDataFormatFactory() + throws Exception { + return new DataFormatFactory() { + @Override + public DataFormat newInstance() { + FhirXmlDataFormat dataformat = new FhirXmlDataFormat(); + if (CamelContextAware.class + .isAssignableFrom(FhirXmlDataFormat.class)) { + CamelContextAware contextAware = CamelContextAware.class + .cast(dataformat); + if (contextAware != null) { + contextAware.setCamelContext(camelContext); + } + } + try { + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, + parameters, null, false); + CamelPropertiesHelper.setCamelProperties(camelContext, + dataformat, parameters, false); + } catch (Exception e) { + throw new RuntimeCamelException(e); + } + if (ObjectHelper.isNotEmpty(customizers)) { + for (DataFormatCustomizer<FhirXmlDataFormat> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.fhirxml.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.fhirxml.customizer"); + if (useCustomizer) { + LOGGER.debug( + "Configure dataformat {}, with customizer {}", + dataformat, customizer); + customizer.customize(dataformat); + } + } + } + return dataformat; + } + }; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatConfiguration.java new file mode 100644 index 0000000..6aa90fe --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatConfiguration.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.camel.component.fhir.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The FHIR XML data format is used to marshall/unmarshall from/to FHIR objects + * to/from XML. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.dataformat.fhirxml") +public class FhirXmlDataFormatConfiguration + extends + DataFormatConfigurationPropertiesCommon { + + /** + * Whether the data format should set the Content-Type header with the type + * from the data format if the data format is capable of doing so. For + * example application/xml for data formats marshalling to XML or + * application/json for data formats marshalling to JSon etc. + */ + private Boolean contentTypeHeader = false; + + public Boolean getContentTypeHeader() { + return contentTypeHeader; + } + + public void setContentTypeHeader(Boolean contentTypeHeader) { + this.contentTypeHeader = contentTypeHeader; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000..6b0b127 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 0000000..2e215bf --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/spring.factories similarity index 52% copy from camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index copy to platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/spring.factories index 3e046e1..3df2200 100644 --- a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/spring.factories @@ -1,4 +1,4 @@ -## ------------------------------------------------------------------------ +## --------------------------------------------------------------------------- ## Licensed to the Apache Software Foundation (ASF) under one or more ## contributor license agreements. See the NOTICE file distributed with ## this work for additional information regarding copyright ownership. @@ -6,53 +6,16 @@ ## (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 +## 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. -## ------------------------------------------------------------------------ -ASN1DataFormat -AvroDataFormat -Base64DataFormat -BeanioDataFormat -BindyDataFormat -BindyType -CastorDataFormat -CryptoDataFormat -CsvDataFormat -CustomDataFormat -DataFormatsDefinition -FlatpackDataFormat -GzipDataFormat -HessianDataFormat -HL7DataFormat -IcalDataFormat -JaxbDataFormat -JibxDataFormat -JsonDataFormat -JsonLibrary -LZFDataFormat -MimeMultipartDataFormat -ProtobufDataFormat -RssDataFormat -SerializationDataFormat -SoapJaxbDataFormat -StringDataFormat -SyslogDataFormat -TarFileDataFormat -ThriftDataFormat -TidyMarkupDataFormat -UniVocityCsvDataFormat -UniVocityFixedWidthDataFormat -UniVocityHeader -UniVocityTsvDataFormat -XMLBeansDataFormat -XMLSecurityDataFormat -XStreamDataFormat -YAMLDataFormat -YAMLLibrary -ZipDataFormat -ZipFileDataFormat +## --------------------------------------------------------------------------- + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.fhir.springboot.FhirJsonDataFormatAutoConfiguration,\ +org.apache.camel.component.fhir.springboot.FhirXmlDataFormatAutoConfiguration + diff --git a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/spring.provides similarity index 52% copy from camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index copy to platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/spring.provides index 3e046e1..e08fb2b 100644 --- a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index +++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/resources/META-INF/spring.provides @@ -1,4 +1,4 @@ -## ------------------------------------------------------------------------ +## --------------------------------------------------------------------------- ## Licensed to the Apache Software Foundation (ASF) under one or more ## contributor license agreements. See the NOTICE file distributed with ## this work for additional information regarding copyright ownership. @@ -6,53 +6,12 @@ ## (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 +## 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. -## ------------------------------------------------------------------------ -ASN1DataFormat -AvroDataFormat -Base64DataFormat -BeanioDataFormat -BindyDataFormat -BindyType -CastorDataFormat -CryptoDataFormat -CsvDataFormat -CustomDataFormat -DataFormatsDefinition -FlatpackDataFormat -GzipDataFormat -HessianDataFormat -HL7DataFormat -IcalDataFormat -JaxbDataFormat -JibxDataFormat -JsonDataFormat -JsonLibrary -LZFDataFormat -MimeMultipartDataFormat -ProtobufDataFormat -RssDataFormat -SerializationDataFormat -SoapJaxbDataFormat -StringDataFormat -SyslogDataFormat -TarFileDataFormat -ThriftDataFormat -TidyMarkupDataFormat -UniVocityCsvDataFormat -UniVocityFixedWidthDataFormat -UniVocityHeader -UniVocityTsvDataFormat -XMLBeansDataFormat -XMLSecurityDataFormat -XStreamDataFormat -YAMLDataFormat -YAMLLibrary -ZipDataFormat -ZipFileDataFormat +## --------------------------------------------------------------------------- +provides: camel-fhir diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml index a62c880..b185f5c 100644 --- a/platforms/spring-boot/components-starter/pom.xml +++ b/platforms/spring-boot/components-starter/pom.xml @@ -137,6 +137,7 @@ <module>camel-exec-starter</module> <module>camel-facebook-starter</module> <module>camel-fastjson-starter</module> + <module>camel-fhir-starter</module> <module>camel-flatpack-starter</module> <module>camel-flink-starter</module> <module>camel-fop-starter</module> -- To stop receiving notification emails like this one, please contact davscl...@apache.org.