OCL validation example - live vs. batch validation [message #423624] |
Fri, 03 October 2008 09:58  |
Eclipse User |
|
|
|
Is it possible to use an extra *.ocl file for the live validation.
In the example it is only used for batch validation.
The reason is that I need to define a different context for live
validation (normally the context is the object that triggered the
validation). So also a different approach (e.g. solely in the extension
points) would be acceptable for me.
Thanks,
Bernd
|
|
|
|
|
Re: OCL validation example - live vs. batch validation [message #423633 is a reply to message #423631] |
Fri, 03 October 2008 11:42  |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, Bernd,
The validator will always request constraints only for the objects that
actually changed.
You can implement a listener (on the command stack,
TransactionalEditingDomain, or whatever is appropriate) to detect when
an object of that kind has changed, and perform a batch validation over
your root object.
Or, you can define a live-mode constraint that targets the EClass in
question and implement it, in Java, to perform validation on the root
element (effectively, a nested validation operation). The result status
can be return by your constraint as is, because we support
multi-statuses. Your constraint can use the
IValidationContext::{put,get}ConstraintData(...) API to put a token that
it can check to prevent multiple invocations of the constraint in a
validation operation from repeating the nested validation.
HTH,
Christian
Bernd Mühlböck wrote:
> I would like to validate my root element (and its children) each time
> any object (of a certain kind) is changed.
>
> I tried to simply changed the mode from "Batch" to "Live" (and added the
> targets), but that didn't work out as I had hoped.
>
> Cheers,
> Bernd
>
>
> Christian W. Damus wrote:
>> Hi, Bernd,
>>
>> This OCL constraint provider is simply an example. Your own provider
>> can do whatever it likes, reading different OCL files for different
>> purposes. All that the Validation Framework requires is that your
>> provider supply it with the appropriate live-mode constraints
>> ("appropriateness" being defined by your provider) when asked for live
>> constraints.
>>
>> I didn't understand your statement about context. Do you mean that
>> you need live validation to be triggered for different objects than
>> the ones that were changed during the interval?
>>
>> Cheers,
>>
>> Christian
>>
>> Bernd Mühlböck wrote:
>>> Is it possible to use an extra *.ocl file for the live validation.
>>> In the example it is only used for batch validation.
>>>
>>> The reason is that I need to define a different context for live
>>> validation (normally the context is the object that triggered the
>>> validation). So also a different approach (e.g. solely in the
>>> extension points) would be acceptable for me.
>>>
>>> Thanks,
>>> Bernd
|
|
|
Powered by
FUDForum. Page generated in 0.03663 seconds