Home » Modeling » EMF » Im new with EMF and need some help
Im new with EMF and need some help [message #1697151] |
Mon, 01 June 2015 20:21  |
Eclipse User |
|
|
|
Hi , sorry for my bad english..
Im currently reading de EMF book edition 2. I underttand that you model your program and then EMF framework generates code from it. But i have some questions.
1) Can i use EMF to develop an Business aplication?
2) How i model the BD conections??
3) How i model the UI of my program??
Thanks you, Your help would be appreciated, i really need it.
|
|
| | | | |
Re: Im new with EMF and need some help [message #1697715 is a reply to message #1697221] |
Sat, 06 June 2015 16:27   |
Eclipse User |
|
|
|
Hi ed,
I have another question. If im going to develop a simple application, about a hotel. I have some classes in EMF, like room class, client class,etc.
Can you enumerate the steps to have mi final application running (.jar file)??
1) I modeled the program.
2) generate code from it.
3) i will have to manually add some code, right? And regenerate mi model if needed
3)and now? I have tu use emf forms, to build an UI form, i think.
4) which other tool from Eclipse modeling project do i have to use, to finish my program? I also want a mysql database to store al the hotel information
Im asking this to learn the way model driven development is approached in eclipse.
Im new in this, im looking at tutorials. Also i bought your book about EMF, im still reading.
there are not any good book about this, either tutorials
Sorry my bad english.
appreciate your response on this 
Matias.
|
|
|
Re: Im new with EMF and need some help [message #1697716 is a reply to message #1697715] |
Sun, 07 June 2015 01:17   |
Eclipse User |
|
|
|
Matias,
Comments below.
On 06/06/2015 10:27 PM, Matias munoz wrote:
> Hi ed,
>
> I have another question. If im going to develop a simple application,
> about a hotel. I have some classes in EMF, like room class, client
> class,etc.
Be sure to give them names that will also look nice in Java, e.g.,
RoomClass.
> Can you enumerate the steps to have mi final application running (.jar
> file)?? 1) I modeled the program.
Well, you modeled the data representation...
> 2) generate code from it.
Including the editor, that's a complete sample application.
> 3) i will have to manually add some code, right? And regenerate mi
> model if needed
Not necessarily.
> 3)and now? I have tu use emf forms, to build an UI form, i think.
If you want it to be pretty, otherwise you'll get something basic like
the Sample Ecore Editor.
> 4) which other tool from Eclipse modeling project do i have to use, to
> finish my program? I also want a mysql database to store al the hotel
> information
Teneo or CDO will be of interest.
>
> Im asking this to learn the way model driven development is approached
> in eclipse.
> Im new in this, im looking at tutorials. Also i bought your book about
> EMF, im still reading.
> there are not any good book about this, either tutorials
No, but it's all open source, so you can always look at how other things
that look cool have been implemented.
> Sorry my bad english.
> appreciate your response on this :)
>
> Matias.
>
|
|
| | | | | | | | |
Re: Im new with EMF and need some help [message #1700847 is a reply to message #1699871] |
Tue, 07 July 2015 10:45   |
Eclipse User |
|
|
|
Hi !
Im working on a comic shop application. I have defined many Ecore classes like client, shop, purchase, item, etc. Should I make a constructor method (Eoperation) for every class, to set all attributes at once ? Or EMF provides something to do this automatically.
For example, in client class i have atributes like name, surname, adress. I want my main program to create a client object. using parameters. Something like
Client client= ComicFactory.eINSTANCE.createClient("matias", "munoz","Saavedra 565");
other way will be (but i want to know if the first example is possible before trying this)
Client client= ComicFactory.eINSTANCE.createClient();
client.setAllAtributes("matias","munoz","Saavedra 565");
|
|
|
Re: Im new with EMF and need some help [message #1700868 is a reply to message #1700847] |
Tue, 07 July 2015 13:58   |
Eclipse User |
|
|
|
Matias,
Comments below.
On 07/07/2015 4:45 PM, Matias munoz wrote:
> Hi !
> Im working on a comic shop application. I have defined many Ecore
> classes like client, shop, purchase, item, etc. Should I make a
> constructor method (Eoperation) for every class, to set all attributes
> at once ?
There is no need, and certainly there's only a default constructor and
no automatic way to generate any other constructor.
> Or EMF provides something to do this automatically.
No.
> For example, in client class i have atributes like name, surname,
> adress. I want my main program to create a client object. using
> parameters. Something like Client client=
> ComicFactory.eINSTANCE.createClient("matias", "munoz","Saavedra 565");
You'd need to create such convenience methods manually.
> other way will be (but i want to know if the first example is possible
> before trying this)
> Client client= ComicFactory.eINSTANCE.createClient();
> client.setAllAtributes("matias","munoz","Saavedra 565");
Better just to use the individual setters, but of course you can
manually add whatever seems handy to you.
Keep in mind not to mess with the default constructor or the default
factory methods; those are needed to support things like deserialization
and copying.
>
>
>
|
|
| | | | | | |
Re: Im new with EMF and need some help [message #1701338 is a reply to message #1701325] |
Sat, 11 July 2015 19:41   |
Eclipse User |
|
|
|
thanks you so much Ed,
I want to ask you something else,
1) When i model in EMF, i can add restrictions to my data model. For example, i can add a Reference with 0..2 multiplicity, if that reference has 3 elements instead of 2, is an invalid situation, or an error.
I Know that using the Ecore Sample Editor i can right click and validate, to know if there is something wrong. But how can i validate from my code? Is there any method that check all instances of my objects and references, and shows if something is invalid ?
2) Is possible to use my model and the Ecore sample editor, in a standalone application? I want to create a .jar file, that opens my editor, load and edit instances of my model, and finally save them, in a persistance file.
Sorry for my english
and thanks again for your time helping me
[Updated on: Sun, 12 July 2015 09:17] by Moderator
|
|
|
Re: Im new with EMF and need some help [message #1701356 is a reply to message #1701338] |
Sun, 12 July 2015 10:25   |
Eclipse User |
|
|
|
Matias,
Comments below.
On 12/07/2015 1:41 AM, Matias munoz wrote:
> thanks you so much Ed,
>
> I want to ask you something else,
> When i model in EMF, i can add restrictions to my data model. For
> example, i can add a Reference with 0..2 multiplicity, if that
> reference has 3 elements instead of 2, is an invalid situation, or an
> error.
It's checked by the validator, it's not a state that's prevented from
existing.
> I Know that using the Ecore Sample Editor i can right click and
> validate, to know if there is something wrong. But how can i validate
> from my code?
org.eclipse.emf.ecore.util.Diagnostician.validate(EObject)
> Is there any method that check all instances of my objects and
> references, and shows if something is invalid ?
You can look at
org.eclipse.emf.edit.ui.action.ValidateAction.validate(IProgressMonitor)
to see how it visits multiple objects to validate them all.
>
> Sorry my ape english
|
|
| | |
Goto Forum:
Current Time: Wed Jul 23 12:25:52 EDT 2025
Powered by FUDForum. Page generated in 0.31145 seconds
|