You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mconner <mc...@brookdaleliving.com> on 2012/08/21 16:30:28 UTC
HL7 and Custom Models
I'm trying to use the HL7 component in Camel, but I have a custom model.
Outside of camel, I can do this with: new PipeParser(ModelClassFactory
theFactory)
However, I don't see any direct way to configure that in Camel. In
org.apache.camel.component.hl7.HL7Converter (camel-hl7-2.2.0), the parser is
hard-coded, and I don't see a simple way to configure it.:
static Message parse(String body, boolean validate) throws HL7Exception
{
// replace \n with \r as HL7 uses 0x0d = \r as segment terminators
and HAPI only parses with \r
body = body.replace('\n', '\r');
Parser parser = new PipeParser();
if (!validate) {
parser.setValidationContext(new NoValidation());
}
return parser.parse(body);
}
Is there a way to do this?
--
View this message in context: http://camel.465427.n5.nabble.com/HL7-and-Custom-Models-tp5717772.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HL7 and Custom Models
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Aug 22, 2012 at 9:16 PM, christian.ohr
<ch...@googlemail.com> wrote:
> Hi Claus,
>
> there are in fact a couple more things in the Wiki docs that needs to be
> fixed, clarified or extended (e.g. use of Terser language, and HL7-specific
> expressions/predicates). Since I contributed the code, I volunteer to do
> this, of course. However, I have no write access to
> https://cwiki.apache.org/confluence/display/CAMEL/HL7 - or is there a
> different way to achieve this?
>
Ah great we love contributions.
Read this page first how to edit the website and about the ICLA you
must fill out
http://camel.apache.org/how-do-i-edit-the-website.html
> Christian
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/HL7-and-Custom-Models-tp5717772p5717892.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: HL7 and Custom Models
Posted by "christian.ohr" <ch...@googlemail.com>.
Hi Claus,
there are in fact a couple more things in the Wiki docs that needs to be
fixed, clarified or extended (e.g. use of Terser language, and HL7-specific
expressions/predicates). Since I contributed the code, I volunteer to do
this, of course. However, I have no write access to
https://cwiki.apache.org/confluence/display/CAMEL/HL7 - or is there a
different way to achieve this?
Christian
--
View this message in context: http://camel.465427.n5.nabble.com/HL7-and-Custom-Models-tp5717772p5717892.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HL7 and Custom Models
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Aug 22, 2012 at 12:23 AM, christian.ohr
<ch...@googlemail.com> wrote:
> Yes, as of 2.11 you can configure a dedicated HAPI-Parser instance to be used
> for parsing, and of course you can configure this parser as you wish (with
> regards to ValidationContext, ModelClassFactory etc.) using the
> HL7DataFormat#setParser method.
>
Ah yeah I spotted that in the code now as well. I have updated the
wiki docs, adding the new option.
> Until then, your workaround would be to write your own Camel Processor
> instead of using the Camel HL7 DataFormat.
>
> cheers
> Christian
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/HL7-and-Custom-Models-tp5717772p5717805.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: HL7 and Custom Models
Posted by "christian.ohr" <ch...@googlemail.com>.
Yes, as of 2.11 you can configure a dedicated HAPI-Parser instance to be used
for parsing, and of course you can configure this parser as you wish (with
regards to ValidationContext, ModelClassFactory etc.) using the
HL7DataFormat#setParser method.
Until then, your workaround would be to write your own Camel Processor
instead of using the Camel HL7 DataFormat.
cheers
Christian
--
View this message in context: http://camel.465427.n5.nabble.com/HL7-and-Custom-Models-tp5717772p5717805.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HL7 and Custom Models
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
I dont think this is possible to use a custom parser.
There is only an option to turn parsing on|off.
As we love contributions then fell free to work on a patch with this
functionality.
Mind that Camel 2.11 onwards has been upgraded to HAPI 2.x and uses
Apache Mina 2.x.
So the code on trunk is a bit different than older Camel releases.
On Tue, Aug 21, 2012 at 4:30 PM, mconner <mc...@brookdaleliving.com> wrote:
> I'm trying to use the HL7 component in Camel, but I have a custom model.
> Outside of camel, I can do this with: new PipeParser(ModelClassFactory
> theFactory)
>
> However, I don't see any direct way to configure that in Camel. In
> org.apache.camel.component.hl7.HL7Converter (camel-hl7-2.2.0), the parser is
> hard-coded, and I don't see a simple way to configure it.:
>
> static Message parse(String body, boolean validate) throws HL7Exception
> {
> // replace \n with \r as HL7 uses 0x0d = \r as segment terminators
> and HAPI only parses with \r
> body = body.replace('\n', '\r');
>
> Parser parser = new PipeParser();
> if (!validate) {
> parser.setValidationContext(new NoValidation());
> }
> return parser.parse(body);
> }
>
>
> Is there a way to do this?
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/HL7-and-Custom-Models-tp5717772.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen