Hi Ismet, You need to tell your parser to use your custom message type instead of the default one that comes with HAPI. Essentially, by default, when HAPI finds ADT^A01 in MSH-9, the parser uses a "ModelClassFactory" to figure out which message structure to instantiate, and by default it chooses the ones that ship with HAPI. What you need to do is get it to use your classes instead.
There are a bunch of ways of doing this, but I think the easiest one is to create a CustomModelClassFactory and inform it of the base package you have put your structures in (de.joho.portal.hapi.costum in your case I assume), the pass this factory to your parser. See http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/CustomModelClassFactory.htmlfor a bit of information. We could probably use some better documentation around this actually.. James 2011/3/23 Çelebi, Ismet <[email protected]> > Thank you so much for your help everybody. I would like to share my work > I have done till now. > > I did not wante to modify the current hapi code, so I made an extended > class of ADT_A01. > > Finally I am getting a ClassCastException, which I can’t tell why. > > > > *java.lang.ClassCastException*: ca.uhn.hl7v2.model.v24.message.ADT_A01 > cannot be cast to de.joho.portal.hapi.costum.v24.message.ADT_A01 > > at de.joho.portal.socket.HL7Server.handleConnection(* > HL7Server.java:99*) > > at de.joho.portal.socket.HL7Server.main(*HL7Server.java:153*) > > > > All I am doing is using the modified ADT_A01. > > Line 99: ADT_A01 adtMsg = (ADT_A01) hapiMsg; > > What am I doing wrong? > > Would you suggest just to modify the original ADT-A01 class and add > ZBE.java into the package ca.uhn.hl7v2.model.v24.segment ? > > > > > ------------------------------ > > *Von:* Charles D. Fisher [mailto:[email protected]] > *Gesendet:* Mittwoch, 23. März 2011 16:24 > *An:* Çelebi, Ismet > *Cc:* [email protected] > *Betreff:* [?? Probable Spam] Re: [HAPI-devel] ZBE-Segment > > > > We tried using generic classes for our Z-segment (ZLR, "Z segment for Lab > Reporting") for version 2.3 ORU^R01, but ultimately found it simpler to just > build a new segment class out of the available field classes, using other > segment sources (it's open source!) as models. > > Attached is the source for the ZLR segment class we built > > *(See attached file: ZLR.java)* > > And the source for the ca.uhn.hl7v2.model.v23.group.ORU_R01_ORDER_OBSERVATION > class, modified from the original generated code to include our ZLR segment: > > *(See attached file: ORU_R01_ORDER_OBSERVATION.java)* > > We have been using this satisfactorily for 8 years. > > Charles Fisher > Division of Epidemiology > New York State Dept. of Health > 518-474-2735 > > [image: Inactive hide details for Çelebi, Ismet <[email protected]>]Çelebi, > Ismet <[email protected]> > > *Çelebi, Ismet** <[email protected]>* > > 2011_03_22 11:30 AM > > To > > > <[email protected]> > > cc > > Subject > > > [HAPI-devel] ZBE-Segment > > > > > Hi Folks, > > In our ADT-Messages there is a segment called ZBE. I can not use this > segment via HAPI. > Is there a way to include this into HAPI or how am I going to implement > this into HAPI? > > ZBE|5007|20110316124300||UPDATE > > Definition of this ZBE segment is: > > Type Length Name > EI 250 TransferID > TS 250 Start of Transfer > TS 250 End of Transfer > ST 250 Action code ZBE > > > Cheers, > Ismet > > > St. Josefs-Hospital Wiesbaden GmbH, Beethovenstrasse 20, 65189 Wiesba den > Telefon 0611/177-0, Telefax 0611/177-1185, E-Mail: [email protected] > Geschaeftsfuehrer: Karl-Josef Schmidt, stellv. Geschaeftsfuehrer: Pete r > Pfaffenberger Registergericht: AG Wiesbaden, HR B 21935 > ------------------------------------------------------------------------------ > Enable your software for Intel(R) Active Management Technology to meet the > growing manageability and security demands of your customers. Businesses > are taking advantage of Intel(R) vPro (TM) technology - will your software > be a part of the solution? Download the Intel(R) Manageability Checker > today! http://p.sf.net/sfu/intel-dev2devmar > _______________________________________________ > Hl7api-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > IMPORTANT NOTICE: This e-mail and any attachments may contain confidential or > sensitive information which is, or may be, legally privileged or otherwise > protected by law from further disclosure. It is intended only for the > addressee. If you received this in error or from someone who was not > authorized to send it to you, please do not distribute, copy or use it or any > attachments. Please notify the sender immediately by reply e-mail and delete > this from your system. Thank you for your cooperation. > > > > ------------------------------------------------------------------------------ > Enable your software for Intel(R) Active Management Technology to meet the > growing manageability and security demands of your customers. Businesses > are taking advantage of Intel(R) vPro (TM) technology - will your software > be a part of the solution? Download the Intel(R) Manageability Checker > today! http://p.sf.net/sfu/intel-dev2devmar > _______________________________________________ > Hl7api-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > >
<<image004.gif>>
<<image005.gif>>
<<image001.gif>>
------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________ Hl7api-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hl7api-devel

