Hi Eugene,
The easiest way is to use the specific message structure for the message
type you are trying to create. For example, to create an ADT^A01 message
you could follow the instructions here:
http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/CreateAMessage.html
Cheers,
James
On Mon, Aug 6, 2012 at 11:30 AM, Eugene Berman
<eugene.ber...@mulesoft.com>wrote:
> Hi to all HAPI developers!
>
> I'm very new to HL7 and HAPI so I apologize in advance if my question is
> too stupid or makes no sense at all. Here's what I'm trying to do. I'm
> trying to write a piece of software that takes a message name and version
> as input parameters and generates new HL7 message as a HAPI object. The
> next step is to populate an MSH segment with some predefined settings. I
> generate new message as follows:
>
> CanonicalModelClassFactory factory = new
> CanonicalModelClassFactory(version);
> Class messageClass = factory.getMessageClass(messageStructure, version,
> false);
> GenericMessage hl7Message = (GenericMessage) messageClass.newInstance();
>
> My question is, how do I get an MSH segment out of it? Should I use:
>
> AbstractSegment mshSegment = (AbstractSegment)hl7Message.get("MSH");
>
> If yes, how then I set things like a sequence number, message type, etc?
> Does anyone have an example?
>
> Thanks a lot!
>
> Eugene
>
> --
> Eugene Berman
> Sr. Enterprise Solutions Engineer
> ----
> MuleSoft Inc.
> 77 Geary Street, Ste. 400
> San Francisco, CA 94108
> Office: 415 229 2063
> Website: http://www.mulesoft.com <http://www.mulesoft.com/>
> ---
> Entia non sunt multiplicanda praeter necessitatem!
>
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel