Bug 157176 - UMLUtil.UML2EcoreConverter should regard user-specified values for EEnumLiterals
Summary: UMLUtil.UML2EcoreConverter should regard user-specified values for EEnumLiterals
Status: VERIFIED FIXED
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Kenn Hussey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-13 11:02 EDT by Alexander Nyßen CLA
Modified: 2008-01-28 16:36 EST (History)
0 users

See Also:


Attachments
proposed fix (1.29 KB, patch)
2006-09-13 17:17 EDT, Kenn Hussey CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nyßen CLA 2006-09-13 11:02:48 EDT
The current implementation of caseEnumerationLiteral sets the values of the enumeration literals to a fixed value according to their position inside the enumeration they are owned by: 

eEnumLiteral.setValue(enumeration.getOwnedLiterals().indexOf(enumerationLiteral));

Ecore models do indeed allow to specify individual (customized) values for enumeration literals (attribute value of EEnumLiteral). This feature can - regarding the current implementation - not be used if generating an ecore model from a uml2 model, so I would propose to change that so that a literal value is taken from the uml2 model - if specified (e.g. via a LiteralInteger set as specification of the EEnumLiteral).

A concrete use case for this is that I want to define enumeration literals in my EMF-model (in my example its an EEnum named OrienationKind) whose literal values should match the values of constants defined in an already existent Java interface (in my case this is org.eclipse.draw2d.PositionConstants). So I want e.g. to have a literal HORIZONTAL with value 64 and a literal VERTICAL with value 128, which is currently not possible via uml2 import (they always get the values 0 and 1). 

One Note: The deluxe version would be that I could not only specify the integer values for the literals in my uml2 model via an IntegerLiteral, but that I could indeed provide an OpaqueExpression, where I could specify that the value of the literal will be directly determined from the value of the Interface constant.
Comment 1 Kenn Hussey CLA 2006-09-13 17:17:51 EDT
Created attachment 50091 [details]
proposed fix

Would the attach patch meets your needs?
Comment 2 Kenn Hussey CLA 2006-09-13 21:31:08 EDT
The fix has been committed to CVS.
Comment 3 Kenn Hussey CLA 2006-09-14 18:10:20 EDT
Fixed in M200609141745.
Comment 4 Nick Boldt CLA 2008-01-28 16:36:13 EST
Move to verified as per bug 206558.