Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Is it possible to exclude certain features from EMF Java code generation?
Is it possible to exclude certain features from EMF Java code generation? [message #1403410] Wed, 23 July 2014 14:03 Go to next message
Reinhold Bihler is currently offline Reinhold BihlerFriend
Messages: 64
Registered: July 2009
Member
Hello,

we use a single ecore model for the configuration of two very similar products. From this model we generate C++ and Visual Basic code for product P1. And we generate C++, LotusScript and Java code for product P2 from it. For the Java code generation we use the code generation built into EMF.

Now we have the situation that for product P1 we would need a bidirectional 0..n to 0..1 reference between class A and class B. However, for product P2 we would need only a directed 0..1 reference from class A to class B.

Is there a way to mark (e.g. using a annotaion) the opposite reference (the 0..n reference from B to A) so that it is ignored in the Java code generation?

Thanks in advance for your help

Reinhold
Re: Is it possible to exclude certain features from EMF Java code generation? [message #1403434 is a reply to message #1403410] Wed, 23 July 2014 16:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Reinhold,

No, what you define in the Ecore model is what you get. Are these
bidirectional references proxy resolving, i.e., to they cross resource
boundaries? It sounds like not only don't you need the bidirectional
reference in P2 but it's presence is a problem. Why is that?

On 23/07/2014 4:03 PM, Reinhold Bihler wrote:
> Hello,
>
> we use a single ecore model for the configuration of two very similar
> products. From this model we generate C++ and Visual Basic code for
> product P1. And we generate C++, LotusScript and Java code for product
> P2 from it. For the Java code generation we use the code generation
> built into EMF.
>
> Now we have the situation that for product P1 we would need a
> bidirectional 0..n to 0..1 reference between class A and class B.
> However, for product P2 we would need only a directed 0..1 reference
> from class A to class B.
>
> Is there a way to mark (e.g. using a annotaion) the opposite reference
> (the 0..n reference from B to A) so that it is ignored in the Java
> code generation?
>
> Thanks in advance for your help
>
> Reinhold


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Is it possible to exclude certain features from EMF Java code generation? [message #1403493 is a reply to message #1403434] Thu, 24 July 2014 07:49 Go to previous message
Reinhold Bihler is currently offline Reinhold BihlerFriend
Messages: 64
Registered: July 2009
Member
Hi Ed,

the references are not proxy resolving. However, for product P2 we wrote a generic EMF to Lotus Domino Database serialization. Domino Databases are document oriented. Each document has a unique id. But there is no real reference concept not to mention checks for referential integrity.

Normally we store one object in one document. A reference to another object is stored as the unique id of the referenced document in a field of the referencing document. As we cannot always control document deletion there occur situations where a reference is pointing to a deleted document..

That is why we try to avoid unnecessary references for product P2.

So I think we will add a special annotation to the reference and extend the Domino serialization to ignore references with this annotation.

Thanks for your help Ed

Reinhold

Previous Topic:Problem parsing XML elements when loading XML schemas with EMF
Next Topic:Transactions API: determine if running in a transaction
Goto Forum:
  


Current Time: Fri Apr 26 04:29:04 GMT 2024

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

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

Back to the top