Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » OCL validation example - live vs. batch validation
OCL validation example - live vs. batch validation [message #423624] Fri, 03 October 2008 13:58 Go to next message
Bernd Mühlböck is currently offline Bernd MühlböckFriend
Messages: 46
Registered: July 2009
Member
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 #423628 is a reply to message #423624] Fri, 03 October 2008 15:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

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
Re: OCL validation example - live vs. batch validation [message #423631 is a reply to message #423628] Fri, 03 October 2008 15:26 Go to previous messageGo to next message
Bernd Mühlböck is currently offline Bernd MühlböckFriend
Messages: 46
Registered: July 2009
Member
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
Re: OCL validation example - live vs. batch validation [message #423633 is a reply to message #423631] Fri, 03 October 2008 15:42 Go to previous message
Eclipse UserFriend
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
Previous Topic:[CDO] CDO fails to generate ID for non-CDO EMF object
Next Topic:[Teneo] upper case on only some generated column names
Goto Forum:
  


Current Time: Thu Apr 25 00:17:07 GMT 2024

Powered by FUDForum. Page generated in 0.03939 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top