Thank you all, very helpful.

On Thu, Jan 10, 2013 at 7:55 AM, Laurent Hasson <l...@360fresh.com> wrote:

> This is the kind of code we have been using for that purpose:****
>
> ** **
>
>                       try****
>
>                        {****
>
>                          _PID = new HL7PID((PID)Msg.get("PID"));****
>
>                        }****
>
>                       catch (HL7Exception E) { }****
>
>                       ****
>
>                       try****
>
>                        {****
>
>                          Segment segment = (Segment)Msg.get("PV1");****
>
>                          if (segment != null)****
>
>                           _PV = new HL7PV((PV1)segment,
> (PV2)Msg.get("PV2"));****
>
>                        }****
>
>                       catch (HL7Exception E) {  }****
>
>                        ****
>
>                       try****
>
>                        {****
>
>                          Structure[] Structs = Msg.getAll("DG1");****
>
>                          if (Structs != null && Structs.length > 0)****
>
>                           {****
>
>                             _DG1 = new HL7DG1[Structs.length];****
>
>                             for (int i = 0; i < Structs.length; ++i)****
>
>                              _DG1[i] = new HL7DG1((DG1)Structs[i]);****
>
>                           }****
>
>                        }****
>
>                       catch (HL7Exception E)  {  }****
>
> ** **
>
> We do a few things:****
>
> **-          **We have our own structures to capture the elements of a
> particular message we care about (here, HL7PID, HL7DG1 etc…)****
>
> **-          **We have try-catch blocks because HAPI can throw an
> exception if the segment doesn’t exist.****
>
> ** **
>
> This has been working ok for us. ****
>
> ** **
>
> ___________________________________________________________****
>
> Laurent Hasson****
>
> Co-Founder and CTO****
>
> 360Fresh Inc.****
>
> cell: 646.283.2186****
>
> ** **
>
> "Strange women lyin' in ponds distributin' swords is no basis for a system
> of government" - Dennis****
>
> ** **
>
> This e-mail may contain confidential and/or privileged information. This
> information is intended only for the use of the individual(s) and
> entity(ies) to whom it is addressed. If you are the intended recipient,
> further disclosures are prohibited without proper authorization. If you are
> not the intended recipient (or have received this e-mail in error) please
> notify the sender immediately and destroy this e-mail. Any unauthorized
> copying, disclosure or distribution of the material in this e-mail is
> strictly forbidden and possibly a violation of federal or state law and
> regulations.****
>
> ** **
>
> -----Original Message-----
> From: Christian Ohr [mailto:christian....@gmail.com]
> Sent: Thursday, January 10, 2013 2:58 AM
> To: steven touw
> Cc: hl7api-devel@lists.sourceforge.net
> Subject: Re: [HAPI-devel] reading HL7 generically
>
> ** **
>
> Forgot to mention that you currently still need to include the
> hapi-structure jar(s) in your classpath, depending on the HL7****
>
> version(s) you expect. You can also use the CanonicalModelClassFactory
> with your parser, then you only need the latest structure jar.****
>
> In HAPI 2.1 (not released yet), you will be able to omit the structure
> jars completely.****
>
> ** **
>
> Christian****
>
> ** **
>
> 2013/1/10 Christian Ohr <christian....@gmail.com>:****
>
> > In general, you don't have to cast to a specific message structure****
>
> > class: the parser returns a Message object, and you can obtain ****
>
> > segments using message.get("segment-name") , and from a Segment you ****
>
> > can obtain a field using segment.getField(field-number). If that's not *
> ***
>
> > generic enough, take a look at ca.uhn.hl7v2.preparser.PreParser.****
>
> >** **
>
> > cheers****
>
> > Christian****
>
> >** **
>
> > 2013/1/9 steven touw <tou...@gmail.com>:****
>
> >> Hello,****
>
> >> I am new to HL7 as well as it's contents.  I hope this question isn't *
> ***
>
> >> too stupid.****
>
> >> I'm trying to read from messages generically - is there any way to ****
>
> >> grab particular segments without having to cast the Message object ****
>
> >> into ADT_A05 for example?  I could have various ADT_* and trying to ***
> *
>
> >> find the best way to do this...****
>
> >>** **
>
> >> Thanks,****
>
> >> Steve****
>
> >>** **
>
> >> ---------------------------------------------------------------------**
> **
>
> >> --------- Master Java SE, Java EE, Eclipse, Spring, Hibernate, ****
>
> >> JavaScript, jQuery and much more. Keep your Java skills current with **
> **
>
> >> LearnJavaNow -****
>
> >> 200+ hours of step-by-step video tutorials by Java experts.****
>
> >> SALE $49.99 this month only -- learn more at:****
>
> >> http://p.sf.net/sfu/learnmore_122612****
>
> >> _______________________________________________****
>
> >> Hl7api-devel mailing list****
>
> >> Hl7api-devel@lists.sourceforge.net****
>
> >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel****
>
> >>** **
>
> ** **
>
>
> ------------------------------------------------------------------------------
> ****
>
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC,
> Windows 8 Apps, JavaScript and much more. Keep your skills current with
> LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and
> experts. ON SALE this month only -- learn more at:****
>
> http://p.sf.net/sfu/learnmore_122712****
>
> _______________________________________________****
>
> Hl7api-devel mailing list****
>
> Hl7api-devel@lists.sourceforge.net****
>
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel****
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to