From: Christian O. <chr...@gm...> - 2013-09-25 18:26:13
|
No, validation rules are additive. Particularly, message rules (e.g. with a terser expression) do not override primitive rules, they further restrict the content of a specific field within the bounds of the rules of its (primitive) type! I would be reluctant to change the default primitive rules, though, as they are part of the core HL7 standard... Anyway, if you need a different set of primitive validation rules, just take a look at the sources of DefaultValidationBuilderWithoutTN as starting point and define your own builder. btw MSH-6 is not a TN field - message date is MSH-7 Christian 2013/9/25 Andrew Bowden <And...@rc...> > Thanks Christian,**** > > ** ** > > That solved my problem but I’m still curious about overriding the default > validation, is it possible to override the predicate that is set in the > DefaultValidationWithoutTNBuilder? For example, for a specific segment, if > I am interested in allowing a space in the TN field using the predicate > matches(String), I find that the compiler continues to complain at the > calling of the super. Eg. **** > > ** ** > > <code> **** > > public class newValidation extends DefaultValidationWithoutTNBuilder{**** > > @Override **** > > protected void configure(){**** > > super.configure();**** > > > forAllVersions().message("ADT","A01").terser("MSH-6",matches(“.*”));**** > > }}**** > > </code>**** > > ** ** > > I get a compile time error about failing a primitive for date-time.**** > > ** ** > > Is there an easy way to override the default primitive? > > Many thanks for your help.**** > > ** ** > > Andrew**** > > ** ** > > *From:* Christian Ohr [mailto:chr...@gm...] > *Sent:* Monday, 23 September 2013 5:22 PM > *To:* Andrew Bowden > *Cc:* hl7...@li... > *Subject:* Re: [HAPI-devel] HAPI 2.1 and overriding validation**** > > ** ** > > Hi Andrew,**** > > note that there is only a (primitive) validation for TN, not for XTN, in > DefaultValidationBuilder.**** > > And, there is the DefaultValidationWithoutTNBuilder for exactly the reason > you mentioned. So subclass this builder instead.**** > > Hope this helps > Christian**** > > ** ** > > 2013/9/23 Andrew Bowden <And...@rc...>**** > > Hi there,**** > > **** > > I have recently started using HAPI and am impressed by the amount of > function in the toolkit. I have been struggling for about a week with the > correct way to override the validation and am hoping that someone on this > list can help me.**** > > **** > > I have a segment that fails validation for an XTN type (as I am out of the > US), I would like to keep validation on but change the validation for this > segment. I realize that I can turn off validation for the message but am > curious as to the best way to approach this problem. **** > > **** > > I have tried the HAPI by example method of extending the > DefaultValidationBuilder and overriding the configure method, however the > first call to super overrides the rule that I have provided to the method. > I have also seen an example of extending the ValidationContextImpl ( > http://osdir.com/ml/medical.hl7/2008-07/msg00003.html), but this appears > to be an older approach to the problem.**** > > **** > > I would appreciate any help that can be provided to point me in the right > direction.**** > > **** > > Andrew**** > > > > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, > SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack > includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel**** > > ** ** > |