Yes, I can reproduce this problem. It seems that the MSH segment is not
allowed e.g. for A01 message by the validator, which is obviously nonsense.
Maybe James can enlighten this a bit.... potentially there's a bug in the
generator.

After all, when creating messages I don't see a need to create
superstructure messages, as you know which message you create. You still
have the problem that there is no common super-class or interface to ADT
messages, but their are ways to circumvent this, e.g. using the Terser
class:

Message m = new ADT_A01();
m.initQuickstart("ADT", "A01", "P");
// everything below works on a generic level
Terser t = new Terser(m);
t.set("/MSH-9-2", "A04");
t.set("/PID-3-1", "myIdentifier");
...

hope this helps
Christian


2013/6/19 sagarshah1983 <sagar.s...@citiustech.com>

>
> Thanks Christian for sharing this link.
> I was trying to use ADT_AXX structure only, but found few issues with
> generating HL7 message with ADT_AXX and did not find a way to solve that
> out. So thought of checking for any other generic structure for ADT
> messages.
> Anyways, here's the issue I am facing.
> Code Snippet.
>
> ADT_AXX adt = new ADT_AXX();
> MSH msh = adt.getMSH();
> ....
> msh.getMsh9_MessageType().getMsg1_MessageCode().setValue("ADT");
> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A28");
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A28");
>
> Above works perfectly fine, but the moment I change last two lines to
> reflect A01, it fails.
>
> msh.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("A01");
> msh.getMsh9_MessageType().getMsg3_MessageStructure().setValue("ADT_A01");
>
> Error details:
> Caused by: ca.uhn.hl7v2.validation.ValidationException: Message
> (superstructure ADT_AXX) of type ADT_A01 must not have content in MSH
>
> Any advice is appreciated.
>
> Regards,
> Sagar Shah
>
>
>
> Christian Ohr-2 wrote:
> >
> > If you are using HAPI 2.1, you should have a look at this:
> >
> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleSuperStructures.html
> > .
> >
> > cheers
> > Christian
> >
> >
> > 2013/6/18 sagarshah1983 <sagar.s...@citiustech.com>
> >
> >>
> >> That would be really great for me.
> >> Appreciate your reply and time for the same.
> >>
> >> Regards,
> >> Sagar Shah
> >>
> >> LDH-2 wrote:
> >> >
> >> > I am not aware of one in 1.x... I don't know 2.x well enough yet. I am
> >> on
> >> > the road, but I can send out later the type of code I have used to be
> >> adt
> >> > generic.
> >> >
> >> >
> >> >
> >> > ___________________________________________
> >> > Laurent Hasson (via my BlackBerry)
> >> > email: l...@360fresh.com
> >> > cell: 646-283-2186
> >> > twitter: @ldhasson
> >> >
> >> > -----Original Message-----
> >> > From: sagarshah1983 <sagar.s...@citiustech.com>
> >> > Date: Tue, 18 Jun 2013 08:53:15
> >> > To: <hl7api-devel@lists.sourceforge.net>
> >> > Subject: [HAPI-devel]  Generic class for ADT message
> >> >
> >> >
> >>
> ------------------------------------------------------------------------------
> >> > This SF.net email is sponsored by Windows:
> >> >
> >> > Build for Windows Store.
> >> >
> >> > http://p.sf.net/sfu/windows-dev2dev
> >> >
> >> >
> >>
> ------------------------------------------------------------------------------
> >> > This SF.net email is sponsored by Windows:
> >> >
> >> > Build for Windows Store.
> >> >
> >> > http://p.sf.net/sfu/windows-dev2dev
> >> > _______________________________________________
> >> > Hl7api-devel mailing list
> >> > Hl7api-devel@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35639472.html
> >> Sent from the hl7api-devel mailing list archive at Nabble.com.
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> This SF.net email is sponsored by Windows:
> >>
> >> Build for Windows Store.
> >>
> >> http://p.sf.net/sfu/windows-dev2dev
> >> _______________________________________________
> >> Hl7api-devel mailing list
> >> Hl7api-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> >>
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Windows:
> >
> > Build for Windows Store.
> >
> > http://p.sf.net/sfu/windows-dev2dev
> > _______________________________________________
> > Hl7api-devel mailing list
> > Hl7api-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
> >
> >
> --
> View this message in context:
> http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35642054.html
> Sent from the hl7api-devel mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to