|
Re: [Acceleo] UML 2 Java - Non basic types + Magicdraw [message #636950 is a reply to message #636824] |
Wed, 03 November 2010 14:03 |
|
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 #637646 is a reply to message #636824] |
Mon, 08 November 2010 08:34 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03347 seconds