WOGen Task Manual
This has been transcribed by Andrew Lindesay from the old WOProject site.
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.
Directory of EOModel to use as a base for class generation.
Destination directory for Java classes (ignoring their package names).
If set to "true", will overwrite older versions of generated classes. Ignored unless makepairs is set to "false".
If set to "true", will generate subclass/superclass pairs, with all generated code included in superclass (default is "true").
Location of Velocity template file for Java class generation. If ommitted, default template is used.
Location of Velocity template file for Java superclass generation. Ignored unless "makepairs" set to "true". If ommitted, default template is used.
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.
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.
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.
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:
<taskdef name="wogen" classname="org.objectstyle.woproject.ant.WOGenerator"> <classpath refid="classpath"/> </taskdef> <wogen model="src/test.eomodeld" destDir="src/java/eo" usepkgpath="false"/>
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:
<taskdef name="wogen" classname="org.objectstyle.woproject.ant.WOGenerator"> <classpath refid="classpath"/> </taskdef> <wogen model="src/test.eomodeld" destDir="src/java"/>