Re: [HAPI-devel] Checking for the existence of a segment or group

2013-07-03 Thread James Agnew
Oops, looks like Christian beat me to it. :) James On Wed, Jul 3, 2013 at 7:41 AM, James Agnew wrote: > Hi Ian, > > The cleaner alternative, which was just added in HAPI 2.1 oddly enough is > as follows: > > if (!hl7Message.getINSURANCE(0).getIN1().isEmpty()) { > .. blah .. > } > > The

Re: [HAPI-devel] Checking for the existence of a segment or group

2013-07-03 Thread James Agnew
Hi Ian, The cleaner alternative, which was just added in HAPI 2.1 oddly enough is as follows: if (!hl7Message.getINSURANCE(0).getIN1().isEmpty()) { .. blah .. } There is also the somewhat uglier alternative which would work in older releases: if (!hl7Message.getINSURANCE(0).getAll("IN

Re: [HAPI-devel] Checking for the existence of a segment or group

2013-07-03 Thread Christian Ohr
Try if hl7Message.getINSURANCE(0).getIN1().isEmpty() works for you. And, have a look at the Validation framework in HAPI (some examples in http://hl7api.sourceforge.net/devbyexample.html) - basically you define your expectations as MessageRules and associate these rules to a ValidationContext. c