Re: Fix for "import java.util.List;" in superclass.vm template

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Sep 09 2003 - 01:10:39 EDT

  • Next message: Scott Finnerty: "CVS"

    Thanks! I will do some testing and apply this.

    [I love Velocity for things like simple templates that do not change
    often, but the code is ugly indeed. I can't imagine how people are
    doing the whole websites with it. ;-) ]

    Andrus

    On Monday, September 8, 2003, at 10:09 PM, Mike Kienenberger wrote:

    > List needs to be conditionally included in the current superclass.vm
    > template.
    > Here's code that will do it (ugly as it may be), replacing everything
    > starting at the beginning of the file to the /** Class comment (in
    > order to
    > show the #end whitespace adjustment)
    >
    > -Mike
    >
    >
    > =======================
    > #if( ${classGen.isUsingPackage()} )
    > package ${classGen.packageName};
    > #end
    >
    > ## import.java.util.List if there are any to-many relationships
    > #set( $flagVariableHasToManyRelationships = 0 )
    > #foreach( $rel in ${classGen.Entity.Relationships} )
    > #set( $classGen.Prop = $rel.Name )## let controller know about current
    > property
    > #if( $rel.ToMany )
    > #set( $flagVariableHasToManyRelationships = 1 )
    > #end
    > #end
    > #if( 0 != $flagVariableHasToManyRelationships )
    > import java.util.List;
    >
    > #end
    > /** Class ${classGen.superPrefix}${classGen.className} was generated by
    > Cayenne.
    > =======================
    >



    This archive was generated by hypermail 2.0.0 : Tue Sep 09 2003 - 01:07:58 EDT