Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » UML Operation Object to EOperation
UML Operation Object to EOperation [message #477778] Thu, 02 October 2008 15:50 Go to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
I'm trying to map my org.eclipse.uml2.uml.Operation to an
org.eclipse.emf.ecore.EOperation. I know that the uml classes are built
on top of EObject, but my question is there any easy way to convert UML to
EObject?

I guess a way to do this would be map only the attributes I need like name
visibility, return type, parameters, etc..) something like this, but
before I start it'd be nice if there was a simpler approach.

protected EOperation createUOpertion2EOperation(
org.eclipse.uml2.uml.Operation umlOperation){

EOperation eOperation = EcoreFactory.eINSTANCE.createEOperation();
//get umlOperation (type, name, parameters, etc) and map to eOperation

return eOperation;
}
Re: UML Operation Object to EOperation [message #477779 is a reply to message #477778] Thu, 02 October 2008 19:30 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Roshan,

Have a look at the UML2EcoreConverter as part of UMLUtil. It will convert
from UML to the corresponding Ecore representation.
You can also use the UML editor to access this functionality from a menu
item.

- James.


"Roshan Soni" <roshan.soni1@gmail.com> wrote in message
news:f2c15cde82bc298e3e102428c79b2283$1@www.eclipse.org...
> I'm trying to map my org.eclipse.uml2.uml.Operation to an
> org.eclipse.emf.ecore.EOperation. I know that the uml classes are built
> on top of EObject, but my question is there any easy way to convert UML to
> EObject?
>
> I guess a way to do this would be map only the attributes I need like name
> visibility, return type, parameters, etc..) something like this, but
> before I start it'd be nice if there was a simpler approach.
>
> protected EOperation createUOpertion2EOperation(
> org.eclipse.uml2.uml.Operation umlOperation){
>
> EOperation eOperation = EcoreFactory.eINSTANCE.createEOperation();
> //get umlOperation (type, name, parameters, etc) and map to eOperation
>
> return eOperation;
> }
>
Re: UML Operation Object to EOperation [message #477780 is a reply to message #477779] Thu, 02 October 2008 22:17 Go to previous messageGo to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
Thanks James,

UML2EcoreConverter seems like i would work, but I'm not sure if I am using
it correctly. I keep getting null as my return object.

UML2EcoreConverter uml = new UML2EcoreConverter();
Object obj = uml.caseModel(umlModel);
Re: UML Operation Object to EOperation [message #477787 is a reply to message #477780] Mon, 06 October 2008 15:06 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Roshan,

Have a look at the ConvertToEcoreModelAction.java . It all starts
UMLUtil.covnertToEcore(...).
Under the hood, the UML2EcoreConverter.convert() is the reall entry point.

Cheers,
- James.

"Roshan Soni" <roshan.soni1@gmail.com> wrote in message
news:c3bce33abade49c2c9f2a61b4e7c1818$1@www.eclipse.org...
> Thanks James,
>
> UML2EcoreConverter seems like i would work, but I'm not sure if I am using
> it correctly. I keep getting null as my return object.
>
> UML2EcoreConverter uml = new UML2EcoreConverter();
> Object obj = uml.caseModel(umlModel);
>
Re: UML Operation Object to EOperation [message #626978 is a reply to message #477778] Thu, 02 October 2008 19:30 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Roshan,

Have a look at the UML2EcoreConverter as part of UMLUtil. It will convert
from UML to the corresponding Ecore representation.
You can also use the UML editor to access this functionality from a menu
item.

- James.


"Roshan Soni" <roshan.soni1@gmail.com> wrote in message
news:f2c15cde82bc298e3e102428c79b2283$1@www.eclipse.org...
> I'm trying to map my org.eclipse.uml2.uml.Operation to an
> org.eclipse.emf.ecore.EOperation. I know that the uml classes are built
> on top of EObject, but my question is there any easy way to convert UML to
> EObject?
>
> I guess a way to do this would be map only the attributes I need like name
> visibility, return type, parameters, etc..) something like this, but
> before I start it'd be nice if there was a simpler approach.
>
> protected EOperation createUOpertion2EOperation(
> org.eclipse.uml2.uml.Operation umlOperation){
>
> EOperation eOperation = EcoreFactory.eINSTANCE.createEOperation();
> //get umlOperation (type, name, parameters, etc) and map to eOperation
>
> return eOperation;
> }
>
Re: UML Operation Object to EOperation [message #626979 is a reply to message #477779] Thu, 02 October 2008 22:17 Go to previous message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
Thanks James,

UML2EcoreConverter seems like i would work, but I'm not sure if I am using
it correctly. I keep getting null as my return object.

UML2EcoreConverter uml = new UML2EcoreConverter();
Object obj = uml.caseModel(umlModel);
Re: UML Operation Object to EOperation [message #626986 is a reply to message #477780] Mon, 06 October 2008 15:06 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Roshan,

Have a look at the ConvertToEcoreModelAction.java . It all starts
UMLUtil.covnertToEcore(...).
Under the hood, the UML2EcoreConverter.convert() is the reall entry point.

Cheers,
- James.

"Roshan Soni" <roshan.soni1@gmail.com> wrote in message
news:c3bce33abade49c2c9f2a61b4e7c1818$1@www.eclipse.org...
> Thanks James,
>
> UML2EcoreConverter seems like i would work, but I'm not sure if I am using
> it correctly. I keep getting null as my return object.
>
> UML2EcoreConverter uml = new UML2EcoreConverter();
> Object obj = uml.caseModel(umlModel);
>
Previous Topic:Private visibility of UML class attributes
Next Topic:[Announce] OMG's UML 2.2 is ready - UML2 3.0.0 API has been updated.
Goto Forum:
  


Current Time: Mon Aug 08 23:43:09 GMT 2022

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

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

Back to the top