Re: [HAPI-devel] [newbie] casting incoming message to the right type

2012-03-16 Thread LDH
I created simple wrapper classes around message types and do the following: public HL7MSH(Message Msg) throws DataTypeException, HL7Exception { _Msh = (MSH) Msg.get("MSH"); _Version = _Msh.getVersionID().getVersionID().getValue(); _Code = _Msh.getMsh9_Messag

[HAPI-devel] custom Datatype only

2012-03-16 Thread Gabriel Euzet
Dear List ! I receive HL7 messages which are hl7 compliant excepted for XTN datatype (fields 1 and 12 are permuted). So I would need to create my own XTN.class with a correct behaviour (and use custom package). But, to make it works, It seems that I need to re-write all segments which reference X

Re: [HAPI-devel] [newbie] casting incoming message to the right type

2012-03-16 Thread Gabriel Euzet
Hi Sanjay, I have the same problem. ca.uhn.hl7v2.model.Message has no method to get the MSH segment until you cast it to ADT_A01 ... I found 3 ways to identify the message type : * use reflection to invoke getMSH(), again to invoke getMessageType(), and again for methods getMessageStructure() an