[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16387583#comment-16387583 ] Andrea Cosentino commented on CAMEL-12221: -- I believe for 2.21.0 we have no solution, we need to use Wrap. Lets see if they'll accept the PR and eventually we may think to create a SMX bundle for this, but I guess they will accept it > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > Fix For: 2.21.0 > > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16387564#comment-16387564 ] John Poth commented on CAMEL-12221: --- I sent a [PR|https://github.com/jamesagnew/hapi-fhir/pull/871] to HAPI-FHIR to have OSGI support natively. We could probably achieve the same thing using the wrap protocol if need be. > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > Fix For: 2.21.0 > > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16387546#comment-16387546 ] Claus Ibsen commented on CAMEL-12221: - John, Andrea. Are we in need for SMX bundles for this or something for getting camel-fhir into Karaf feature file? Currently its not there. > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > Fix For: 2.21.0 > > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16369115#comment-16369115 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-366691596 Thanks @davsclaus, OSGI support in [progress](https://github.com/jamesagnew/hapi-fhir/issues/826) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16369016#comment-16369016 ] ASF GitHub Bot commented on CAMEL-12221: Github user davsclaus closed the pull request at: https://github.com/apache/camel/pull/2206 > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16369015#comment-16369015 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-32324 Okay this PR has been merged. @johnpoth you are welcome to improve this, and we would also need a karaf feature for this This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368979#comment-16368979 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-366651817 @davsclaus awesome work! I really like the initialization of the `FhirContext` from `String`. It will be very easy to use when getting started. All tests pass locally, it's a +1 for me! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368558#comment-16368558 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-366521848 @johnpoth I took at look at this today, and checked out your work (excellent start) and polished it a bit to make it easier to specify the fhir version and ensure the XSD for the spring/blueprint configuration is correct. Its in a new branch at https://github.com/apache/camel/tree/fhir Can you take a look at my commit. Creating a dataformat is a special/odd component and it takes a bit time to learn all its quirks. When you have looked we can then revise and then get the work merged to master. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16354002#comment-16354002 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-363456862 @davsclaus changes updated. - [x] Renamed `fhir-json` -> `fhirJson` dito for `fhirXml` - [x] Made Spring XML more friendly. Note that creating a `FhirContext` is expensive. - [x] Removed `XmlTransient` This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353971#comment-16353971 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166329492 ## File path: 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; Review comment: Isn't it defined by default through [inheritance](https://github.com/apache/camel/blob/a030a22314eacafe416af749eb17b6a1046c4236/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java#L52) ? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353967#comment-16353967 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-363447840 Thanks @davsclaus reviewing :+1: won't despair for sure I'll take a look This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353837#comment-16353837 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-363413540 btw dont dispair, creating a new data format is one of the hardest one to get right, as they are more special than anything in camel. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353824#comment-16353824 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166284484 ## File path: camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java ## @@ -0,0 +1,57 @@ +/** + * 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 javax.xml.bind.annotation.XmlTransient; +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", title = "FHIR JSON") +@XmlRootElement(name = "fhir-json") +@XmlAccessorType(XmlAccessType.FIELD) +public class FhirJsonDataFormat extends DataFormatDefinition { + +@XmlTransient +private Object fhirContext; Review comment: Also this needs a way to configure this in XML by having an `@XmlAttribute` where you can specify the id of this fhir context to lookup in the registry, see some of the other data formats. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353826#comment-16353826 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166283634 ## File path: camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java ## @@ -0,0 +1,57 @@ +/** + * 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 javax.xml.bind.annotation.XmlTransient; +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", title = "FHIR JSON") +@XmlRootElement(name = "fhir-json") Review comment: We dont use dash in those xml names, and btw it should be the same as you define in DataFormatsDefinition, so it should be `fhirJson` etc and ditto for the XML guy This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353833#comment-16353833 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166285038 ## File path: components/camel-fhir/src/test/resources/log4j2.properties ## @@ -0,0 +1,23 @@ +## --- +## 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. +## --- + +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n +rootLogger.level = INFO +rootLogger.appenderRef.out.ref = out Review comment: Add logging to file as well, see the other data formats This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353832#comment-16353832 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166284248 ## File path: camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java ## @@ -0,0 +1,57 @@ +/** + * 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 javax.xml.bind.annotation.XmlTransient; +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", title = "FHIR JSON") +@XmlRootElement(name = "fhir-json") +@XmlAccessorType(XmlAccessType.FIELD) +public class FhirJsonDataFormat extends DataFormatDefinition { + +@XmlTransient +private Object fhirContext; Review comment: Is this not required, if so add `@Metadata(required = true)` This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353834#comment-16353834 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166285288 ## File path: components/camel-fhir/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml ## @@ -0,0 +1,44 @@ + + +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 +"> + Review comment: Find a way to make configuring this easier in XML - for example add some kind of way to just say "forDstu3" and Camel can do all this stuff for you. Only if you need to manually do something you can do all of this. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353827#comment-16353827 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166284536 ## File path: camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java ## @@ -0,0 +1,57 @@ +/** + * 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 javax.xml.bind.annotation.XmlTransient; +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", title = "FHIR JSON") +@XmlRootElement(name = "fhir-json") +@XmlAccessorType(XmlAccessType.FIELD) +public class FhirJsonDataFormat extends DataFormatDefinition { + +@XmlTransient +private Object fhirContext; Review comment: In other words it should not be transient This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353825#comment-16353825 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166283829 ## File path: camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java ## @@ -0,0 +1,57 @@ +/** + * 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 javax.xml.bind.annotation.XmlTransient; +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", title = "FHIR JSON") +@XmlRootElement(name = "fhir-json") Review comment: Is this not for HL7, if so add "hl7" to the label as well This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353829#comment-16353829 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166284001 ## File path: components/camel-fhir/pom.xml ## @@ -0,0 +1,133 @@ + +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;> + + 4.0.0 + + +org.apache.camel +components +2.21.0-SNAPSHOT + + + camel-fhir + jar + + Camel :: Fhir + Camel Fhir Component Review comment: The description should say data format as its not a regular component This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353830#comment-16353830 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166284682 ## File path: 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; Review comment: Ditto This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353831#comment-16353831 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166284642 ## File path: 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; Review comment: This option should also be on the model so end users can configure it there too This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353828#comment-16353828 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r166284045 ## File path: components/camel-fhir/pom.xml ## @@ -0,0 +1,133 @@ + +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;> + + 4.0.0 + + +org.apache.camel +components +2.21.0-SNAPSHOT + + + camel-fhir + jar + + Camel :: Fhir + Camel Fhir Component + + + + org.apache.camel.spi.DataFormatResolver;dataformat=fhir-json, + org.apache.camel.spi.DataFormatResolver;dataformat=fhir-xml, Review comment: Remove trailing comma This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353659#comment-16353659 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-363369985 @davsclaus thanks for reviewing, changes updated to add default constructor with default context. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353622#comment-16353622 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-363361292 The data format class implementation must have a default no-arg constructor, and then getter/setter for its options. In the XML example then its a smell when you must use constructor configuration. Ideally it should be simpler than that. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16353606#comment-16353606 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-363358635 @davsclaus changes updated. I removed the FhirEndpoint which didn't have a UriPath. Users can use the sdk client in a processing step directly (as in `Hl7v2PatientToFhirPatientIT`) or use camel-http when accessing the FHIR REST server. Thanks! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350389#comment-16350389 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165656785 ## File path: components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatURITest.java ## @@ -0,0 +1,94 @@ +/** + * 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 FhirXmlDataFormatURITest extends CamelTestSupport { + +private static final String PATIENT = +"http://hl7.org/fhir\;>" ++ "" ++ "" + + ""; +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() { +FhirContext fhirContext = FhirContext.forDstu3(); + +from("direct:marshal") +.setProperty(FhirConstants.FHIR_CONTEXT, constant(fhirContext)) Review comment: Both options are available. You can set the context on the data formats itself. I added this because the ```Context``` was needed for the ```FhirTypeConverter```. But since we are removing it I can remove this as well. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350383#comment-16350383 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165656082 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirEndpoint.java ## @@ -0,0 +1,46 @@ +/** + * 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 org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.impl.DefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; + +/** + * Represents a fhir endpoint. + */ +@UriEndpoint(scheme = "fhir", title = "FHIR", syntax = "fhir://", label = "fhir", producerOnly = true) Review comment: The FHIR endpoint doesn't have any path or options. It will only execute the provided [IClientExecutable](https://github.com/jamesagnew/hapi-fhir/blob/0352d487204bf2f5eb0f87e204e77e225d47420b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java#L64) contained in the message body and do some error handling. @davsclaus The reasoning is that HAPI-FHIR comes with a nice [RestfulClient](https://github.com/jamesagnew/hapi-fhir/blob/0352d487204bf2f5eb0f87e204e77e225d47420b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/api/IRestfulClient.java#L31) that is instantiated with the server URL and is able to construct every request depending on what FHIR version the server is running. I don't see anything else to add for the moment. If this feels weird I can remove the Endpoint and have the user execute the request in a processing step. Let me know what you think This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350354#comment-16350354 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165648742 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirTypeConverter.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.component.fhir; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.api.MethodOutcome; +import org.apache.camel.Converter; +import org.apache.camel.Exchange; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Converter +public final class FhirTypeConverter { + +private static final Logger LOGGER = LoggerFactory.getLogger(FhirTypeConverter.class.getName()); + +private FhirTypeConverter() { +// Helper class +} + +@Converter +public static String resourceToString(IBaseResource iBaseResource, Exchange exchange) { Review comment: Ah ok I'll remove it. I liked to use it for logging e.g: .log("Executing ${body}") - but this can be done in an application bean or something This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350351#comment-16350351 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165647750 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirProducer.java ## @@ -0,0 +1,51 @@ +/** + * 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.gclient.IClientExecutable; +import org.apache.camel.Exchange; +import org.apache.camel.impl.DefaultProducer; + +/** + * The fhir producer. It simply retrieves a {@link IClientExecutable}, executes it and sets the result in the Camel exchange body. + */ +public class FhirProducer extends DefaultProducer { + +public FhirProducer(FhirEndpoint endpoint) { +super(endpoint); +} + +public void process(Exchange exchange) throws Exception { +IClientExecutable clientExecutable = (IClientExecutable) exchange.getIn().getHeaders().get(FhirConstants.FHIR_REQUEST); +if (clientExecutable == null) { +throw new UnsupportedOperationException("client executable must be set"); +} +Object result = clientExecutable.execute(); +if (result instanceof BaseOperationOutcome) { +List issues = ((BaseOperationOutcome) result).getIssue(); +if (!issues.isEmpty()) { +exchange.getOut().setFault(true); Review comment: Will set the exception on the exchange instead This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350332#comment-16350332 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165645387 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirProducer.java ## @@ -0,0 +1,51 @@ +/** + * 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.gclient.IClientExecutable; +import org.apache.camel.Exchange; +import org.apache.camel.impl.DefaultProducer; + +/** + * The fhir producer. It simply retrieves a {@link IClientExecutable}, executes it and sets the result in the Camel exchange body. + */ +public class FhirProducer extends DefaultProducer { + +public FhirProducer(FhirEndpoint endpoint) { +super(endpoint); +} + +public void process(Exchange exchange) throws Exception { +IClientExecutable clientExecutable = (IClientExecutable) exchange.getIn().getHeaders().get(FhirConstants.FHIR_REQUEST); Review comment: I'll move this in the message body This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350329#comment-16350329 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165645213 ## File path: components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/component/fhir ## @@ -0,0 +1 @@ +class=org.apache.camel.component.fhir.FhirComponent Review comment: Done This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350104#comment-16350104 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth opened a new pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206 https://issues.apache.org/jira/browse/CAMEL-12221 Let's create a camel-fhir component based on [HAPI-FHIR](http://hapifhir.io/) and in particular it’s RESTful [client](http://hapifhir.io/doc_rest_client.html) and [Data Model](http://hapifhir.io/doc_fhirobjects.html). It also adds two new Camel data formats to parse FHIR objects to/from XML/JSON based on HAPI-FHIR’s [XML](https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java) and [JSON](https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java) parser. A Karaf feature is in the works. Thanks! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350105#comment-16350105 ] ASF GitHub Bot commented on CAMEL-12221: GitHub user johnpoth opened a pull request: https://github.com/apache/camel/pull/2206 [CAMEL-12221] Let's create a camel-fhir component https://issues.apache.org/jira/browse/CAMEL-12221 Let's create a camel-fhir component based on [HAPI-FHIR](http://hapifhir.io/) and in particular it’s RESTful [client](http://hapifhir.io/doc_rest_client.html) and [Data Model](http://hapifhir.io/doc_fhirobjects.html). It also adds two new Camel data formats to parse FHIR objects to/from XML/JSON based on HAPI-FHIR’s [XML](https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java) and [JSON](https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java) parser. A Karaf feature is in the works. Thanks! You can merge this pull request into a Git repository by running: $ git pull https://github.com/johnpoth/camel CAMEL-12221 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/2206.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2206 commit 45c4c9f334facf2fb8ebd155819b9d5cd90dc8ed Author: jpothDate: 2018-02-01T19:14:42Z [CAMEL-12221] Let's create a camel-fhir component > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350161#comment-16350161 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-362554585 A good start, but I think this needs a bit more "ease of use" and to work a bit more like the other camel data formats does. Keep up the work @johnpoth. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350155#comment-16350155 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165613523 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirEndpoint.java ## @@ -0,0 +1,46 @@ +/** + * 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 org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.impl.DefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; + +/** + * Represents a fhir endpoint. + */ +@UriEndpoint(scheme = "fhir", title = "FHIR", syntax = "fhir://", label = "fhir", producerOnly = true) Review comment: This syntax is wrong, you need to use `fhir:xxx` where xxx is required `@UriPath` options This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350157#comment-16350157 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165614680 ## File path: components/camel-fhir/src/main/resources/META-INF/services/org/apache/camel/component/fhir ## @@ -0,0 +1 @@ +class=org.apache.camel.component.fhir.FhirComponent Review comment: Need license header This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350158#comment-16350158 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165614505 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirTypeConverter.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.component.fhir; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.api.MethodOutcome; +import org.apache.camel.Converter; +import org.apache.camel.Exchange; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Converter +public final class FhirTypeConverter { + +private static final Logger LOGGER = LoggerFactory.getLogger(FhirTypeConverter.class.getName()); + +private FhirTypeConverter() { +// Helper class +} + +@Converter +public static String resourceToString(IBaseResource iBaseResource, Exchange exchange) { Review comment: Hmm maybe such a type converter is not so idea when you require those stuff to be on the exchange property. Sometimes a type converter is not the best thing to add, they should really ideally just be for basic type conversions. Consider removing this if possible. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350154#comment-16350154 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165613930 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirProducer.java ## @@ -0,0 +1,51 @@ +/** + * 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.gclient.IClientExecutable; +import org.apache.camel.Exchange; +import org.apache.camel.impl.DefaultProducer; + +/** + * The fhir producer. It simply retrieves a {@link IClientExecutable}, executes it and sets the result in the Camel exchange body. + */ +public class FhirProducer extends DefaultProducer { + +public FhirProducer(FhirEndpoint endpoint) { +super(endpoint); +} + +public void process(Exchange exchange) throws Exception { +IClientExecutable clientExecutable = (IClientExecutable) exchange.getIn().getHeaders().get(FhirConstants.FHIR_REQUEST); +if (clientExecutable == null) { +throw new UnsupportedOperationException("client executable must be set"); +} +Object result = clientExecutable.execute(); +if (result instanceof BaseOperationOutcome) { +List issues = ((BaseOperationOutcome) result).getIssue(); +if (!issues.isEmpty()) { +exchange.getOut().setFault(true); Review comment: Please do not use fault messages, this is really only for SOAP/JBI stuff and it should become deprcated and removed in the future (eg 3.0) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350159#comment-16350159 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165614160 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirProducer.java ## @@ -0,0 +1,51 @@ +/** + * 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.gclient.IClientExecutable; +import org.apache.camel.Exchange; +import org.apache.camel.impl.DefaultProducer; + +/** + * The fhir producer. It simply retrieves a {@link IClientExecutable}, executes it and sets the result in the Camel exchange body. + */ +public class FhirProducer extends DefaultProducer { + +public FhirProducer(FhirEndpoint endpoint) { +super(endpoint); +} + +public void process(Exchange exchange) throws Exception { +IClientExecutable clientExecutable = (IClientExecutable) exchange.getIn().getHeaders().get(FhirConstants.FHIR_REQUEST); Review comment: This seems a bit odd to use a header for such a thing. How will this header to be configured? Headers should be part of the message contract, and not "misused" for client stuff This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350156#comment-16350156 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165615028 ## File path: components/camel-fhir/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatURITest.java ## @@ -0,0 +1,94 @@ +/** + * 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 FhirXmlDataFormatURITest extends CamelTestSupport { + +private static final String PATIENT = +"http://hl7.org/fhir\;>" ++ "" ++ "" + + ""; +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() { +FhirContext fhirContext = FhirContext.forDstu3(); + +from("direct:marshal") +.setProperty(FhirConstants.FHIR_CONTEXT, constant(fhirContext)) Review comment: This smells, can this context not be set on the data format itself, its bad that end users have to setup this themselves. All the other data formats dont do this kind This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] >
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350153#comment-16350153 ] ASF GitHub Bot commented on CAMEL-12221: davsclaus commented on a change in pull request #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#discussion_r165613614 ## File path: components/camel-fhir/src/main/java/org/apache/camel/component/fhir/FhirEndpoint.java ## @@ -0,0 +1,46 @@ +/** + * 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 org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.impl.DefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; + +/** + * Represents a fhir endpoint. Review comment: Update this javadoc to give a short summary what this does as we grab this for the component overview documentation This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350125#comment-16350125 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-362549908 Thanks for reviewing @oscerd, I knew I missed something :) PR updated This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350131#comment-16350131 ] ASF GitHub Bot commented on CAMEL-12221: oscerd commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-362550322 Oh but, wait, you can merge yourself :-) Go for it @johnpoth :-D This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350127#comment-16350127 ] ASF GitHub Bot commented on CAMEL-12221: oscerd commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-362550026 I'll take a look at the build an then merge. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350126#comment-16350126 ] ASF GitHub Bot commented on CAMEL-12221: oscerd commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-362549987 Great :-) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CAMEL-12221) Let's create a camel-fhir component
[ https://issues.apache.org/jira/browse/CAMEL-12221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350172#comment-16350172 ] ASF GitHub Bot commented on CAMEL-12221: johnpoth commented on issue #2206: [CAMEL-12221] Let's create a camel-fhir component URL: https://github.com/apache/camel/pull/2206#issuecomment-362557552 Thanks @davsclaus for your comments! Will have a look This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Let's create a camel-fhir component > --- > > Key: CAMEL-12221 > URL: https://issues.apache.org/jira/browse/CAMEL-12221 > Project: Camel > Issue Type: New Feature >Reporter: John Poth >Priority: Major > > Let's create a camel-fhir component based on [HAPI-FHIR|http://hapifhir.io] > I can take care of the PR. -- This message was sent by Atlassian JIRA (v7.6.3#76005)