Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] EReferenceORMAnnotation and attributeOverride(How to set attribute override annotation in a EReferenceORMAnnotation)
[Texo] EReferenceORMAnnotation and attributeOverride [message #1005777] Mon, 28 January 2013 17:04 Go to next message
Emanuele Gesuato is currently offline Emanuele GesuatoFriend
Messages: 11
Registered: December 2012
Junior Member
Hi there,

We are adding programmatically several ORM annotation like @Column or @Basic.

For instance an "empty" @Basic is added as follow:
            	Basic basic = annotation.getBasic();
            	if (basic == null){
            		basic = OrmFactory.eINSTANCE.createBasic();
            		annotation.setBasic(basic);
            		
            	}


and it works.
We are trying to add programmatically also the @AttributeOverrides annotation in this way:
    EList<AttributeOverride> attributesOverride = annotation.getAttributeOverride();
    for (EAttribute eAttribute : eAllAttributes){
        AttributeOverride attributeOverride = OrmFactory.eINSTANCE.createAttributeOverride();
        attributeOverride.setName(eAttribute.getName());
        Column column = OrmFactory.eINSTANCE.createColumn();
        column.setName("...something ...");
        attributeOverride.setColumn(column);
        
        attributesOverride.add(attributeOverride);
        
    }                        


But we don't know where to "set" this list of attributesOverride.


Several weeks ago we added a List of of EntityListener but there was a set for the List of entityListeners:
                EntityListeners entityListeners = OrmFactory.eINSTANCE.createEntityListeners();
                EList<EntityListener> entityListener = entityListeners.getEntityListener();

                for (String s : Util.parseValue(eAnnotation.getDetails().get(IAnnotation.Reference))) {
                    EntityListener createEntityListener = OrmFactory.eINSTANCE.createEntityListener();
                    createEntityListener.setClass(s);
                    entityListener.add(createEntityListener);
                }
                [b]annotation.getEntity().setEntityListeners(entityListeners);[/b]



Am I missing something ? Where do I have to set the list of AttributeOverride ?

Thanks
Re: [Texo] EReferenceORMAnnotation and attributeOverride [message #1005808 is a reply to message #1005777] Mon, 28 January 2013 19:51 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Emanuele,
There are several places where you can set/add attributeoverride. Just search for
org.eclipse.emf.texo.orm.annotations.model.orm.AttributeOverride in your workspace and then search for types referencing
this class.

There is no setter for attribute override, but there is a getter which returns a list, to which you can add your created
attribute override. For example:
entity.getAttributeOverride().add(myGreatAttributeOverride);

So what you do is fine afaics, you add to the list maintained in the annotation.

gr. Martin

On 01/28/2013 06:04 PM, Emanuele Gesuato wrote:
> Hi there,
>
> We are adding programmatically several ORM annotation like @Column or @Basic.
>
> For instance an "empty" @Basic is added as follow:
>
> Basic basic = annotation.getBasic();
> if (basic == null){
> basic = OrmFactory.eINSTANCE.createBasic();
> annotation.setBasic(basic);
>
> }
>
>
> and it works.
> We are trying to add programmatically also the @AttributeOverrides annotation in this way:
>
> EList<AttributeOverride> attributesOverride = annotation.getAttributeOverride();
> for (EAttribute eAttribute : eAllAttributes){
> AttributeOverride attributeOverride = OrmFactory.eINSTANCE.createAttributeOverride();
> attributeOverride.setName(eAttribute.getName());
> Column column = OrmFactory.eINSTANCE.createColumn();
> column.setName("...something ...");
> attributeOverride.setColumn(column);
> attributesOverride.add(attributeOverride);
> }
>
> But we don't know where to "set" this list of attributesOverride.
>
>
> Several weeks ago we added a List of of EntityListener but there was a set for the List of entityListeners:
>
> EntityListeners entityListeners = OrmFactory.eINSTANCE.createEntityListeners();
> EList<EntityListener> entityListener = entityListeners.getEntityListener();
>
> for (String s : Util.parseValue(eAnnotation.getDetails().get(IAnnotation.Reference))) {
> EntityListener createEntityListener = OrmFactory.eINSTANCE.createEntityListener();
> createEntityListener.setClass(s);
> entityListener.add(createEntityListener);
> }
> annotation.getEntity().setEntityListeners(entityListeners);
>
>
>
> Am I missing something ? Where do I have to set the list of AttributeOverride ?
>
> Thanks


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:Call for Submissions: Modeling Symposium EclipseCon North America 2013
Next Topic:While loop with .ext language
Goto Forum:
  


Current Time: Mon Dec 22 19:40:34 GMT 2014

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

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