Child pages
  • Your First Rest Project

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you check in the Outline tab, you should see that Author now have a blogEntries relationship, and BlogEntry have a author relationship.

Image Added

You are now ready to save the model. Save it (File -> Save) and close the Entity Modeler window. If you open the Sources in the main Eclipse window, you will notice that the Sources folder contains a package named your.app.model. (If this folder doesn't appear, you may need to set your preferences to automatically generate these source files; see the second suggestion on http://wiki.wocommunity.org/display/documentation/Useful+Eclipse+or+WOLips+Preferences.)

 

That package have four Java classes: _Author, Author, _BlogEntry and BlogEntry. Those classes were generated by Veogen, a templating engine build on Velocity. The two classes that starts with a underscore are recreated every time you change the EOModel, so if you want to change something in those classes, you need to change the template (no need for that right now). But you can change freely the two classes that don't have the underscore, and this is what we will be doing.

 

What we are going to do is to write a simple method that returns the full name of an author, e.g. a method that simply concatenate the first name, a space and the last name of the author. To do so, double-click on Author.java and add the following methods:

...