[ATL] ecore to ecore transformation [message #63873] |
Fri, 12 October 2007 10:35  |
Eclipse User |
|
|
|
Originally posted by: n.toublanc.laposte.net
Hi all,
I'm trying to write my first ATL project using Eclipse 3.3. Here is my
first ATL file :
module ClassModel2DAClassModel; -- Module Template
create da : MOF from dto : MOF;
rule Package{
from
ip :MOF!EPackage
to
op :MOF!EPackage(
name <- ip.name + '.da.hibernate.impl'
)
}
rule Class {
from
ic : MOF!EClass
to
oc : MOF!EClass (
name <- ic.name + 'DAImpl'
)
}
The result is that the packages and the classes are created with the
suffixes I specified.
Example :
- km3 format of my ecore input
package "com.mdd.test" {
class Project {
attribute name[0-1] : ;
attribute beginDate[0-1] : ;
attribute endDate[0-1] : ;
attribute id[0-1] : ;
}
- km3-like format of my ecore output
package "com.mdd.test.da.impl" {
}
class ProjectImpl {
}
So, it's not too bad to begin. The first problem is that my classes are
not in the package. How could I do that in my ATL file?
Then, I would like to add some methods in my MyClassDAImpl like :
public List<MyClass> getAll(){
}
How could I do that?
I will try to read the ATL guide to understand that myself, but I you
can simply explain me the concepts I need to know to do that, it would
really help me.
Thanks for your help.
Regards
|
|
|
|
|
Re: [ATL] ecore to ecore transformation [message #63942 is a reply to message #63920] |
Fri, 12 October 2007 10:51  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060402080805000202060001
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Sorry, I encountered a bug and didn't finish my answer...
:-)
So I wanted to describe the class rule which adds an operation to the
class element :
rule Class {
from
ic : MOF!EClass
to
oc : MOF!EClass (
name <- ic.name + 'DAImpl',
operations <- Sequence{getAllOperation}
),
getAllOperation : MOF!EOperation (
name <- 'getAll'
....
etc...
)
}
Regards
--------------060402080805000202060001
Content-Type: text/x-vcard; charset=utf-8;
name="william.piers.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="william.piers.vcf"
begin:vcard
fn:William Piers
n:Piers;William
org:Obeo
adr:2 rue Robert Schumann;;lot 24;NANTES;;44408;France
email;internet:william.piers@obeo.fr
title:MDA Consultant
tel;work:+33 (0)2 51 13 51 82
tel;cell:+33 (0)6 20 31 75 98
url:http://www.obeo.fr
version:2.1
end:vcard
--------------060402080805000202060001--
|
|
|
Powered by
FUDForum. Page generated in 0.05163 seconds