Hi Gunnar,
Thank you for the suggestions.
Actually, the way I started was using the Hibernate API to define the constraints from code. (Since FHIR is a model that I do not own) The alternative would have been to define the constraints in XML (- not overly happy with that).
The programmed constraints code became quite fast hard to maintain.
So what I did was to define a number of interfaces that correspond to FHIR model classes, added the properties I need to validate, and annotated them.
Then wrote a "constraint collector" that walks through the dummy interfaces, extracts the constraints using the Validation Metadata API and applies them to the real classes using the Hibernate API.
Now I can work as if I owned the FHIR sources.
Now, following your suggestion, I should not use validation groups for identifying the "input sources", but rather have the constraint collector create different constraints for the inputs. I might add some custom annotations to the constraint annotations - will give it a try.
Thank you, Csaba
|