Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How to get applied stereotypes of stereotypes(How to get applied stereotypes of stereotypes for controlling m2t generation)
How to get applied stereotypes of stereotypes [message #1844485] Wed, 15 September 2021 02:03 Go to next message
Lars Eulberg is currently offline Lars EulbergFriend
Messages: 2
Registered: September 2021
Junior Member
Hello together,

I'm new in this forum and quite new with m2x Eclipse implementations.

In my first steps i've been progressing fast.

However, now, I'm a little bit struggling, because I do not find proper docs on already existing m2t mechnismns for java.

What I want to do is to transform a UML model to Openxava application.

Because I've not found any suitable ready to use tools, I've started to build a UML profile on papyrus and some templates with Acceleo to generate the Entity beans in Openxava style.

If there is any m2t mechanismn out there, which can already generate Openxava apps from UML out of the box, I would like to pick up a hint on such a tool.

If not, it is not that complicate to build it, but...

Openxava brings a lot of Java Annotations beside those Java already knows.

My idea is, to put a mark into the UML profile stereotypes whether the marked stereotype has to be transformed into an Java annotation, or not. Example
Class<--Stereotype1
Stereotype<--Stereotype2

I thought, well sounds easy. Apply Stereotype2 to Stereotype1. On the UML side, it works fine. Of course, if you apply Stereotype1 to a class, you have no direct access to Stereotype2. The Application is an instance of Stereotype1 and Stereotype2 is applied to Stereotype1 itself.

However, I cannot find a way to access the applied stereotypes of the stereotypes, neither through getAppliedStereotypes() nor through getStereotypeApplication().

I would do something like:
element.getStereotypeApplication(element.getAppliedStereotype(name)).getAppliedStereotypes()
or
element.getAppliedStereotype(name).getAppliedStereotypes()

Any ideas?

Thanks for some useful hints.

Best regards
Re: How to get applied stereotypes of stereotypes [message #1844486 is a reply to message #1844485] Wed, 15 September 2021 04:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I recommend that you follow various UML and Papyrus tutorials so that you understand the already available UML2Ecore2Java, that includes support for embedded OCL and OCL2Java, before you attempt to rewrite it all. The existing approach is certainly complex, but that indicates how much complexity you will need to replicate if you want to achieve similar functionality by yourself.

If you use OCL with Papyrus, you should find that all stereotype accesses work via type-safe model navigations. There is no need to use the type-unsafe getXXXStereotype Java API.

Regards

Ed Willink
Re: How to get applied stereotypes of stereotypes [message #1844574 is a reply to message #1844486] Thu, 16 September 2021 17:39 Go to previous messageGo to next message
Lars Eulberg is currently offline Lars EulbergFriend
Messages: 2
Registered: September 2021
Junior Member
Hi,

thank you for your quick response.

I understand that it is possible to generate java stuff out of ecore models through genModels, which itself is fine. But I've neither found a way to get to Entity Beans nor to customize the genmodel.

Are there any recommendations, maybe links, for tutorials on customizing genModels? I've not yet found any tutorials on customizing genModels.

Is there already any approach available, to generate Entity Beans out of UML models? Then, it is still needed to generate all the view stuff provided by OpenXava.

Acceleo gave me the fastest way into the generation stuff.

But, if there were any out of the box M2T solution for Entity Beans (JPA) or for OpenXava itself available, I would like to jump out of the Acceleo dress, of course.

Regards,

Lars Eulberg
Re: How to get applied stereotypes of stereotypes [message #1844576 is a reply to message #1844574] Thu, 16 September 2021 18:40 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
HI

The EMF M2T using JET provides a very rich implementation with reflection. Obeo attempted to upgrade the tooling to use Acceleo instead, but the replacement never caught on, if it was ever finished; I've certainly never seen it and since the JET continues to evolve the Acceleo equivalent must be dangerously stale by now.

If you need the richness of EMF2Java then you should probably struggle with the JET templates that are extensible / replaceable. For OCL I replace a couple of them with enhanced variants..

If you only need structure to which you will add manual bodies then a custom M2T is pretty easy and quite fun. Personally I would use an Xtend M2T layer on a Java base.

If you need structure and auto-generated behavior then you have a dilemma. The OCL2Java is extensible so with a modest amount of effort you could perhaps re-use that.

I'm not a great expert on beans or OpenXava. To me they are just stylized classes so it shouldn't be that difficult to tailor EMF's autogeneration to comply with your required style.

Regards

Ed Willink

Previous Topic:Textual syntax for UML state machines
Next Topic:Stereotype.getAllExtendedMetaclasses() does not respect propety visibility
Goto Forum:
  


Current Time: Wed Apr 24 22:48:23 GMT 2024

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

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

Back to the top