Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Drived attributes and custom bodies with EAttribute annotations with OCL
Drived attributes and custom bodies with EAttribute annotations with OCL [message #1698746] Wed, 17 June 2015 14:54 Go to next message
Claus RorbechFriend
Messages: 2
Registered: June 2015
Junior Member
I am trying to customize the Java API generated from an example Ecore model by using EAnnotations with OCL, but have not managed to see any changes in the generated code.

My class includes a 'Name'-attribute and a 'DerivedName'-attribute with the following annotation:
<eAnnotations source="http://www.eclipse.org/2007/OCL">
<details key="derive" value="self.Name"/>
</eAnnotations>

I have updated the GenModel to use dynamic templates, added the plugin dependencies by adding OCL_ECORE=org.eclipse.ocl.ecore to the Model Plug-in Variables, and tried setting the transient and volatile attributes.

Any pointers to the below would be appreciated?
- documentation on the various eAnnotation-source accessible features and their constraints
- example projects where the EAnnotations are used to do derived attributes and customized bodies with OCL

Re: Drived attributes and custom bodies with EAttribute annotations with OCL [message #1698918 is a reply to message #1698746] Thu, 18 June 2015 19:08 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I've no idea where you got http://www.eclipse.org/2007/OCL. I'm guessing
that you're following some seriously vintage document.

Follow the OCLinEcore tutorial in the OCL documentation.

Regards

Ed Willink


On 18/06/2015 19:21, Claus Rorbech wrote:
> I am trying to customize the Java API generated from an example Ecore
> model by using EAnnotations with OCL, but have not managed to see any
> changes in the generated code.
> My class includes a 'Name'-attribute and a 'DerivedName'-attribute
> with the following annotation:
> <eAnnotations source="http://www.eclipse.org/2007/OCL">
> <details key="derive" value="self.Name"/>
> </eAnnotations>
>
> I have updated the GenModel to use dynamic templates, added the plugin
> dependencies by adding OCL_ECORE=org.eclipse.ocl.ecore to the Model
> Plug-in Variables, and tried setting the transient and volatile
> attributes.
> Any pointers to the below would be appreciated?
> - documentation on the various eAnnotation-source accessible features
> and their constraints
> - example projects where the EAnnotations are used to do derived
> attributes and customized bodies with OCL
>
>
Re: Drived attributes and custom bodies with EAttribute annotations with OCL [message #1698919 is a reply to message #1698918] Thu, 18 June 2015 19:13 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Looks like this:

https://www.eclipse.org/articles/article.php?file=Article-EMF-Codegen-with-OCL/index.html


Apparently, the entire Eclipse Corner article repository is deprecated.

Cheers,

Christian


On 2015-06-18 19:08:26 +0000, Ed Willink said:

> Hi
>
> I've no idea where you got http://www.eclipse.org/2007/OCL. I'm
> guessing that you're following some seriously vintage document.
>
> Follow the OCLinEcore tutorial in the OCL documentation.
>
> Regards
>
> Ed Willink
>
>
> On 18/06/2015 19:21, Claus Rorbech wrote:
>> I am trying to customize the Java API generated from an example Ecore
>> model by using EAnnotations with OCL, but have not managed to see any
>> changes in the generated code.
>> My class includes a 'Name'-attribute and a 'DerivedName'-attribute with
>> the following annotation:
>> <eAnnotations source="http://www.eclipse.org/2007/OCL">
>> <details key="derive" value="self.Name"/>
>> </eAnnotations>
>>
>> I have updated the GenModel to use dynamic templates, added the plugin
>> dependencies by adding OCL_ECORE=org.eclipse.ocl.ecore to the Model
>> Plug-in Variables, and tried setting the transient and volatile
>> attributes.
>> Any pointers to the below would be appreciated?
>> - documentation on the various eAnnotation-source accessible features
>> and their constraints
>> - example projects where the EAnnotations are used to do derived
>> attributes and customized bodies with OCL
Re: Drived attributes and custom bodies with EAttribute annotations with OCL [message #1699160 is a reply to message #1698919] Mon, 22 June 2015 08:44 Go to previous message
Claus RorbechFriend
Messages: 2
Registered: June 2015
Junior Member
Yes. Seems like I took off from some legacy examples and then had an erroneous perception when initially looking into the OCL tutorial.

Managed to create examples and reverse engineer the proper details for driving my example of adding the annotations programmatically.

Thanks.
Previous Topic:Copy&paste / drag&drop into (different) FeatureMap attributes
Next Topic:[CDO] "Synchronizable repositories don't support dynamic addition of new packages"
Goto Forum:
  


Current Time: Thu Apr 18 07:14:07 GMT 2024

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

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

Back to the top