[Texo] EReferenceORMAnnotation and attributeOverride [message #1005777] |
Mon, 28 January 2013 12:04  |
Eclipse User |
|
|
|
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 14:51  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02646 seconds