Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Validation, (validating an object against a parent/containing object.)
EMF Validation, [message #1251992] Thu, 20 February 2014 20:35 Go to next message
Neil Mackenzie is currently offline Neil MackenzieFriend
Messages: 123
Registered: December 2013
Senior Member

Hello,
I am tryting to write a custom validation for my EMF model.
I have a class called Table and a class Column. Tables can contain many Columns.
I would like to set a validation where a column name must be prepended by the name of the table (e.g. for a table called Book, the contained columns must have names Book.*, e.g. "Book.Author", "Book.Title")
I can add a very simple custom validation on my Column class in EMF, but I don't know how to reference the parent/containing class Table in my validation code.
Any help would be appreciated.
Thanks,
Neil
Re: EMF Validation, [message #1252329 is a reply to message #1251992] Fri, 21 February 2014 05:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30685
Registered: July 2009
Senior Member
Neil,

Comments below.

On 20/02/2014 9:35 PM, Neil Mackenzie wrote:
>
> Hello,
> I am tryting to write a custom validation for my EMF model.
> I have a class called Table and a class Column. Tables can contain
> many Columns.
> I would like to set a validation where a column name must be prepended
> by the name of the table (e.g. for a table called Book, the contained
> columns must have names Book.*, e.g. "Book.Author", "Book.Title")
> I can add a very simple custom validation on my Column class in EMF,
> but I don't know how to reference the parent/containing class Table in
> my validation code.
You should consider defining a reference "table" of type "Table" in
"Column" and making the Table.columns reference its opposite. Then you
have a getTable method you can use. Failing that column.eContainer will
typically be the Table, unless the Column is contained elsewhere.
> Any help would be appreciated.
> Thanks,
> Neil
Re: EMF Validation, [message #1252485 is a reply to message #1252329] Fri, 21 February 2014 09:06 Go to previous message
Neil Mackenzie is currently offline Neil MackenzieFriend
Messages: 123
Registered: December 2013
Senior Member
Thanks Ed,
eContainer works fine for me.
Neil
Previous Topic:open model with validating xml editor
Next Topic:[CDO] disable commit info.
Goto Forum:
  


Current Time: Sun Dec 08 02:19:59 GMT 2019

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

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

Back to the top