WOGen

Last modified by Andrew Lindesay on 2006/10/29 00:03

WOGen Task Manual

This has been transcribed by Andrew Lindesay from the old WOProject site.

Description

WOGen is an Ant task that generates and maintains EOEnterpriseObjects source files based on EOModel. If "makepairs" is set to "true" (default), this task will generate a pair of classes (superclass/subclass) for each EOEntity in the EOModel. Superclasses should not be changed manually, since they are always overwritten. Subclasses are never overwritten and may be later customized by the user. If "makepairs" is set to "false", a single class will be generated for each EOEntity.

WOGen is based on Cayenne Cgen class generator that is in turn based on Jakarta Velocity template engine. Users can easily create new class templates using template language described on Velocity website.

Parameters

Attribute

Description

Required

model

Directory of EOModel to use as a base for class generation.

Yes

destdir

Destination directory for Java classes (ignoring their package names).

Yes

overwrite

If set to "true", will overwrite older versions of generated classes. Ignored unless makepairs is set to "false".

No

makepairs

If set to "true", will generate subclass/superclass pairs, with all generated code included in superclass (default is "true").

No

template

Location of Velocity template file for Java class generation. If ommitted, default template is used.

No

supertemplate

Location of Velocity template file for Java superclass generation. Ignored unless "makepairs" set to "true". If ommitted, default template is used.

No

superpkg

Java package name of generated superclasses. Ignored unless "makepairs" set to "true". If omitted, each superclass will be assigned the same package as subclass. Note that having superclass in a different package would only make sense when "usepkgpath" is set to "true". Otherwise classes from different packages will end up in the same directory.

No

usepkgpath

If set to "true" (default), a directory tree will be generated in "destDir" corresponding to the class package structure, if set to "false", classes will be generated in "destDir" ignoring their package.

No

usevaluetype

If set to "true" (default is "false"), "valueType" specified in the EOModel will be taken into account when generating numeric attributes, resulting in Enterprise Objects with attribute types like java.lang.Integer, java.lang.Double, java.lang.Boolean, etc. Otherwise a generic java.lang.Number is used as attribute type.

No

Examples

1. Generating EOEnterpriseObject subclass/superclass pairs from EOModel located in "src/test.eomodeld". All generated subclasses and superclasses will be saved in the same directory "src/java/eo" regardless of their package names:

Unknown macro: noformat. Click on this message for details.

2. Generating EOEnterpriseObject subclass/superclass pairs using (and creating if needed) package directories. If an entity "Artist" maps to Java class "org.objectstyle.art.Artist", the following files will be generated for this entity:

  • src/java/org/objectstyle/art/Artist.java
  • src/java/org/objectstyle/art/_Artist.java

Unknown macro: noformat. Click on this message for details.