Hi All,
I'm definitely leaning towards the idea that we should fix this as
proposed. While it's true that the docs mention this behaviour, ultimately
it boils down to the fact that Message#generateAck() isn't respecting the
ModelClassFactory assigned to the message, which is weird. The fix is
actually just a one-liner in DefaultApplication, so it shouldn't be an
issue to fix (I have an approach in mind but I want to get a unit test
together before actually trying it out).
(Jens, thanks for pointing out the documentation part- That needs to be
updated when this fix is applied. I find it very odd that I obviously knew
about this issue given that I documented it, but didn't just fix it.
Hindsight is 20/20 I suppose. :)
Cheers,
James
On Mon, Jan 16, 2012 at 3:41 AM, Jens Kristian Villadsen <j...@c3a.dk> wrote:
>
> But I agree in that it would be very useful if the implementation was
changed as already proposed.
>
> 2012/1/16 christian ohr <christian....@icw.de>
>>
>> The problem in this case is that you are required to include the 2.4
>> structures libraries into your classpath. And, if you don't know the
>> version(s) of the received messages in advance (and that's one good
reason
>> to use the CanonicalModelClassfactory 2.6) you would be required to
include
>> all structure libraries....
>> The expectation here is to generate a HL7 v2.6 ACK message and to replace
>> the version number in MSH-12 with 2.4, so after serialization of the
message
>> it looks like it was created with a standard ModelClassFactory. Any
>> opinions?
>>
>> cheers
>> Christian
>>
>> I already
>>
>>
>> Jens Kristian Villadsen wrote:
>> >
>> > Where is the problem? If you look at
>> >
http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/model/Message.html#generateACK%28%29
,
>> > you will see that the following is stated:
>> >
>> > The ACK generated will be of the same version as the value of MSH-12 in
>> > this message (as opposed to the version of the message class instance,
if
>> > they are different)
>> >
>> > - which essentially means that if 'messageString' MSH-12 component says
>> > 2.4, the parsed message that the parser returns will be of class type
2.6,
>> > because of the CanonicalModelClassFactory("2.6"). However, generateACK
>> > does
>> > not use the CanonicalModelClassFactory, as stated in the doc, and will
>> > always return the correct class type version - in this example 2.4. So
>> > according to the doc, it cannot be a bug
>> >
>> > 2012/1/11 Rahul Somasunderam <r...@certifydatasystems.com>
>> >
>> >> The bug Id is 3471571.
>> >>
>> >> On Jan 9, 2012, at 4:42 PM, James Agnew wrote:
>> >>
>> >> Hi Rahul,
>> >>
>> >> Looks like you have uncovered a bug in HAPI. I tried it locally and I
see
>> >> the same thing as you: Basically, the "generateACK()" method is not
>> >> actually honoring your ModelClassFactory, so it's trying to
instantiate
>> >> the
>> >> 2.4 version of the structure.
>> >>
>> >> The easiest workaround is probably to change the valud of MSH-12 on
your
>> >> message to "2.6" right before calling "generateACK". This will have
the
>> >> side effect that the MSH-12 value in the ACK message will then be set
to
>> >> "2.6", so you may need to change it back before doing whatever you are
>> >> doing with it.
>> >>
>> >> If you don't mind to submit a report, that would be great. I'm sure we
>> >> can
>> >> get this fixed for the next release of HAPI (which we should have a
beta
>> >> of
>> >> fairly soon).
>> >>
>> >> Cheers,
>> >> James
>> >>
>> >> On Mon, Jan 9, 2012 at 12:36 PM, Rahul Somasunderam <
>> >> r...@certifydatasystems.com> wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> I'm using Canonical MCF to parse a message. Then I'm using
generateACK
>> >>> on
>> >>> the message. This causes a ClassNotFoundException. I'm using HAPI
1.2,
>> >>> if
>> >>> that matters.
>> >>>
>> >>> This is my code (in Groovy)
>> >>>
>> >>> def messageString = context.messageContent
>> >>> def cmcf = new CanonicalModelClassFactory("2.6")
>> >>> def parser = new PipeParser(cmcf)
>> >>> parser.setValidationContext(new NoValidation())
>> >>> def message = parser.parse(messageString)
>> >>>
>> >>> ... (app logic) ...
>> >>>
>> >>> def ack = message.generateACK()
>> >>> return ack.encode()
>> >>>
>> >>> This is the most significant part of the exception:
>> >>>
>> >>> ca.uhn.hl7v2.HL7Exception: Can't instantiate ACK of class
>> >>> ca.uhn.hl7v2.model.v24.message.ACK: java.lang.ClassNotFoundException
>> >>> at
>> >>>
ca.uhn.hl7v2.app.DefaultApplication.makeACK(DefaultApplication.java:150)
>> >>> at
>> >>>
ca.uhn.hl7v2.model.AbstractMessage.generateACK(AbstractMessage.java:213)
>> >>> at
>> >>>
ca.uhn.hl7v2.model.AbstractMessage.generateACK(AbstractMessage.java:205)
>> >>> at
>> >>>
messaging.MessageReceiverService$$ENLWsoN6.process(MessageReceiverService.groovy:24)
>> >>>
>> >>>
>> >>> Is there a known workaround for this? Do you want me to submit a test
>> >>> case/file a report?
>> >>>
>> >>> R,
>> >>> rahul
>> >>>
>> >>>
>> >>>
>> >>>
------------------------------------------------------------------------------
>> >>> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a
>> >>> complex
>> >>> infrastructure or vast IT resources to deliver seamless, secure
access
>> >>> to
>> >>> virtual desktops. With this all-in-one solution, easily deploy
virtual
>> >>> desktops for less than the cost of PCs and save 60% on VDI
>> >>> infrastructure
>> >>> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
>> >>> _______________________________________________
>> >>> Hl7api-devel mailing list
>> >>> Hl7api-devel@lists.sourceforge.net
>> >>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >>
------------------------------------------------------------------------------
>> >> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a
complex
>> >> infrastructure or vast IT resources to deliver seamless, secure
access to
>> >> virtual desktops. With this all-in-one solution, easily deploy virtual
>> >> desktops for less than the cost of PCs and save 60% on VDI
infrastructure
>> >> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
>> >> _______________________________________________
>> >> Hl7api-devel mailing list
>> >> Hl7api-devel@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>> >>
>> >>
>> >
>> >
>> > --
>> > Med venlig hilsen / Kind regards
>> >
>> > Jens Kristian Villadsen
>> > cand.polyt
>> > Systemudvikler / System developer
>> > Cetrea A/S, Denmark
>> >
>> > phone : +45 38 40 05 81
>> > address: Brendstrupgårdsvej 21F, DK-8200 Aarhus N.
>> > e-mail : j...@cetrea.com
>> > w^3 : http://www.cetrea.com/
>> >
>> >
------------------------------------------------------------------------------
>> > RSA(R) Conference 2012
>> > Mar 27 - Feb 2
>> > Save $400 by Jan. 27
>> > Register now!
>> > http://p.sf.net/sfu/rsa-sfdev2dev2
>> > _______________________________________________
>> > 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/generateACK-and-CanonicalMCF-tp33109017p33146099.html
>> Sent from the hl7api-devel mailing list archive at Nabble.com.
>>
>>
>>
------------------------------------------------------------------------------
>> RSA(R) Conference 2012
>> Mar 27 - Feb 2
>> Save $400 by Jan. 27
>> Register now!
>> http://p.sf.net/sfu/rsa-sfdev2dev2
>> _______________________________________________
>> Hl7api-devel mailing list
>> Hl7api-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
>
> --
> Med venlig hilsen / Kind regards
>
> Jens Kristian Villadsen
> cand.polyt
> Systemudvikler / System developer
> Cetrea A/S, Denmark
>
> phone : +45 38 40 05 81
> address: Brendstrupgårdsvej 21F, DK-8200 Aarhus N.
> e-mail : j...@cetrea.com
> w^3 : http://www.cetrea.com/
>
>
------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel