To edit or add content to this Wiki, you can simply create a new account at http://wocommunity.org/account.
The WOLips EOGenerator is an integral part of WOLips and shares its codebase with Entity Modeler. It uses release 1.5 of the Velocity Templating Engine and template files that use the Velocity Template Language. This templating language is similar to the original Rubicode EOGenerator that many developers used with WebObjects 5.3 and earlier so migrating old templates to the new language is time consuming, but not difficult.
If you don't specify a custom template name in your .eogen file, then the WOLips EOGenerator will simply use the built-in ones. This is the way all developers should start out. You can always grab those templates and modify them, or use some of the many modifications shared by other WebObjects developers on the EOGenerator Templates and Additions page.
There are two ways: create eclipse-wide settings, or create settings per project.
Note: There is actually no need to download Mike's templates as described below unless you want to customize them. WOLips includes two sets of default templates in the .jar files (so don't bother searching your file system for them) - one as described below and another for use with WOnder. If you are using WOnder, you need to follow Mike's instructions for their use: "Where it says "Entity.java" and "_Entity.java" you can use WonderEntity.java and _WonderEntity.java ... If your individual .eogen files override that, you will have to set it in there also". If you leave the "EOGenerator Template Folder" field empty, it will use the default templates...
1. Download the templates that Mike Schrag made from https://github.com/wolips/wolips/tree/master/wolips/core/plugins/org.objectstyle.wolips.eogenerator.core/templates
and place them in a folder. In my case that was in
Inside this folder you will have two standard templates: _Entity.java en Entity.java. Do not change them for the moment.
(Additional templates and a reference are available here)
2. Go to Preferences > WOLips > EOGenerator
In EOGenerator Template Folder, fill in the folder you have placed the templates
In EOGenerator Java Template fill in _Entity.java
In EOGenerator Subclass Java Template fill in Entity.java
This is how it looks in my settings:
3. Go to the eomodel from which you want to create classes and subclasses in the WOPackage sidebar of Eclipse
4. Right click and choose WOLips Tools > Create EOGenerator File from the contextual menu, (it's a submenu)
Now a eogen file is created which has the name of the EOModel and an .eogen extension.
If there is already an eogen file, then another one will be created, with a number between the EOModel name and the extension.
The one with the highest number will be the newest (unless you decided to throw earlier ones away, then the numbering starts all over again).
5. Go to the eogen file, right click and choose EOGenerate... from the contextual menu.
If you have some definitions in your EOModel that have a Class Name that is not an EOGenericRecord, then the appropriate java class and subclass will be generated.
For instance: a Person class name in EOModel will result in a _Person.java file (which will be overwritten the next time EOGeneration will take place) and a Person.java file. The java file without the underscore is the file that will not be overwritten the next time. This file is the file that you would add your own methods. The next time the model changes, the _underscore.java file will be overwritten, but your methods are safe.
6. Check if everything worked out fine. If not (e.g. you made a typing error and a java file happens to be empty) throw away the generated file yo do not want, and restart the process.
7. If you are fine, you can start fine tuning your templates, or start defining templates per project.
1. Under Preferences > WOLips > EOGenerator
-> Remove all entries (this is not strictly necessary, but it rules out any errors at the project level)
2. Add a folder named templates in your project folder, inside of which you place your template files.
For starters, don't rename them. You can download them here:
Other options for Veogen to pick up any changes you wish to make to the templates:
3. Double check your model. It used to be true that none of your entities could extend EOGenericRecord. That is no longer true and you can use either custom classes or EOGenericRecord as a class, or a mix of the two. We suggest that your entity classes should be in packages for this all to work optimally, such as "your_com.projectname.eo_class". If you use a class that is not in a package, there may be a number of errors in the resulting Java class files.
4. Create or edit your .eogen file, mine looks like this:
5. Double check, and open the .eogen file using open with > text editor. The whole command must all be on a single line; this is formatted for clarity:
6. If you are not seeing your entity files that start with the underscore character "_" in Eclipse, it is because you have them filtered out. Select filters from the down triangle in the package explorer:
7. Then uncheck 'EOGenerator _Files':