Hi Janine, 

The parser uses a default validation context to check the primitives.
The PID-2 field type is NM, so the parser checks for a number. In your case, the PID-2 field contains the 'OK' characters, that's why the validation fails.

To get around this problem you must create a ValidationContextImpl subclass and set to use it by your parser by calling the parser.setValidationContext() method.

Attached to this mail you will find the one I use (which is the original one with phone number checking deactivated).

Regards

Attachment: CustomValidation.java
Description: Binary data



Le 3 déc. 2009 à 14:19, Janine Graul a écrit :

Hi,

I'm using hapi 0.6. I receive messages from HL7 versions 2.1, 2.3 and 2.5.
I get a message with a String in PID-Segment Field #2. Like this:

PID||OK-0000359788|...

Hapi validates this message, sends a nak and doesn't call my processMessage(Message in). The Exception which is thrown is:

ca.uhn.hl7v2.model.DataTypeException: Failed validation rule: Matches the regular _expression_ (\+|\-)?\d*\.?\d*: Segment: PID (rep 0) Field #2

Could somebody tell me, why hapi verifies with a regular _expression_ from a numeric field? I thought the PID #2-1 is a ST-Field.

Janine
--
Sarah Kreuz, die DSDS-Siegerin der Herzen, mit ihrem eindrucksvollen           
Debütalbum "One Moment in Time". http://portal.gmx.net/de/go/musik

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to