EObjectValidator.validate() is called multiple times for models that are based on several packages [message #1117290] |
Thu, 26 September 2013 09:26 |
Maarten Bezemer Messages: 117 Registered: February 2012 |
Senior Member |
|
|
Hello,
I am using models that are based on multiple ecore packages.
For each package I have multiple (combined) EVL validation rules registered.
The combined EVL rules start off with the default EObjectValidator.
Since I have multiple ecore packages, not all rules are combined since they are registered to their corresponding package. (Which is a good thing!)
I manually find the used packages, and invoke the validation rules of each of these packages.
This results in the EObjectValidator rules getting activated multiple times. This is a waste of time and this result in errors on circular contained objects (because EObjectValidator does not expect to be called multiple times with the same context).
EObjectValidator sets ROOT_OBJECT to detect these circular containment problems.
When CompositeEValidator#validate(EClass, EObject, DiagnosticChain, Map<Object, Object>) gets modifies to check for this context entry just before the EObjectValidator gets invoked, so it can be skipped, the problem is solved.
Is this an acceptable solution and should I open a bug report and provide such a patch? Or is this too much of a 'hack'?
Regards,
Maarten
|
|
|
Re: EObjectValidator.validate() is called multiple times for models that are based on several packag [message #1117833 is a reply to message #1117290] |
Thu, 26 September 2013 21:24 |
|
Hi Maarten,
Please see comments below.
> I manually find the used packages, and invoke the validation rules of each of these packages.
I'm not sure I understand what "manually" means in this context
> This is a waste of time and this result in errors on circular contained objects (because EObjectValidator does not expect to be called multiple times with the same context).
"circular contained objects" sounds scary
> Is this an acceptable solution and should I open a bug report and provide such a patch? Or is this too much of a 'hack'?
I'm not sure I can fully appreciate the nature of the problem. A minimal example and a description of what's expected/observed in the bugzilla would help a lot - a patch would be fantastic
Cheers,
Dimitris
|
|
|
|
Powered by
FUDForum. Page generated in 0.02522 seconds