[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[News.eclipse.technology.gmf] Re: Constraints in Ecore for GMF

Hi Madanagopal,

All your Ecore level constraints will get involved by GMF Diagram\Validate 
action if you enable it
in gmfgen.

With GMF audit rules you can define constraints involving additonal aspects 
for your domain model
from the diagraming perspective. For instance, best practices and modeling 
styles you would like to promote and
which may be violated while your domain model is still valid.
Moreover, you can define constraints for the diagram notation model to guard 
also some visual aspects.
As disscused earlier in gmf newsgroup, all audits map to EMFT Validation 
constraint definitions.

If you wish, keep all your constraints as basic EMF constraints and GMF 
editor can contribute with additional UI services.
Alternatively, use EMFT Validation framework to get cool OCL support and UI 
for constraint registry management.
Both mentioned above will be active in GMF generated diagram editors if 
enabled in gmfgen.

What you are trying to do is definition of an OCL like constraint as a basic 
EMF constraint which is not going to work.
Perhaps, you could try to initially model your constraints as GMF audits as 
you can segregate them in a separate validation
plugin later on. Just by copying the editor's plugin.xml fragment defining 
EMFT constraintProvider extension points.

This way you can focus on the constraint logic itself while getting all the 
EMFT extension point plumbing for free and having in-place rule
validation within the context of the target domain elements (in *.gmfmap). 
This should ensure that EMFT Validation registrations will be OK
and after getting some expertise you can stick to EMFT Validation framework 
only.

I hope to have clarified this matter a bit to help you decide on the right 
approach to use.
As for a tutorial, GMF existing tutorials already demonstrate audits 
functionality.
Look at the GMF ecore diagram editor, try to enable validation in gmfgen and 
re-generate. You will see how Ecore level
constraints are integrated.

PS: eclipse.modeling.gmf newsgroup created. Use it instead of 
eclipse.technology.gmf

Regards,
/Radek


"Madanagopal" <madanagopal@xxxxxxxxx> wrote in message 
news:op.tdnisxn66tuwl9@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

With reference to some previous posts
https://bugs.eclipse.org/bugs/show_bug.cgi?id=143580
i am currently trying to have constraints implemented at the Ecore level.

Moreover my requirement is to validate a class Firm with an attribute
"name" with constraint "self.name.size() > 0".

I have another possibility to implement this. Define an Audit Rule for
this constraint and then Enable the Validation Options in .gmfgen by
setting

Diagram -> Validation Decorators  to "true"
Diagram -> Valdation Enabled to "true"
Providers -> Validation Provider Priority  to "Medium".

This will generate diagram plugin which would have options Diagram->
Validate to validate my Model.

Now having constraints at Ecore level, what are the benifits that i get
when i use them for GMF, since I have to deal with lots of Constraints in
Design Level while writing Ecore and some in gmfmap.

Should i still have to make any changes while generating GMF Diagram
Editors with having Constraints in Ecore Level.

Please Post in your Comments.
An Example or a tutorial on this topic would be really helpful.

Madanagopal.

Attachments :
1. Ecore Snapshot
2. Ecore File