Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] UML 2 Java - Non basic types + Magicdraw
[Acceleo] UML 2 Java - Non basic types + Magicdraw [message #636824] Wed, 03 November 2010 00:11 Go to next message
Rodrigo  is currently offline Rodrigo Friend
Messages: 2
Registered: November 2010
Junior Member
Hi all,

I´m trying to adapt the Uml2Java example to work with reference types like java.util.Date.

First I tried to use Papyrus (0.7) but it seems it doesn´t have a way to include a profile with non-basic Java types.

So I went to Magicdraw 16, integrated with eclipse. I exported my model as an EMF XMI and ran my acceleo generator. The problem is the generator also generated all classes from the internal profiles of my model.

I need to generate a real world application with all common Java types (or richer UML types, like Date). How can I accomplish that?
Is there a way to do that using Papyrus? or, if not, using MagicDraw?

TIA,
R.
Re: [Acceleo] UML 2 Java - Non basic types + Magicdraw [message #636950 is a reply to message #636824] Wed, 03 November 2010 14:03 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060606090707070708080809
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Rodrigo,

Acceleo generates code for what you ask him to. If you feed him an UML
model with three classes "Book", "Media" and "Video" and two data types
"Date" and "String", your generator will either generate three classes
(one for each Class), two classes (oen for each data type), five classes
(one for each model element) ... or even a hundred classes if you decide
to loop and make files for each character in the names and attributes of
your model.

It is up to you to define the generation modules that go with what you'd
like generated.

The modeler itself really has no importance : as long as it suits your
need and can properly export the models to an EMF-readable format, it
can be used with Acceleo. Sebastien Roy has commented on another thread
(
http://www.eclipse.org/forums/index.php?t=msg&S=c61c639d deb3e6899a41bc7c31056e22&th=199282&goto=636627#msg_6 36627
) on his experience with three modelers.

Laurent Goubet
Obeo

Rodrigo wrote:
> Hi all,
>
> I´m trying to adapt the Uml2Java example to work with reference types
> like java.util.Date.
>
> First I tried to use Papyrus (0.7) but it seems it doesn´t have a way to
> include a profile with non-basic Java types.
>
> So I went to Magicdraw 16, integrated with eclipse. I exported my model
> as an EMF XMI and ran my acceleo generator. The problem is the generator
> also generated all classes from the internal profiles of my model.
>
> I need to generate a real world application with all common Java types
> (or richer UML types, like Date). How can I accomplish that?
> Is there a way to do that using Papyrus? or, if not, using MagicDraw?
>
> TIA,
> R.


--------------060606090707070708080809
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------060606090707070708080809--
Re: [Acceleo] UML 2 Java - Non basic types + Magicdraw [message #636956 is a reply to message #636950] Wed, 03 November 2010 14:23 Go to previous messageGo to next message
Rodrigo  is currently offline Rodrigo Friend
Messages: 2
Registered: November 2010
Junior Member
Hi Laurent,

Thanks for your repply.

Where can I find information about how to set acceleo to not generate
the classes from the profiles inside my MagicDraw file?

I think papyrus won´t be a alternative this time...

R.
Re: [Acceleo] UML 2 Java - Non basic types + Magicdraw [message #637646 is a reply to message #636824] Mon, 08 November 2010 08:34 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Rodrigo,

I don't know how you created your generation modules, neither do I know what your models look like. You should take a look at the Acceleo tutorial or its quick start for information on how to define generation modules, it doesn't take long to grasp the principles. Both are available on the Eclipse Help Center.

Basically, you need to determine what you want _not_ generated if they are "classes from the profiles" I suppose they all have something that set them appart from your own classes : a stereotype, an attribute... You can then tell Acceleo not to generate these classes through a guard on the template that contains the "[file/]" block for Class generation, something like this (to prevent generation of Class which have the "my.stereotype" stereotype) :

[...]

[template public generateClass(class : Class) ? (not class.hasStereotype('my.stereotype'))]
[...]
    [file (class.name + '.java', false)]
[...]
[/template]

[...]


Laurent Goubet
Obeo

[Updated on: Mon, 08 November 2010 08:37]

Report message to a moderator

Re: [Acceleo] UML 2 Java - Non basic types + Magicdraw [message #637647 is a reply to message #637646] Mon, 08 November 2010 08:35 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Sorry for the double post, hit "quote" instead of "edit" Razz

[Updated on: Mon, 08 November 2010 08:36]

Report message to a moderator

Previous Topic:[Acceleo] Problem getting Run as | Launch Acceleo
Next Topic:Filter Classes
Goto Forum:
  


Current Time: Wed Dec 11 16:15:04 GMT 2024

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

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

Back to the top