portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/build/torque/templates/sql/security Control.vm default-roles-perms.vm default-secure-passwords.vm
Date Mon, 12 Nov 2001 03:33:43 GMT
taylor      01/11/11 19:33:42

  Added:       build/torque build.properties build.xml license.txt
                        service.props
               build/torque/lib velocity-1.2-dev.jar
               build/torque/schema dbpsml-schema.xml project-schema.xml
                        turbine-schema.xml
               build/torque/templates/data Control.vm dataset.vm table.vm
               build/torque/templates/data/dump Control.vm bottom.vm row.vm
                        top.vm
               build/torque/templates/om Control.vm ExtensionObject.vm
                        ExtensionPeer.vm MapBuilder.vm MultiExtendObject.vm
                        Object.vm Peer.vm
               build/torque/templates/service Control.vm
                        ServiceImplementation.vm ServiceInterface.vm
                        ServiceStaticHelper.vm
               build/torque/templates/sql/base Control.vm
               build/torque/templates/sql/base/db2 columns.vm db.props
                        drop.vm foreignkey.vm index.vm primarykey.vm
                        sequence.vm table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/hypersonic columns.vm
                        db.props drop.vm foreignkey.vm index.vm
                        primarykey.vm table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/interbase columns.vm
                        db.props drop.vm foreignkey.vm index.vm
                        primarykey.vm table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/mssql columns.vm db.props
                        drop.vm foreignkey.vm index.vm primarykey.vm
                        table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/mysql columns.vm db.props
                        drop.vm foreignkey.vm index.vm primarykey.vm
                        table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/oracle columns.vm db.props
                        drop.vm foreignkey.vm index.vm primarykey.vm
                        sequence.vm table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/postgresql columns.vm
                        db.props drop.vm foreignkey.vm index.vm
                        primarykey.vm table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/sapdb columns.vm db.props
                        drop.vm foreignkey.vm index.vm primarykey.vm
                        sequence.vm table.vm tablefk.vm unique.vm
               build/torque/templates/sql/base/sybase columns.vm db.props
                        drop.vm foreignkey.vm index.vm primarykey.vm
                        table.vm tablefk.vm unique.vm
               build/torque/templates/sql/db-init Control.vm
               build/torque/templates/sql/db-init/hypersonic unix.vm
                        windows.vm
               build/torque/templates/sql/db-init/mssql unix.vm windows.vm
               build/torque/templates/sql/db-init/mysql unix.vm windows.vm
               build/torque/templates/sql/db-init/postgresql unix.vm
               build/torque/templates/sql/db-init/sapdb unix.vm windows.vm
               build/torque/templates/sql/db-init/sybase unix.vm windows.vm
               build/torque/templates/sql/id-table Control.vm idtable.db2
                        idtable.hypersonic idtable.interbase idtable.mssql
                        idtable.mysql idtable.oracle idtable.postgresql
                        idtable.sapdb idtable.sybase project.props
                        turbine.props
               build/torque/templates/sql/load Control.vm
               build/torque/templates/sql/load/hypersonic row.vm val.vm
               build/torque/templates/sql/load/mysql row.vm val.vm
               build/torque/templates/sql/load/postgresql row.vm val.vm
               build/torque/templates/sql/security Control.vm
                        default-roles-perms.vm default-secure-passwords.vm
  Log:
  added Torque to build for generating dbpsml
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/build/torque/build.properties
  
  Index: build.properties
  ===================================================================
  # -------------------------------------------------------------------
  # 
  # T O R Q U E  C O N F I G U R A T I O N  F I L E
  # 
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------
  # 
  #  T U R B I N E  P R O J E C T
  #
  # -------------------------------------------------------------------
  # This is the name of your Turbine project. Your generated sources
  # will be named using the project name selected below. If your
  # project=killerapp then you will have a generated:
  #
  # killerapp-schema.sql
  #
  # IMPORTANT!
  # This means that your project schema MUST be named
  # killerapp-schema.xml and it MUST be placed in the
  # schema directory for Torque to work property.
  #
  # The object model sources generated are independent of
  # the project name selected.
  # -------------------------------------------------------------------
  
  project=dbpsml
  
  # -------------------------------------------------------------------
  # 
  #  T A R G E T  D A T A B A S E
  #
  # -------------------------------------------------------------------
  # This is the target database, only considered when generating
  # the SQL for your Turbine project. Your possible choices are
  #
  # db2
  # hypersonic
  # mysql
  # oracle
  # postgresql
  # mssql
  #
  # Default: none
  # -------------------------------------------------------------------
  
  database=hypersonic
  
  # -------------------------------------------------------------------
  # 
  #  O B J E C T  M O D E L  I N F O R M A T I O N
  #
  # -------------------------------------------------------------------
  # These settings will allow you to customize the way your
  # Peer-based object model is created.
  # -------------------------------------------------------------------
  # addSaveMethod=true, adds tracking code to determine how to save an
  # object
  # set objectModelType=complex to generate an om with collection
  # support, (not tested - please help to debug)
  # -------------------------------------------------------------------
  
  targetPackage=org.apache.jetspeed.om.dbpsml
  addSaveMethod=true
  addGetByNameMethod=true
  complexObjectModel=true
  basePrefix=Base
  
  # -------------------------------------------------------------------
  # 
  #  D A T A B A S E  S E T T I N G S
  #
  # -------------------------------------------------------------------
  # JDBC connection settings. This is used by the JDBCToXML task that
  # will create an XML database schema from JDBC metadata. These
  # settings are also used by the SQL Ant task to initialize your
  # Turbine system with the generated SQL.
  # -------------------------------------------------------------------
  
  # databaseUrl = jdbc:mysql://127.0.0.1/turbine
  # databaseUrl = jdbc:oracle:thin@bluesun2:1521:radiohead"
  # databaseUrl = jdbc:cloudscape:d:/bsdev/dbs/bluedb
  databaseUrl = jdbc:HypersonicSQL:${webapp.dir}/WEB-INF/db/jetspeed
  
  # databaseDriver = org.gjt.mm.mysql.Driver
  # databaseDriver = oracle.jdbc.driver.OracleDriver
  # databaseDriver = COM.cloudscape.coreJDBCDriver
  databaseDriver=org.hsql.jdbcDriver
  
  databaseUser = sa
  databasePassword = 
  databaseHost = localhost
  
  # -------------------------------------------------------------------
  # You should NOT have to edit anything below here.
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------
  # 
  #  C O N F I G U R A T I O N  D I R E C T O R Y
  #
  # -------------------------------------------------------------------
  # This is the directory that Torque looks in the find
  # its torque.props file.
  #
  # Default: none
  # -------------------------------------------------------------------
  
  configDir=./config
  
  # -------------------------------------------------------------------
  # 
  #  T E M P L A T E  P A T H
  #
  # -------------------------------------------------------------------
  
  templatePath = templates
  
  # -------------------------------------------------------------------
  # 
  #  C O N T R O L  T E M P L A T E S
  #
  # -------------------------------------------------------------------
  
  SQLControlTemplate = sql/base/Control.vm
  OMControlTemplate = om/Control.vm
  IntakeControlTemplate = intake/Control.vm
  ServiceControlTemplate = service/Control.vm
  idTableControlTemplate = sql/id-table/Control.vm
  DataDTDControlTemplate = data/Control.vm
  DataDumpControlTemplate = data/dump/Control.vm
  DataSQLControlTemplate = sql/load/Control.vm
  
  # -------------------------------------------------------------------
  # 
  #  O U T P U T  D I R E C T O R Y
  #
  # -------------------------------------------------------------------
  
  outputDirectory=../../src
  
  # -------------------------------------------------------------------
  # 
  #  S C H E M A  D I R E C T O R Y
  #
  # -------------------------------------------------------------------
  
  schemaDirectory=schema
  
  
  
  1.1                  jakarta-jetspeed/build/torque/build.xml
  
  Index: build.xml
  ===================================================================
  <project name="Torque" default="main" basedir=".">
  
    <property name="torque.home" value="."/>
  
    <!-- 
  	     Build classpath 
  	     Looks like we have two different versions of velocity-1.2-dev.jar
  			 The one in jetspeed/lib is newer, however this version of Torque
  			 is incompatible with the newer Velocity.
    -->
  
    <path id="classpath">
      <pathelement location="../../lib/turbine-2.2-dev-20010912.jar"/>
      <pathelement location="./lib/velocity-1.2-dev.jar"/>
      <pathelement location="../../lib/village-1.5.3.jar"/>
      <pathelement location="../../lib/xerces-1.3.1.jar"/>
    </path>
  
    <!--
         Load the build.properties file. All the targets use the
         information stored in the properties file. 
    -->
    
    <property name="build.properties" value="build.properties"/>
    <property file="${build.properties}"/>
  
    <!-- ================================================================ -->
    <!-- M A I N  T A R G E T                                             -->
    <!-- ================================================================ -->
    <!-- This default target will run all the targets that generate       -->
    <!-- source. You will probably only run this target once then         -->
    <!-- call individual targets as necessary to update your sources      -->
    <!-- when you change your XML schema.                                 -->
    <!-- ================================================================ -->
  
    <target name="main">
      <antcall target="project-sql"/>
      <antcall target="project-om"/>
    </target>
  
  
    <!-- ================================================================ -->
    <!-- I N I T  T A S K  T A R G E T                                    -->
    <!-- ================================================================ -->
    <!-- Taskdefs are defined inside this target as Ant seems to have     -->
    <!-- problems defining them at the top level.                         -->
    <!-- ================================================================ -->
  
    <target name="init-tasks">
  
      <taskdef name="torque-datasql"
        classname="org.apache.turbine.torque.TorqueDataSQLTask">
        <classpath refid="classpath"/>
      </taskdef>
  
      <taskdef name="torque-datadump"
        classname="org.apache.turbine.torque.TorqueDataDumpTask">
        <classpath refid="classpath"/>
      </taskdef>
  
      <taskdef name="torque-datadtd"
        classname="org.apache.turbine.torque.TorqueDataDTDTask">
        <classpath refid="classpath"/>
      </taskdef>
  
      <taskdef name="torque-sql"
        classname="org.apache.turbine.torque.TorqueSQLTask">
        <classpath refid="classpath"/>
      </taskdef>
  
      <taskdef name="torque-om"
        classname="org.apache.turbine.torque.TorqueObjectModelTask">
        <classpath refid="classpath"/>
      </taskdef>
  
      <!--taskdef name="torque-intake"
        classname="org.apache.turbine.torque.TorqueIntakeTask">
        <classpath refid="classpath"/>
      </taskdef-->
  
      <taskdef name="sql-xml"
        classname="org.apache.turbine.torque.TorqueSQLTransformTask">
        <classpath refid="classpath"/>
      </taskdef>
  
      <taskdef name="texen"
        classname="org.apache.velocity.texen.ant.TexenTask">
        <classpath refid="classpath"/>
      </taskdef>
  
    </target>
  
    <!-- ================================================================ -->
    <!-- Generate SQL from XML data file                                  -->
    <!-- ================================================================ -->
  
    <target name="project-datasql" depends="init-tasks">
  
      <echo message="+-----------------------------------------------+"/>
      <echo message="|                                               |"/>
      <echo message="| Generating SQL from data XML !                |"/>
      <echo message="| Woo hoo!                                      |"/>
      <echo message="|                                               |"/>
      <echo message="+-----------------------------------------------+"/>
      <echo message=" taking build.properties from: ${build.properties}"/>
  
      <torque-datasql
        contextProperties="${build.properties}"
        controlTemplate="${DataSQLControlTemplate}"
        outputDirectory="${torque.home}/${outputDirectory}"
        templatePath="${templatePath}"
        outputFile="report.${project}.datasql.generation"
        xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
        dataXmlFile="${torque.home}/${schemaDirectory}/${project}-data.xml"
        dataDTD="${torque.home}/${schemaDirectory}/${project}-data.dtd"
        databaseName="${databaseName}"
        targetDatabase="${database}"
      />
  
    </target>
  
    <!-- ================================================================ -->
    <!-- Dump data from databse into xml file                             -->
    <!-- ================================================================ -->
  
    <target name="project-datadump" depends="init-tasks">
  
      <echo message="+-----------------------------------------------+"/>
      <echo message="|                                               |"/>
      <echo message="| Dumping the data from database into XML       |"/>
      <echo message="| Woo hoo!                                      |"/>
      <echo message="|                                               |"/>
      <echo message="+-----------------------------------------------+"/>
      <echo message=" taking build.properties from: ${build.properties}"/>
  
      <torque-datadump
        contextProperties="${build.properties}"
        controlTemplate="${DataDumpControlTemplate}"
        outputDirectory="${torque.home}/${outputDirectory}"
        templatePath="${templatePath}"
        outputFile="report.${project}.datadump.generation"
        xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
        databaseName="${databaseName}"
      />
  
    </target>
  
    <!-- ================================================================ -->
    <!-- G E N E R A T E  P R O J E C T  D A T A  D T D                   -->
    <!-- ================================================================ -->
    <!-- Generate the DATA DTD for your project                           -->
    <!-- ================================================================ -->
  
    <target name="project-datadtd" depends="init-tasks">
  
      <echo message="+-----------------------------------------------+"/>
      <echo message="|                                               |"/>
      <echo message="| Generating Data DTD for YOUR Turbine project! |"/>
      <echo message="| Woo hoo!                                      |"/>
      <echo message="|                                               |"/>
      <echo message="+-----------------------------------------------+"/>
  
      <torque-datadtd
        contextProperties="${build.properties}"
        controlTemplate="${DataDTDControlTemplate}"
        outputDirectory="${torque.home}/${outputDirectory}"
        templatePath="${templatePath}"
        outputFile="report.${project}.datadtd.generation"
        xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
      />
  
    </target>
  
  
    <!-- ================================================================ -->
    <!-- G E N E R A T E  P R O J E C T  S Q L                            -->
    <!-- ================================================================ -->
    <!-- Generate the SQL for your project, these are in addition         -->
    <!-- to the base Turbine tables! The tables you require for your      -->
    <!-- project should be specified in project-schema.xml.               -->
    <!-- ================================================================ -->
  
    <target name="project-sql" depends="init-tasks">
  
      <echo message="+------------------------------------------+"/>
      <echo message="|                                          |"/>
      <echo message="| Generating SQL for YOUR Turbine project! |"/>
      <echo message="| Woo hoo!                                 |"/>
      <echo message="|                                          |"/>
      <echo message="+------------------------------------------+"/>
  
      <torque-sql
        contextProperties="${build.properties}"
        controlTemplate="${SQLControlTemplate}"
        outputDirectory="${torque.home}/${outputDirectory}/sql"
        templatePath="${templatePath}"
        outputFile="report.${project}.sql.generation"
        xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
        targetDatabase="${database}"
      />
  
    </target>
  
    <!-- ================================================================ -->
    <!-- G E N E R A T E  P R O J E C T  P E E R  B A S E D  O M          -->
    <!-- ================================================================ -->
    <!-- Generate the Peer-based object model for your project.           -->
    <!-- These are in addition to the base Turbine OM!                    -->
    <!-- ================================================================ -->
  
  
    <target name="project-om" depends="init-tasks">
  
      <echo message="+------------------------------------------+"/>
      <echo message="|                                          |"/>
      <echo message="| Generating Peer-based Object Model for   |"/>
      <echo message="| YOUR Turbine project! Woo hoo!           |"/>
      <echo message="|                                          |"/>
      <echo message="+------------------------------------------+"/>
  
      <torque-om
        contextProperties="${build.properties}"
        controlTemplate="${OMControlTemplate}"
        outputDirectory="${torque.home}/${outputDirectory}/java"
        templatePath="${templatePath}"
        outputFile="report.${project}.om.generation"
        targetPackage="${targetPackage}.om"
        xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
      />
    
    </target>
  
    <!-- =================================================================== -->
    <!-- C O M P I L E  O M                                                  -->
    <!-- =================================================================== -->  
    <target name="compile">
      
      <!-- 
        This should be moved to the top of the file, and
        the values should come from the build.properties file.
      -->
      
      <property name="src.dir" value="${outputDirectory}/java"/>
      <property name="build.dest" value="bin/classes"/>
      <property name="debug" value="on"/>
      <property name="deprecation" value="off"/>
      <property name="optimize" value="off"/>
      
      <mkdir dir="${build.dest}"/>
      
      <javac srcdir="${src.dir}"
        destdir="${build.dest}"
        debug="${debug}"
        deprecation="${deprecation}"
        optimize="${optimize}">
              
        <classpath refid="classpath"/>
  
      </javac>
    </target>
  
  
    <!-- ================================================================ -->
    <!-- G E N E R A T E  T U R B I N E  S E R V I C E                    -->
    <!-- ================================================================ -->
    <!-- Generate turbine service code.                                   -->
    <!-- ================================================================ -->
    
    <target name="turbine-service" depends="init-tasks">
    
      <texen 
        contextProperties="service.props"
        controlTemplate="${ServiceControlTemplate}"
        outputDirectory="${outputDirectory}"
        templatePath="${templatePath}"
        outputFile="report.${project}.service.generation"
      />
      
    </target>
  
    <!-- =================================================================== -->
    <!-- Create an xml schema from an sql schema.                            -->
    <!--                                                                     -->
    <!--  inputFile: The input sql file. This must be valid sql file but     -->
    <!--             it not not be in any specific format.                   -->
    <!-- outputFile: The file where the xml schema will be written           -->
    <!-- =================================================================== -->
  
    <target name="sql2xml" depends="init-tasks">
      <sql-xml
        inputFile="schema/schema.sql"
        outputFile="schema/schema.xml"
      />
    </target>
  
    <!-- ================================================================== -->
    <!-- Creates the API documentation                                      -->
    <!-- ================================================================== -->
    <target name="javadocs"
            description="--> generates the API documentation">
      <mkdir dir="${torque.home}/${outputDirectory}/javadoc"/>
      <javadoc sourcepath="${torque.home}/${outputDirectory}"
               packagenames="${targetPackage}.*"
               destdir="${outputDirectory}/javadoc"
               author="true"
               private="true"
               version="true"
               use="true"
      >
        <classpath refid="classpath"/>
      </javadoc>
    </target>
  
  </project>
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/license.txt
  
  Index: license.txt
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and 
   *    "Apache Turbine" must not be used to endorse or promote products 
   *    derived from this software without prior written permission. For 
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without 
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Java stuff.
  import java.util.*;
  
  // Turbine stuff.
  import org.apache.turbine.services.db.*;
  
  /**
   * Default Builder for Database/Table/Column Maps within the Turbine
   * System.  If you decide to use your own table schema, then you
   * probably will want to implement this class on your own.  It is then
   * defined within the TurbineResources.properties file.
   *
   * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
   * @version $Id: license.txt,v 1.1 2001/11/12 03:33:38 taylor Exp $
   */
  
  
  
  1.1                  jakarta-jetspeed/build/torque/service.props
  
  Index: service.props
  ===================================================================
  baseName=BSF
  package=org.apache.turbine.services.bsf
  name=Jason van Zyl
  email=jvanzyl@apache.org
  
  ## The contents of the file license.txt
  ## will be available in the context
  ## as $license.
  
  license.file.contents = license.txt
  
  
  
  1.1                  jakarta-jetspeed/build/torque/lib/velocity-1.2-dev.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/build/torque/schema/dbpsml-schema.xml
  
  Index: dbpsml-schema.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
  <!DOCTYPE app-data SYSTEM
            "http://jakarta.apache.org/turbine/dtd/database.dtd">
  
  <!-- ==================================================================== -->
  <!--                                                                      -->
  <!-- D B P S M L  P R O J E C T  S C H E M A                              -->
  <!--                                                                      -->
  <!-- ==================================================================== -->
  <!-- This schema  will be used for by DatabasePsmlManager implementation. -->
  <!-- Author: Atul Dambalkar                                               -->
  <!-- ==================================================================== -->
  
  <app-data>
  
  <database defaultIdMethod="idbroker" 
            basePeer="org.apache.turbine.om.peer.BasePeer" >
  
    <table name="JETSPEED_USER_PROFILE" idMethod="idbroker" >
      
      <column name="PSML_ID" required="true" primaryKey="true" 
              autoIncrement="true" type="INTEGER"/>   
      <column name="USER_NAME" required="true" size="32" type="VARCHAR"/>
      <column name="MEDIA_TYPE" size="99" type="VARCHAR"/>
      <column name="LANGUAGE" size="2" type="VARCHAR"/>
      <column name="COUNTRY" size="2" type="VARCHAR"/>
      <column name="PAGE" size="99" type="VARCHAR"/>
      <column name="PROFILE" required="true" type="VARBINARY"/>
  
      <unique name="JETSPEED_USER_PROFILE_UNIQUE">
        <unique-column name="USER_NAME" />
        <unique-column name="MEDIA_TYPE" />
        <unique-column name="LANGUAGE" />
        <unique-column name="COUNTRY" />
        <unique-column name="PAGE" />
      </unique>
  
      <index name="JETSPEED_USER_PROFILE_INDEX">
        <index-column name="USER_NAME" />
        <index-column name="MEDIA_TYPE" />
        <index-column name="LANGUAGE" />
        <index-column name="COUNTRY" />
        <index-column name="PAGE" />
      </index>
  
    </table>
  
    <table name="JETSPEED_GROUP_PROFILE" idMethod="idbroker" >
      
      <column name="PSML_ID" required="true" primaryKey="true" 
              autoIncrement="true" type="INTEGER"/>
      <column name="GROUP_NAME" required="true" size="99" type="VARCHAR"/>
      <column name="MEDIA_TYPE" size="99" type="VARCHAR"/>
      <column name="LANGUAGE" size="2" type="VARCHAR"/>
      <column name="COUNTRY" size="2" type="VARCHAR"/>
      <column name="PAGE" size="99" type="VARCHAR"/>
      <column name="PROFILE" required="true" type="VARBINARY"/>
  
      <unique name="JETSPEED_GROUP_PROFILE_UNIQUE">
        <unique-column name="GROUP_NAME" />
        <unique-column name="MEDIA_TYPE" />
        <unique-column name="LANGUAGE" />
        <unique-column name="COUNTRY" />
        <unique-column name="PAGE" />
      </unique>
  
      <index name="JETSPEED_GROUP_PROFILE_INDEX">
        <index-column name="GROUP_NAME" />
        <index-column name="MEDIA_TYPE" />
        <index-column name="LANGUAGE" />
        <index-column name="COUNTRY" />
        <index-column name="PAGE" />
      </index>
  
    </table>
  
    <table name="JETSPEED_ROLE_PROFILE" idMethod="idbroker" >
      
      <column name="PSML_ID" required="true" primaryKey="true" 
              autoIncrement="true" type="INTEGER"/>
      <column name="ROLE_NAME" required="true" size="99" type="VARCHAR"/>
      <column name="MEDIA_TYPE" size="99" type="VARCHAR"/>
      <column name="LANGUAGE" size="2" type="VARCHAR"/>
      <column name="COUNTRY" size="2" type="VARCHAR"/>
      <column name="PAGE" size="99" type="VARCHAR"/>
      <column name="PROFILE" required="true" type="VARBINARY"/>
  
      <unique name="JETSPEED_ROLE_PROFILE_UNIQUE">
        <unique-column name="ROLE_NAME" />
        <unique-column name="MEDIA_TYPE" />
        <unique-column name="LANGUAGE" />
        <unique-column name="COUNTRY" />
        <unique-column name="PAGE" />
      </unique>
  
      <index name="JETSPEED_ROLE_PROFILE_INDEX">
        <index-column name="ROLE_NAME" />
        <index-column name="MEDIA_TYPE" />
        <index-column name="LANGUAGE" />
        <index-column name="COUNTRY" />
        <index-column name="PAGE" />
      </index>
  
    </table>
  
    <table name="JETSPEED_ANON_PROFILE" idMethod="idbroker" >
      
      <column name="PSML_ID" required="true" primaryKey="true" 
              autoIncrement="true" type="INTEGER"/>
      <column name="MEDIA_TYPE" size="99" type="VARCHAR"/>
      <column name="LANGUAGE" size="2" type="VARCHAR"/>
      <column name="COUNTRY" size="2" type="VARCHAR"/>
      <column name="PAGE" size="99" type="VARCHAR"/>
      <column name="PROFILE" required="true" type="VARBINARY"/>
  
      <unique name="JETSPEED_ANON_PROFILE_UNIQUE">
        <unique-column name="MEDIA_TYPE" />
        <unique-column name="LANGUAGE" />
        <unique-column name="COUNTRY" />
        <unique-column name="PAGE" />
      </unique>
  
      <index name="JETSPEED_ANON_PROFILE_INDEX">
        <index-column name="MEDIA_TYPE" />
        <index-column name="LANGUAGE" />
        <index-column name="COUNTRY" />
        <index-column name="PAGE" />
      </index>
  
    </table>
  
  </database>  
  
  </app-data>
  
  
  
  1.1                  jakarta-jetspeed/build/torque/schema/project-schema.xml
  
  Index: project-schema.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
  <!DOCTYPE app-data SYSTEM "http://jakarta.apache.org/turbine/dtd/database.dtd">
  
  <!-- ==================================================================== -->
  <!--                                                                      -->
  <!-- T U R B I N E  P R O J E C T  S C H E M A                            -->
  <!--                                                                      -->
  <!-- ==================================================================== -->
  <!-- This is an example Turbine project schema.                           -->
  <!-- ==================================================================== -->
  
  <app-data>
  
  <!-- 
      Note: the name= attribute in the database tag represents what
            you would use to map to a specific database named in the
            TurbineResources.properties file. If you just want to use
            the defaults, please do not specify a name= attribute.
  
            The benefit is that you can have one database talking to
            one system and another talking to an entirely different
            system.
  
      Example:
          database.INTERPLANETARY.driver=org.postgresql.Driver
          database.INTERPLANETARY.url=jdbc:postgresql:test
          database.INTERPLANETARY.username=graeme
          database.INTERPLANETARY.password=password
  
          database.SIMPLE.driver=org.postgresql.Driver
          database.SIMPLE.url=jdbc:postgresql:foo
          database.SIMPLE.username=foo
          database.SIMPLE.password=bar
  -->
  
  <database name="SIMPLE">
    <table name="SIMPLE">
      <column name="ROWID" required="true" autoIncrement="true"
              primaryKey="true" type="INTEGER"/>
      <column name="NAME" required="true" size="255" type="VARCHAR"/>
      <column name="SPECIES" type="INTEGER" default="-2"/>
      <column name="PLANET" type="INTEGER" default="-1"/>
    </table>
  </database>  
  
  <database name="INTERPLANETARY">  
    <table name="CIVILIZATION">
      <column name="CIV_ID" required="true" autoIncrement="true"
              primaryKey="true" type="INTEGER"/>
      <column name="NAME" required="true" type="LONGVARCHAR"/>
    </table>
  
    <table name="CIV_PEOPLE">
      <column name="CIV_ID" required="true" primaryKey="true" 
              type="INTEGER"/>
      <column name="PEOPLE_ID" required="true" primaryKey="true" type="INTEGER"/>
  
      <foreign-key foreignTable="CIVILIZATION">
          <reference local="CIV_ID" foreign="CIV_ID"/>
      </foreign-key>
      <foreign-key foreignTable="PEOPLE">
          <reference local="PEOPLE_ID" foreign="PEOPLE_ID"/>
      </foreign-key>
    </table>
  
    <table name="PEOPLE">
      <column name="PEOPLE_ID" required="true" autoIncrement="true"
              primaryKey="true" type="INTEGER"/>
      <column name="NAME" required="true" size="255" type="VARCHAR"/>
      <column name="SPECIES" type="INTEGER" default="-2"/>
      <column name="PLANET" type="INTEGER" default="-1"/>
    </table>
  </database>  
  
  </app-data>
  
  
  
  1.1                  jakarta-jetspeed/build/torque/schema/turbine-schema.xml
  
  Index: turbine-schema.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
  <!-- <!DOCTYPE database SYSTEM "http://java.apache.org/turbine/dtd/database.dtd"> -->
  
  <!-- ==================================================================== -->
  <!--                                                                      -->
  <!-- B A S E  T U R B I N E  S C H E M A                                  -->
  <!--                                                                      -->
  <!-- ==================================================================== -->
  <!-- This is the the XML schema used by Torque to generate the necessary  -->
  <!-- sources used to create/initialize the base Turbine system. Torque    -->
  <!-- will create the SQL for the database required by Turbine, and the    -->
  <!-- Peer-based Object Model used by Turbine internally to manage         -->
  <!-- users, security, and job scheduling.                                 -->
  <!-- ==================================================================== -->
  <!-- @author: <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>      -->
  <!-- @version $Id: turbine-schema.xml,v 1.1 2001/11/12 03:33:38 taylor Exp $     -->
  <!-- ==================================================================== -->
  
  <database name="@DATABASE_DEFAULT@">
    
    <table name="TURBINE_PERMISSION" idMethod="idbroker">
      <column name="PERMISSION_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="PERMISSION_NAME" required="true" size="99" type="VARCHAR"/>
      <column name="OBJECTDATA" type="VARBINARY"/>
    
      <unique>
        <unique-column name="PERMISSION_NAME"/>
      </unique>        
      
    </table>
  
    <table name="TURBINE_ROLE" idMethod="idbroker">
      <column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="ROLE_NAME" required="true" size="99" type="VARCHAR"/>
      <column name="OBJECTDATA" type="VARBINARY"/>
    
      <unique>
        <unique-column name="ROLE_NAME"/>
      </unique>
      
    </table>
  
    <table name="TURBINE_GROUP" idMethod="idbroker">
      <column name="GROUP_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="GROUP_NAME" required="true" type="VARCHAR" size="99"/>
      <column name="OBJECTDATA" type="VARBINARY"/>
      
      <unique>
        <unique-column name="GROUP_NAME"/>
      </unique>
    
    </table>
      
    <table name="TURBINE_ROLE_PERMISSION">
      <column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="PERMISSION_ID" required="true" primaryKey="true" type="INTEGER"/>
      
      <foreign-key foreignTable="TURBINE_ROLE">
        <reference local="ROLE_ID" foreign="ROLE_ID"/>
      </foreign-key>
      
      <foreign-key foreignTable="TURBINE_PERMISSION">
        <reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
      </foreign-key>
    </table>
      
    <table name="TURBINE_USER" idMethod="idbroker">
      <column name="USER_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="LOGIN_NAME" required="true" size="32" type="VARCHAR"/>
      <column name="PASSWORD_VALUE" required="true" size="32" type="VARCHAR"/>
      <column name="FIRST_NAME" required="true" size="99" type="VARCHAR"/>
      <column name="LAST_NAME" required="true" size="99" type="VARCHAR"/>
      <column name="EMAIL" size="99" type="VARCHAR"/>
      <column name="CONFIRM_VALUE" size="99" type="VARCHAR"/>
      <column name="MODIFIED" type="TIMESTAMP"/>
      <column name="CREATED" type="TIMESTAMP"/>
      <column name="LAST_LOGIN" type="TIMESTAMP"/>
      <column name="OBJECTDATA" type="VARBINARY"/>
      
      <unique>
          <unique-column name="LOGIN_NAME"/>
      </unique>        
    
    </table>
  
    <table name="TURBINE_USER_GROUP_ROLE">
      <column name="USER_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="GROUP_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>
    
      <foreign-key foreignTable="TURBINE_USER">
        <reference local="USER_ID" foreign="USER_ID"/>
      </foreign-key>
  
      <foreign-key foreignTable="TURBINE_GROUP">
        <reference local="GROUP_ID" foreign="GROUP_ID"/>
      </foreign-key>
  
      <foreign-key foreignTable="TURBINE_ROLE">
        <reference local="ROLE_ID" foreign="ROLE_ID"/>
      </foreign-key>
    </table>
  
    <table name="TURBINE_SCHEDULED_JOB" idMethod="idbroker">
      <column name="JOB_ID" required="true" primaryKey="true" type="INTEGER"/>
      <column name="SECOND" default="-1" required="true" type="INTEGER"/>
      <column name="MINUTE" default="-1" required="true" type="INTEGER"/>
      <column name="HOUR" default="-1" required="true" type="INTEGER"/>
      <column name="WEEK_DAY" default="-1" required="true" type="INTEGER"/>
      <column name="DAY_OF_MONTH" default="-1" required="true" type="INTEGER"/>
      <column name="TASK" required="true" size="99" type="VARCHAR"/>
      <column name="EMAIL" size="99" type="VARCHAR"/>
      <column name="PROPERTY" type="VARBINARY"/>
    </table>
  
    <table name="ID_TABLE">
      <column name="ID_TABLE_ID" autoIncrement="true" required="true" primaryKey="true" type="INTEGER"/>
      <column name="TABLE_NAME" required="true" size="255" type="VARCHAR"/>
      <column name="NEXT_ID" type="INTEGER"/>
      <column name="QUANTITY" type="INTEGER"/>
      
      <unique>
        <unique-column name="TABLE_NAME"/>
      </unique>        
    </table>
  
  </database>
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/data/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $hfname= "data/dataset.vm" )
  #set ( $fname= "data/table.vm" )
  
  #foreach ($databaseModel in $appData.Databases)
      #if ($project)
          #if ($appData.MultipleDatabases)
              #set ( $outFile = "${project}-${databaseModel.Name}-data.dtd" )
          #else
              #set ( $outFile = "${project}-data.dtd" )
          #end
          $generator.parse($hfname,$outFile,"tables",$databaseModel.Tables)
          #foreach ($tbl in $databaseModel.Tables)
              $generator.parse($fname,$outFile,"table",$tbl)
          #end
      #else
          #foreach ($tbl in $databaseModel.Tables)
              $generator.parse($fname,"","table",$tbl)
          #end
      #end
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/data/dataset.vm
  
  Index: dataset.vm
  ===================================================================
  <!ELEMENT dataset (
  #foreach($tbl in $tables)#if($velocityCount>1),
  #end
      ${tbl.JavaName}*#end
  )>
  <!ATTLIST dataset
      name CDATA #REQUIRED
  >
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/data/table.vm
  
  Index: table.vm
  ===================================================================
  <!ELEMENT $table.JavaName EMPTY>
  <!ATTLIST $table.JavaName
  #foreach ($col in $table.columns)
      $col.JavaName CDATA #if($col.isNotNull())#REQUIRED#else#IMPLIED#end
  
  #end
  >
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/data/dump/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $tfname= "data/dump/top.vm" )
  #set ( $fname= "data/dump/row.vm" )
  #set ( $bfname= "data/dump/bottom.vm" )
  #set ($q = '"')
  
  #if ($project)
      #if ($databaseModel.Name)
          #set ($outFile="${project}-${databaseModel.Name}-${dataset}-data.xml")
      #else
          #set ( $outFile = "${project}-${dataset}-data.xml" )
      #end
  #else
      #set ( $outFile = "" )
  #end
  
  $generator.parse($tfname,$outFile,"dataset",$dataset)
  #foreach ($tbl in $databaseModel.Tables)
  fetching table $tbl.Name
      #foreach ($r in $tableTool.fetch($tbl.Name)).##
          #set ($rout = "<$tbl.JavaName")
          #foreach ($col in $tbl.Columns)
              #set ($cval = $r.get($col.Name))
              #if ($cval)
                  #set ($rout = "$rout ${col.JavaName}=$q$cval$q")
              #end
          #end
          #set ($rout = "$rout/>")
          $generator.parse($fname,$outFile,"row", $rout)
      #end
  #end
  $generator.parse($bfname,$outFile,"tables",$databaseModel.Tables)
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/data/dump/bottom.vm
  
  Index: bottom.vm
  ===================================================================
  </dataset>
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/data/dump/row.vm
  
  Index: row.vm
  ===================================================================
      $row
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/data/dump/top.vm
  
  Index: top.vm
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
  <!DOCTYPE dataset SYSTEM "file://${project}-data.dtd">
  <dataset name="$dataset">
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/om/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ($basePath = $generator.OutputPath)
  #foreach ($databaseModel in $appData.Databases)
      #if ($databaseModel.Package)
          #set ($package = $databaseModel.Package)   
      #else   
          #set ($package = $targetPackage)
      #end
  
      #set ( $pkbase = "${package}" )
      #set ( $pkpeer = "${package}" )
      #set ( $pkmap = "${package}.map" )
  
      $pkbase
      $pkpeer
      $pkmap
  
      #set ( $path = $strings.getPackageAsPath($pkpeer) )
      $files.mkdir("$outputDirectory/$path")
  
      #set ( $path = $strings.getPackageAsPath($pkmap) )
      $files.mkdir("$outputDirectory/$path")
  
      #set ( $path = $strings.getPackageAsPath($pkbase) )
      $files.mkdir("$outputDirectory/$path")
  
      #foreach ($tbl in $databaseModel.Tables)
          $tbl.Name
  
          #set ( $firstcap=$tbl.JavaName )
  
          #set ( $fname = "$basePrefix${firstcap}Peer.java" )
          #set ( $path = "${strings.getPackageAsPath($pkbase)}$fname" )
          $generator.parse("om/Peer.vm",$path,"table",$tbl)
  
          #if (!$tbl.isAlias())
              #set ( $fname = "${firstcap}MapBuilder.java" )
              #set ( $path = "${strings.getPackageAsPath($pkmap)}$fname" )
              $generator.parse("om/MapBuilder.vm",$path,"table",$tbl)
          #end
  
          #set ( $fname = "${basePrefix}${firstcap}.java" )
          #set ( $path = "${strings.getPackageAsPath($pkbase)}$fname" )
          $generator.parse("om/Object.vm",$path,"table",$tbl)
  
          #set ( $fname = "${firstcap}.java" )
          #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
          #if (!$files.file($basePath,$path).exists())
              $generator.parse("om/ExtensionObject.vm",$path,"table",$tbl)
          #end
  
          #set ( $fname = "${firstcap}Peer.java" )
          #set ( $path = "${strings.getPackageAsPath($pkpeer)}$fname" )
          #if (!$files.file($basePath,$path).exists())
              $generator.parse("om/ExtensionPeer.vm",$path,"table",$tbl)
          #end
  
          #if ($tbl.ChildrenColumn)
              #set ($col = $tbl.ChildrenColumn)
              #if ($col.isEnumeratedClasses())
                  #foreach ($child in $col.Children)
  
  #set ( $fname = "${child.ClassName}.java" )
  #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
  #if (!$files.file($basePath,$path).exists())
      $generator.parse("om/MultiExtendObject.vm",$path,"child",$child)
  #end
          
                  #end
              #end
          #end
      #end
  #end
  
  
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/om/ExtensionObject.vm
  
  Index: ExtensionObject.vm
  ===================================================================
  #set ($db = $table.Database)
  #if ($db.Package)
      #set ($package = $db.Package)
  #else
      #set ($package = $targetPackage)
  #end
  package $package;
  
  #if ($table.isAbstract())
      #set ($abstract = "abstract")
  #end
  
  // JDK classes
  import java.util.*;
  
  // Turbine classes
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  #if ($addSaveMethod)
  import org.apache.turbine.util.ObjectUtils;
  #end
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
  #if ($addTimeStamp)
    * The skeleton for this class was autogenerated by Torque on:
    *
    * [$now]
    *
  #end
    * You should add additional methods to this class to meet the
    * application requirements.  This class will only be generated as
    * long as it does not already exist in the output directory.
    */
  public $!abstract class $table.JavaName 
      extends ${package}.$basePrefix$table.JavaName
      implements Persistent
  {
  }
  
  
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/om/ExtensionPeer.vm
  
  Index: ExtensionPeer.vm
  ===================================================================
  #set ($db = $table.Database)
  #if ($db.Package)
      #set ($package = $db.Package)
  #else
      #set ($package = $targetPackage)
  #end
  package ${package};
  
  // JDK classes
  import java.util.*;
  
  // Village classes
  import com.workingdogs.village.*;
  
  // Turbine classes
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  // Local classes
  import ${package}.map.*;
  
  /** 
  #if ($addTimeStamp)
    * The skeleton for this class was autogenerated by Torque on:
    *
    * [$now]
    *
  #end
    *  You should add additional methods to this class to meet the
    *  application requirements.  This class will only be generated as
    *  long as it does not already exist in the output directory.
    */
  public class ${table.JavaName}Peer 
      extends ${package}.$basePrefix${table.JavaName}Peer
  {
  }
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/om/MapBuilder.vm
  
  Index: MapBuilder.vm
  ===================================================================
  package ${package}.map;
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.services.db.PoolBrokerService;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.db.map.MapBuilder;
  import org.apache.turbine.util.db.map.DatabaseMap;
  import org.apache.turbine.util.db.map.TableMap;
  
  /**
  #if ($addTimeStamp)
   *  This class was autogenerated by Torque on: 
   *
   * [$now]
   *
  #end
   */
  public class ${table.JavaName}MapBuilder implements MapBuilder
  {
      /** the name of this class */
      public static final String CLASS_NAME = "${package}.map.${table.JavaName}MapBuilder";
  
      /** item */
      public static String getTable( )
      {
          return "$table.Name";
      }
  
  #foreach ($col in $table.Columns)
      #set ( $tfc=$table.JavaName )
      #set ( $cfc=$col.JavaName )
      #set ( $cup=$col.Name.toUpperCase() )
  
      /** ${table.Name}.$cup */
      public static String get${tfc}_${cfc}()
      {
          return getTable() + ".$cup";
      }
  #end
  
      /**  the database map  */
      private DatabaseMap dbMap = null;
  
      /**
          tells us if this DatabaseMapBuilder is built so that we don't have
          to re-build it every time
      */
      public boolean isBuilt()
      {
          if ( dbMap != null )
              return true;
          return false;
      }
  
      /**  gets the databasemap this map builder built.  */
      public DatabaseMap getDatabaseMap()
      {
          return this.dbMap;
      }
      /** the doBuild() method builds the DatabaseMap */
      public void doBuild() throws Exception
      {
          dbMap = TurbineDB.getDatabaseMap("$table.Database.Name");
  
          dbMap.addTable(getTable());
          TableMap tMap = dbMap.getTable(getTable());
  
          #if ($table.IdMethod == "native")
          tMap.setPrimaryKeyMethod(TableMap.NATIVE);
          #elseif ($table.IdMethod == "autoincrement")
          tMap.setPrimaryKeyMethod(TableMap.AUTO_INCREMENT);
          #elseif ($table.IdMethod == "sequence")
          tMap.setPrimaryKeyMethod(TableMap.SEQUENCE);
          #elseif ($table.IdMethod == "idbroker")
          tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
          #else
          tMap.setPrimaryKeyMethod("$table.IdMethod");
          #end
  
  #if ($table.IdMethod == "idbroker")
          tMap.setPrimaryKeyMethodInfo(tMap.getName());
  #elseif ($table.IdMethod == "sequence")
          tMap.setPrimaryKeyMethodInfo("$table.SequenceName");
  #elseif ($table.IdMethodParameters)
          // this might need upgrading based on what all the databases
          // need, but for now assume one parameter.
      #set ($imp = $table.IdMethodParameters.get(0) )
          tMap.setPrimaryKeyMethodInfo("$imp.Value");
  #end        
  
  #foreach ($col in $table.Columns)
      #set ( $tfc=$table.JavaName )
      #set ( $cfc=$col.JavaName )
      #set ( $cup=$col.Name.toUpperCase() )
  
      #if($col.isPrimaryKey())
        #if($col.isForeignKey())
          tMap.addForeignPrimaryKey ( get${tfc}_${cfc}(), $col.JavaObject , "$col.RelatedTableName" , "$col.RelatedColumnName" );
        #else
          tMap.addPrimaryKey ( get${tfc}_${cfc}(), $col.JavaObject );
        #end
      #else
        #if($col.isForeignKey())
          tMap.addForeignKey ( get${tfc}_${cfc}(), $col.JavaObject , "$col.RelatedTableName" , "$col.RelatedColumnName" );
        #else
          tMap.addColumn ( get${tfc}_${cfc}(), $col.JavaObject );
        #end
      #end
  #end
  
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/om/MultiExtendObject.vm
  
  Index: MultiExtendObject.vm
  ===================================================================
  #set ($db = $table.Database)
  #if ($db.Package)
      #set ($package = $db.Package)
  #else
      #set ($package = $targetPackage)
  #end
  package $package;
  
  // JDK classes
  import java.util.*;
  
  // Turbine classes
  import org.apache.turbine.om.BaseObject;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  #if ($addSaveMethod)
  import org.apache.turbine.util.ObjectUtils;
  #end
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  
  #if ($child.Ancestor)
      #set ($parent = $child.Ancestor)
  #else
      #set ($parent = $table.JavaName)
  #end
  
  /** 
  #if ($addTimeStamp)
    * The skeleton for this class was autogenerated by Torque on:
    *
    * [$now]
    *
  #end
    * You should add additional methods to this class to meet the
    * application requirements.  This class will only be generated as
    * long as it does not already exist in the output directory.
    */
  public class $child.ClassName extends $parent
  {
      public ${child.ClassName}()
      {
          #set ($col = $child.Column)
          #set ( $cfc=$col.JavaName )
          #set ($table = $col.Table)
          set${cfc}(${table.JavaName}Peer.CLASSKEY_$child.Key.toUpperCase());
      }
  }
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  #set ($db = $table.Database)
  #if ($db.Package)
      #set ($package = $db.Package)
  #else
      #set ($package = $targetPackage)
  #end
  package ${package};
  
  #if ($table.BaseClass == "")
      #set ($extendsBaseClass = "" )
  #else
      #set ($extendsBaseClass = "extends $table.BaseClass" )
  #end
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  #if ($addSaveMethod)
  import org.apache.turbine.util.ObjectUtils;
  #end
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  #if (!$complexObjectModel)
  import org.apache.turbine.services.db.TurbineDB;
  #end
  
  /** 
  #if ($addTimeStamp)
   * This class was autogenerated by Torque on:
   *
   * [$now]
   *
  #end
   * You should not use this class directly.  It should not even be
   * extended all references should be to $table.JavaName 
   */
  public abstract class $basePrefix$table.JavaName $extendsBaseClass
      implements Retrievable
  {
  #if (!$table.isAlias())
    #foreach ($col in $table.Columns)
      #set ( $cjtype = $col.JavaNative )
      #set ( $clo=$col.Name.toLowerCase() )
      #set ($defVal = "")
      #if ($col.DefaultValue && !$col.DefaultValue.equalsIgnoreCase("NULL") )
          #set ( $quote = '' )
          #if ( $cjtype == "String" ) 
              #set ( $quote = '"' )
          #end
          #set ( $defaultValue = $col.DefaultValue )
          #if ( $cjtype == "boolean" )
              #if ( $defaultValue == "1" || $defaultValue == "Y" )
                  #set ( $defaultValue = "true" )
              #elseif ( $defaultValue == "0" || $defaultValue == "N" )
                  #set ( $defaultValue = "false" )
              #end
         #end
         #if ($cjtype == "BigDecimal")
              #set ($defVal = "= new BigDecimal($defaultValue)")
         #else
             #set ($defVal = "=$quote$defaultValue$quote")
         #end            
      #end
      /** the value for the $clo field */
      private $cjtype $clo$defVal;
    #end
  
  
    #foreach ($col in $table.Columns)
      #set ( $cfc=$col.JavaName )
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype = $col.JavaNative )
      /**
       * Get the $cfc
       * @return $cjtype
       */
       public $cjtype get${cfc}()
       {
            return $clo;
       }
  
      #set ( $throwsClause = "" )
      #if ($complexObjectModel)
          #if ($col.isForeignKey())
              #set ( $throwsClause = "throws Exception" )
          #end    
          #if ( $col.Referrers.size() > 0 )
              #if ($throwsClause == "")
                  #set ( $throwsClause = "throws Exception" )
              #end
          #end
      #end
  
      /**
       * Set the value of $cfc
       */
       public void set${cfc}($cjtype v ) $throwsClause
       {
  #if ($complexObjectModel)
    #if ($col.isForeignKey())
      #set ( $tmp = $col.RelatedTableName )
      #set ( $tblFK = $table.Database.getTable($tmp) )
      #set ( $colFK = $tblFK.getColumn($col.RelatedColumnName) )
      #if ($col.isMultipleFK())
          #set ( $varName = $strings.concat(["a", $tblFK.JavaName, "RelatedBy", $col.JavaName]) )
      #elseif ($tmp.equals($table.Name))
          #set ( $varName = $strings.concat(["a", $tblFK.JavaName, "RelatedBy", $col.JavaName]) )
      #else
          #set ( $varName = $strings.concat(["a", $tblFK.JavaName]) )
      #end
      $varName = null;
    #end
  
    #foreach ($fk in $col.Referrers)
       #set ( $fkColName = $fk.ForeignLocalMapping.get($col.Name) )
       #set ( $tblFK = $fk.Table )
       #if ( !($tblFK.Name.equals($table.Name)) )
  
          #set ( $colFK = $tblFK.getColumn($fkColName) )
  
          #if ($colFK.isMultipleFK())
              #set ( $collName = $strings.concat(["coll", $tblFK.JavaName, "sRelatedBy", $colFK.JavaName]) )
          #else
              #set ( $collName = $strings.concat(["coll", $tblFK.JavaName, "s"]) )
          #end
  
            // update associated $tblFK.JavaName
            if ($collName != null )
            {
                for (int i=0; i<${collName}.size(); i++)
                {
                    ((${tblFK.JavaName})${collName}.get(i))
                        .set${colFK.JavaName}(v);
                }
            }
       #end
    #end 
  #end
  
  #if ($addSaveMethod)
  
   #if ( ($cjtype == "int") || ($cjtype == "long") || ($cjtype == "boolean") 
      || ($cjtype == "short") || ($cjtype == "float") || ($cjtype == "double")
      || ($cjtype == "char") || ($cjtype == "byte") )
          if (this.$clo != v)
          {
   #else
          if ( !ObjectUtils.equals(this.$clo, v) )
          {
   #end
            #if ( ($cjtype == "NumberKey") 
                 || ($cjtype == "StringKey")
                 || ($cjtype == "DateKey") )
              if (this.$clo == null)
              {
                  this.$clo = new $cjtype(v);
              }
              else
              {
                  this.${clo}.setValue(v);
              }
            #else  
              this.$clo = v;
            #end
              setModified(true);
          }
  #else
            this.$clo = v;
  #end
       }
  
  ##if ($complexObjectModel)
    #if ($col.isPrimaryKey() || $col.isForeignKey())
     /**
      * Set the value of $cfc as a string.
      */
      public void set${cfc}(String v ) $throwsClause
      {
           set${cfc}(new ${cjtype}(v));
      }
    #end
  ##end
  
  #end
  #end
  
   ##association code
  
  #if ($complexObjectModel)
   #foreach ($fk in $table.ForeignKeys)
  
     #set ( $tmp = $fk.ForeignTableName )
     #set ( $tblFK = $table.Database.getTable($tmp) )
     #set ( $className = $tblFK.JavaName )
  
     #set ( $relCol = "" )
     #foreach ($columnName in $fk.LocalColumns)
      #set ( $column = $table.getColumn($columnName) )
      #if ($column.isMultipleFK())
          #set ( $relCol = $strings.concat([$relCol, $column.JavaName]) )
      #elseif ($tmp.equals($table.Name))
          #set ( $relCol = $strings.concat([$relCol, $column.JavaName]) )
      #end
     #end
  
     #if ($relCol != "")
         #set ( $relCol = $strings.concat(["RelatedBy", $relCol]) )
     #end
  
     #set ( $pVarName = $strings.concat([$className, $relCol]) )
     #set ( $varName = $strings.concat(["a", $pVarName]) )
  
      private $className $varName;
  
      /**
       * Declares an association between this object and a $className object
       *
       * @param $className v
       */
      public void set${pVarName}($className v) throws Exception
      {
     #foreach ($columnName in $fk.LocalColumns)
      #set ( $column = $table.getColumn($columnName) )
      #set ( $colFKName = $fk.LocalForeignMapping.get($columnName) )
      #set ( $colFK = $tblFK.getColumn($colFKName) )
          set${column.JavaName}(v.get${colFK.JavaName}());
     #end
          $varName = v;
      }
  
     #set ( $and = "" )
     #set ( $comma = "" )
     #set ( $conditional = "" )
     #set ( $arglist = "" )
     #foreach ($columnName in $fk.LocalColumns)
      #set ( $column = $table.getColumn($columnName) )
      #set ( $cjtype = $column.JavaNative )
      #set ( $clo=$column.Name.toLowerCase() )
      #if ($cjtype == "int")
          #set ( $conditional = $strings.concat([$conditional, $and, "this.", $clo, ">0"]) )
      #elseif ($cjtype == "long")
          #set ( $conditional = $strings.concat([$conditional, $and, "this.", $clo, ">0"]) )
      #elseif ($cjtype == "short")
          #set ( $conditional = $strings.concat([$conditional, $and, "this.", $clo, ">0"]) )
      #else
          #set ( $conditional = $strings.concat([$conditional, $and, "!ObjectUtils.equals(this.", $clo, ", null)"]) )
      #end
      #set ( $arglist = $strings.concat([$arglist, $comma, "this.", $clo]) )
      #set ( $and = " && " )
      #set ( $comma = ", " )
     #end
     #set ( $pCollName = $strings.concat([$table.JavaName, "s", $relCol]) )
      
      public $className get${pVarName}() throws Exception
      {
          if ( $varName==null && ($conditional) )
          {
              $varName = ${className}Peer.retrieveByPK($arglist);
              // The following can be used instead of the line above to
              // guarantee the related object contains a reference
              // to this object, but this level of coupling 
              // may be undesirable in many circumstances.
              // As it can lead to a db query with many results that may
              // never be used.  
              // $className obj = ${className}Peer.retrieveByPK($arglist);
              // obj.add${pCollName}(this);
          }
          return $varName;
      }
  
  
      /**
       * Provides convenient way to set a relationship based on a 
       * ObjectKey.  e.g. 
       * <code>bar.setFooKey(foo.getPrimaryKey())</code>
       *
  #if ($fk.LocalColumns.size() > 1)
       * Note: It is important that the xml schema used to create this class
       * maintains consistency in the order of related columns between
       * $table.Name and ${tblFK.Name}.  
       * If for some reason this is impossible, this method should be 
       * overridden in <code>$table.JavaName</code>.
  #end
       */
      public void set${pVarName}Key(ObjectKey key) throws Exception
      {
      #if ($fk.LocalColumns.size() > 1)
          SimpleKey[] keys = (SimpleKey[])key.getValue();
          #set ($i = 0)
          #foreach ($colName in $fk.LocalColumns)
              #set ($col = $table.getColumn($colName) )
              set${col.JavaName}(($col.JavaNative)keys[$i]);
              #set ( $i = $i + 1 )
          #end
      #else
          #set ($colName = $fk.LocalColumns.get(0))
          #set ($col = $table.getColumn($colName) )
          set${col.JavaName}(($col.JavaNative)key);        
      #end
      }
  
   #end   ## end of foreach loop over foreign keys
  
   ## 
   ## setup foreign key associations
   ## 
   #foreach ($fk in $table.Referrers)
    #set ( $tblFK = $fk.Table )
    #if ( !($tblFK.Name.equals($table.Name)) )
     #set ( $className = $tblFK.JavaName )
     #set ( $relatedByCol = "" )
     #foreach ($columnName in $fk.LocalColumns)
      #set ( $column = $tblFK.getColumn($columnName) )
      #if ($column.isMultipleFK())
          #set ($relatedByCol=$strings.concat([$relatedByCol,$column.JavaName]))
      #end
     #end
  
     #if ($relatedByCol == "")
      #set ( $suffix = "" )
      #set ( $relCol = $strings.concat([$className, "s"]) )
      #set ( $relColMs = $className )
     #else
      #set ( $suffix = $strings.concat(["RelatedBy", $relatedByCol]) )
      #set ( $relCol=$strings.concat([$className,"sRelatedBy",$relatedByCol]))
      #set ( $relColMs=$strings.concat([$className,"RelatedBy",$relatedByCol]))
     #end
     #set ( $collName = $strings.concat(["coll", $relCol]) )
  
      /**
       * Collection to store aggregation of $collName
       */
      protected Vector $collName;
      /**
       * Temporary storage of $collName to save a possible db hit in
       * the event objects are add to the collection, but the
       * complete collection is never requested.
       */
  //    private Vector temp$collName;
  
      protected void init${relCol}()
      {
          if ($collName == null)
              $collName = new Vector();
      }
  
      /**
       * Method called to associate a $tblFK.JavaName object to this object
       * through the $className foreign key attribute
       *
       * @param $className l
       */
      public void add${relColMs}($className l) throws Exception
      {
          /*
          if ($collName == null)
          {
              if (temp$collName == null)
              {
                  temp$collName = new Vector();
              }
              temp${collName}.add(l);
          }
          else
          {
              ${collName}.add(l);
          }
          */
          get${relCol}().add(l);
          l.set${table.JavaName}${suffix}(($table.JavaName)this);
      }
  
      /**
       * The criteria used to select the current contents of $collName
       */
      private Criteria last${relCol}Criteria = null;
  
      /**
       * If this collection has already been initialized, returns
       * the collection. Otherwise returns the results of 
       * get${relCol}(new Criteria())
       */
      public Vector get${relCol}() throws Exception
      {
          if ($collName == null)
          {
              $collName = get${relCol}(new Criteria(10));
          }
          return $collName;
      }
  
      /**
       * If this collection has already been initialized with
       * an identical criteria, it returns the collection. 
       * Otherwise if this $table.JavaName has previously
       * been saved, it will retrieve related ${relCol} from storage.
       * If this $table.JavaName is new, it will return
       * an empty collection or the current collection, the criteria
       * is ignored on a new object. 
       */
      public Vector get${relCol}(Criteria criteria) throws Exception
      {
          if ($collName == null)
          {
              if ( isNew() ) 
              {
                 $collName = new Vector();       
              } 
              else
              {
     #foreach ($columnName in $fk.ForeignColumns)
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
                  criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}() );               
     #end
                  $collName = ${className}Peer.doSelect(criteria);
              }
  /*
              if (temp$collName != null)
              {
                  for (int i=0; i<temp${collName}.size(); i++)
                  {
                      ${collName}.add(temp${collName}.get(i));
                  }
                  temp$collName = null;
              }
  */
          }
          else
          {
             // criteria has no effect for a new object
              if ( !isNew() ) 
              {
                  // the following code is to determine if a new query is
                  // called for.  If the criteria is the same as the last
                  // one, just return the collection.
     #foreach ($columnName in $fk.ForeignColumns)
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
                  criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}() );               
     #end
                  if ( !last${relCol}Criteria.equals(criteria)  )
                  {
                      $collName = ${className}Peer.doSelect(criteria);  
                  }
              }
          }
          last${relCol}Criteria = criteria; 
  
          return $collName;
      }
   #set ( $countFK = 0 )
   #foreach ($dummyFK in $tblFK.ForeignKeys)
      #set ( $countFK = $countFK + 1 )
   #end
  
  ## ------------------------------------------------------------
  ## 
  
    #if ($countFK >= 1)
     #set ( $lastTable = "" ) 
     #foreach ($fk2 in $tblFK.ForeignKeys)
     
     ## Add join methods if the fk2 table is not this table or
     ## the fk2 table references this table multiple times.
  
     #set ( $doJoinGet = true )
     #if ( $fk2.ForeignTableName.equals($table.Name) )
          #set ( $doJoinGet = false )
     #end
  
     #foreach ($columnName in $fk2.LocalColumns)
      #set ( $column = $tblFK.getColumn($columnName) )
      #if ($column.isMultipleFK())
          #set ( $doJoinGet = true )
      #end
     #end
  
      #set ( $tblFK2 = $table.Database.getTable($fk2.ForeignTableName) )
      #set ( $relatedByCol2 = "" )
      #foreach ($columnName in $fk2.LocalColumns)
          #set ( $column = $tblFK.getColumn($columnName) )
          #if ($column.isMultipleFK())
              #set($relatedByCol2=$strings.concat([$relatedByCol2,$column.JavaName]))
          #end
      #end 
  
      #set ( $fkClassName = $tblFK2.JavaName )
      ## do not generate code for self-referencing fk's, it would be
      ## good to do, but it is just not implemented yet.
      #if ($className == $fkClassName)
          #set ( $doJoinGet = false )
      #end        
  
      #if ($relatedByCol2 == "")
          #set ( $relCol2 = $fkClassName )
      #else
          #set ($relCol2=$strings.concat([$fkClassName,"RelatedBy",$relatedByCol2]))
      #end
  
      #if ( $relatedByCol == "") 
      #else   
          #if ( $relatedByCol.equals($relatedByCol2) ) 
             #set ( $doJoinGet = false )
          #end
      #end
  
     #if ($doJoinGet)
  
      /**
       * If this collection has already been initialized with
       * an identical criteria, it returns the collection. 
       * Otherwise if this $table.JavaName is new, it will return
       * an empty collection; or if this $table.JavaName has previously
       * been saved, it will retrieve related ${relCol} from storage.
       */
      protected Vector get${relCol}Join${relCol2}(Criteria criteria) 
          throws Exception
      {
          if ($collName == null)
          {
              if ( isNew() ) 
              {
                 $collName = new Vector();       
              } 
              else
              {
     #foreach ($columnName in $fk.ForeignColumns)
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
                  criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}() );               
     #end
                  $collName = ${className}Peer.doSelectJoin${relCol2}(criteria);
              }
              
              #* /*
              if (temp$collName != null)
              {
                  for (int i=0; i<temp${collName}.size(); i++)
                  {
                      ${collName}.add(temp${collName}.get(i));
                  }
                  temp$collName = null;
              } 
                 */ *#
          }
          else
          {
              // the following code is to determine if a new query is
              // called for.  If the criteria is the same as the last
              // one, just return the collection.
              boolean newCriteria = true;
     #foreach ($columnName in $fk.ForeignColumns)
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
                  criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}() );               
     #end
              if ( !last${relCol}Criteria.equals(criteria)  )
              {
                  $collName = ${className}Peer.doSelectJoin${relCol2}(criteria);
              }
          }
          last${relCol}Criteria = criteria; 
  
          return $collName;
      }
    #end #end #end #end
  
  ## ===========================================================
  #*
    #if ($countFK > 2)
  
      /**
       * If this collection has already been initialized with
       * an identical criteria, it returns the collection. 
       * Otherwise if this $table.JavaName is new, it will return
       * an empty collection; or if this $table.JavaName has previously
       * been saved, it will retrieve related ${relCol} from storage.
       */
      protected Vector get${relCol}JoinAllExcept${table.JavaName}(Criteria criteria) 
          throws Exception
      {
          if ($collName == null)
          {
              if ( isNew() ) 
              {
                 $collName = new Vector();       
              } 
              else
              {
     #foreach ($columnName in $fk.ForeignColumns)
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
                  criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}() );               
     #end
                  $collName = ${className}Peer.doSelectJoinAllExcept${table.JavaName}${suffix}(criteria);
              }
  /*
              if (temp$collName != null)
              {
                  for (int i=0; i<temp${collName}.size(); i++)
                  {
                      ${collName}.add(temp${collName}.get(i));
                  }
                  temp$collName = null;
              }
  */
          }
          else
          {
              // the following code is to determine if a new query is
              // called for.  If the criteria is the same as the last
              // one, just return the collection.
              boolean newCriteria = true;
     #foreach ($columnName in $fk.ForeignColumns)
         #set ( $column = $table.getColumn($columnName) )
         #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
         #set ( $colFK = $tblFK.getColumn($colFKName) )
                  criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}() );               
     #end
              if ( !last${relCol}Criteria.equals(criteria)  )
              {
                  $collName = ${className}Peer.doSelectJoinAllExcept${table.JavaName}${suffix}(criteria);
              }
          }
          last${relCol}Criteria = criteria; 
  
          return $collName;
      }
  
    #end
    
  *#
  ## ------------------------------------------------------------
  
  
   #end    ## ends foreach over table.Referrers
  
  #end    ##ends the if(complexObjectModel)
  
  ##
  ## getByName code
  ##
  #if (!$table.isAlias() && $addGetByNameMethod)
      private static Vector fieldNames_ = null;
  
      /**
       * Generate a list of field names.
       */
      public static synchronized List getFieldNames()
      {
        if (fieldNames_ == null)
        {
          fieldNames_ = new Vector();
      #foreach ($col in $table.Columns)
          fieldNames_.add("${col.JavaName}");
      #end
        }
        return fieldNames_;
      }
  
      /**
       * Retrieves a field from the object by name passed in
       * as a String.
       */
      public Object getByName(String name)
      {
      #foreach ($col in $table.Columns)
        #set ( $cfc = $col.JavaName )
        #set ( $cjtype = $col.JavaNative )
          if (name.equals("${col.JavaName}"))
  	{
  	  #if ($cjtype == "int")
  	    return new Integer(get${cfc}());
  	  #elseif ($cjtype == "long")
  	    return new Long(get${cfc}());
  	  #elseif ($cjtype == "float")
  	    return new Float(get${cfc}());
  	  #elseif ($cjtype == "double")
  	    return new Double(get${cfc}());
  	  #elseif ($cjtype == "boolean")
  	    return new Boolean(get${cfc}());
  	  #elseif ($cjtype == "short")
  	    return new Short(get${cfc}());
  	  #elseif ($cjtype == "byte")
  	    return new Byte(get${cfc}());
  	  #elseif ($cjtype == "char")
  	    return new Character(get${cfc}());
  	  #else
  	    return get${cfc}();
  	  #end
  	}
      #end
          return null; 
      }
      /**
       * Retrieves a field from the object by name passed in
       * as a String.  The String must be one of the static
       * Strings defined in this Class' Peer.
       */
      public Object getByPeerName(String name)
      {
      #foreach ($col in $table.Columns)
        #set ( $cfc = $col.JavaName )
        #set ( $cup=$col.Name.toUpperCase() )
        #set ( $cjtype = $col.JavaNative )
          if (name.equals(${table.JavaName}Peer.$cup ))
  	    {
  	  #if ($cjtype == "int")
  	    return new Integer(get${cfc}());
  	  #elseif ($cjtype == "long")
  	    return new Long(get${cfc}());
  	  #elseif ($cjtype == "float")
  	    return new Float(get${cfc}());
  	  #elseif ($cjtype == "double")
  	    return new Double(get${cfc}());
  	  #elseif ($cjtype == "boolean")
  	    return new Boolean(get${cfc}());
  	  #elseif ($cjtype == "short")
  	    return new Short(get${cfc}());
  	  #elseif ($cjtype == "byte")
  	    return new Byte(get${cfc}());
  	  #elseif ($cjtype == "char")
  	    return new Character(get${cfc}());
  	  #else
  	    return get${cfc}();
  	  #end
  	}
      #end
          return null; 
      }
  
      /**
       * Retrieves a field from the object by Position as specified
       * in the xml schema.  Zero-based.
       */
      public Object getByPosition(int pos)
      {
      #set ($i = 0)
      #foreach ($col in $table.Columns)
        #set ( $cfc = $col.JavaName )
        #set ( $cjtype = $col.JavaNative )
      if ( pos == $i )
  	{
  	  #if ($cjtype == "int")
  	    return new Integer(get${cfc}());
  	  #elseif ($cjtype == "long")
  	    return new Long(get${cfc}());
  	  #elseif ($cjtype == "float")
  	    return new Float(get${cfc}());
  	  #elseif ($cjtype == "double")
  	    return new Double(get${cfc}());
  	  #elseif ($cjtype == "boolean")
  	    return new Boolean(get${cfc}());
  	  #elseif ($cjtype == "short")
  	    return new Short(get${cfc}());
  	  #elseif ($cjtype == "byte")
  	    return new Byte(get${cfc}());
  	  #elseif ($cjtype == "char")
  	    return new Character(get${cfc}());
  	  #else
  	    return get${cfc}();
  	  #end
  	}
      #set ($i = $i + 1)
      #end
          return null; 
      }
  
  #end     ## ends the if(addGetByNameMethod)
  	
  
  #if (!$table.isAlias() && $addSaveMethod)
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save() throws Exception
      {
   #if ($complexObjectModel)
              save(${table.JavaName}Peer.getMapBuilder()
                  .getDatabaseMap().getName());
   #else
          if (isModified())
          {
              if (isNew())
              {
                  ${table.JavaName}Peer.doInsert(($table.JavaName)this);
                  setNew(false);
              }
              else
              {
                  ${table.JavaName}Peer.doUpdate(($table.JavaName)this);
              }
          }
   #end
      }
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save(String dbName) throws Exception
      {
          DBConnection dbCon = null;
   #if ($complexObjectModel)
          try
          {
              dbCon = BasePeer.beginTransaction(dbName);
              save(dbCon);
          }
          catch(Exception e)
          {
              BasePeer.rollBackTransaction(dbCon);
              throw e;
          }
          BasePeer.commitTransaction(dbCon);
  
   #else
  
          if (isModified())
          {
              try
              {
                  dbCon = TurbineDB.getConnection( dbName );
                  if (isNew())
                  {
                      ${table.JavaName}Peer
                          .doInsert(($table.JavaName)this, dbCon);
                      setNew(false);
                  }
                  else
                  {
                      ${table.JavaName}Peer
                          .doUpdate(($table.JavaName)this, dbCon);
                  }
              }
              finally
              {
                  TurbineDB.releaseConnection(dbCon);
              }
          }
        
   #end
      }
  
    #if ($complexObjectModel)
      // flag to prevent endless save loop, if this object is referenced
      // by another object which falls in this transaction.
      private boolean alreadyInSave = false;
    #end
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.  This method
       * is meant to be used as part of a transaction, otherwise use
       * the save() method and the connection details will be handled
       * internally
       */
      public void save(DBConnection dbCon) throws Exception
      {
    #if ($complexObjectModel)
        if (!alreadyInSave)
        {
          alreadyInSave = true;
    #end      
          if (isModified())
          {
              if (isNew())
              {
                  ${table.JavaName}Peer.doInsert(($table.JavaName)this, dbCon);
                  setNew(false);
              }
              else
              {
                  ${table.JavaName}Peer.doUpdate(($table.JavaName)this, dbCon);
              }
          }
  
   #if ($complexObjectModel)
    #foreach ($fk in $table.Referrers)
       #set ( $tblFK = $fk.Table )
       #if ( !($tblFK.Name.equals($table.Name)) )
          #set ( $className = $tblFK.JavaName )
          #set ( $relCol = "" )
          #foreach ($columnName in $fk.LocalColumns)
              #set ( $column = $tblFK.getColumn($columnName) )
              #if ($column.isMultipleFK())
                  #set ( $relCol = $strings.concat([$relCol, $column.JavaName]) )
              #end
          #end
  
          #if ($relCol == "")
              #set ( $relCol = $strings.concat([$className, "s"]) )
          #else
              #set ( $relCol = $strings.concat([$className, "sRelatedBy", $relCol]) )
          #end
          #set ( $collName = $strings.concat(["coll", $relCol]) )
  
            if ($collName != null )
            {
                for (int i=0; i<${collName}.size(); i++)
                {
                    ((${className})${collName}.get(i)).save(dbCon);
                }
            }
       #end
    #end      
   #end
    #if ($complexObjectModel)
          alreadyInSave = false;
        }
    #end      
      }
  #end
  
  ## PrimaryKey methods
  #if (!$table.isAlias())
  
  #set ( $throwsClause = "" )
  #set ( $argList = "" )
  #set ( $argList2 = "" )
  #set ( $comma = "" )
  #foreach ($col in $table.PrimaryKeys)
      #if ($complexObjectModel)
          #if ( $col.isForeignKey() || ($col.Referrers.size() > 0) )
              #set ( $throwsClause = "throws Exception" )
          #end
      #end
  
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype = $col.JavaNative )
      #set ($argList = "${argList}$comma $cjtype $clo")
      #set ($argList2 = "${argList2}$comma String $clo")
  
      #set ( $comma = "," )            
  #end    
  
  #if ($table.PrimaryKeys.size() == 1)
  
      #set ($col = $table.PrimaryKeys.get(0) )
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype= $col.JavaNative )
      /** 
       * Set the PrimaryKey using ObjectKey.
       *
       * @param ObjectKey $clo
       */
      public void setPrimaryKey(ObjectKey $clo) 
          $throwsClause {
           set${col.JavaName}(($cjtype)$clo);
      }
  
      /** 
       * Set the PrimaryKey using a String.
       */
      public void setPrimaryKey(String key) $throwsClause
      {
          set${col.JavaName}(new ${cjtype}(key) );
      }
  
  #elseif ($table.PrimaryKeys.size() > 1)
  
      private final SimpleKey[] pks = new SimpleKey[$table.PrimaryKeys.size()];
      private final ComboKey comboPK = new ComboKey(pks);
      /** 
       * Set the PrimaryKey with an ObjectKey
       */
      public void setPrimaryKey(ObjectKey key) throws Exception
      {
          SimpleKey[] keys = (SimpleKey[])key.getValue();
      #set ($i = 0)
      #foreach ($pk in $table.PrimaryKeys)
              set${pk.JavaName}(($pk.JavaNative)keys[$i]);
          #set ( $i = $i + 1 )
      #end
      }
  
      /** 
       * Set the PrimaryKey using SimpleKeys.
       *
  #foreach ($col in $table.PrimaryKeys)
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype= $col.JavaNative )
       * @param $cjtype $clo
  #end
       */
      public void setPrimaryKey($argList) 
          $throwsClause {
  #foreach ($col in $table.PrimaryKeys)
           set${col.JavaName}($col.Name.toLowerCase());
  #end
      }
  
      /** 
       * Set the PrimaryKey with Strings.
       *
  #foreach ($col in $table.PrimaryKeys)
      #set ( $clo=$col.Name.toLowerCase() )
       * @param String $clo
  #end
       */
      public void setPrimaryKey($argList2) 
          $throwsClause {
  #foreach ($col in $table.PrimaryKeys)
           set${col.JavaName}(new ${col.JavaNative}($col.Name.toLowerCase()));
  #end
      }
  
      /** 
       * Set the PrimaryKey using a String.
       */
      public void setPrimaryKey(String key) throws Exception
      {
          int prevPos = 0;
  
       #set ($int = "int ")
       #foreach ($col in $table.PrimaryKeys)
          ${int}colonPos = key.indexOf(':', prevPos);
          set${col.JavaName}( new ${col.JavaNative}(key.substring(prevPos, colonPos)) );
          prevPos = colonPos + 1;
          #set ($int = "")
       #end
      }
  
  #end
  
  
      /** 
       * returns an id that differentiates this object from others
       * of its class.
       */
      public ObjectKey getPrimaryKey() 
      {
  #if ($table.PrimaryKeys.size() == 1)
          return get${table.PrimaryKeys.get(0).JavaName}();
  #elseif ($table.PrimaryKeys.size() > 1)
      #set ($i = 0)
      #foreach ($pk in $table.PrimaryKeys)
          pks[$i] = get${pk.JavaName}();
          #set ($i = $i +1)
      #end
          return comboPK;
  #else
  		return getPrimaryKey();
  #end
      }
  
  #end ##ends if(!$table.isAlias())
  
      /** 
       * get an id that differentiates this object from others
       * of its class.
       */
      public String getQueryKey() 
      {
          if (getPrimaryKey() == null)
          {
              return "";
          }
          else
          {
              return getPrimaryKey().toString();
          }
      }
  
      /** 
       * set an id that differentiates this object from others
       * of its class.
       */
      public void setQueryKey(String key) 
          throws Exception
      {
          setPrimaryKey(key);
      }
  
  #if (!$table.isAlias())
      /**
       * Makes a copy of this object.  
       * It creates a new object filling in the simple attributes.
  #if ($complexObjectModel)
       * It then fills all the association collections and sets the
       * related objects to isNew=true.
  #end
       */
  #if ($table.ChildrenColumn || $table.isAbstract()) 
      public $table.JavaName copyInto($table.JavaName copyObj) throws Exception
      {
  #else
      public $table.JavaName copy() throws Exception
      {
          $table.JavaName copyObj = new ${table.JavaName}();
  #end
  #foreach ($col in $table.Columns)
          copyObj.set${col.JavaName}($col.Name.toLowerCase());
  #end 
  
  #if ($complexObjectModel)
  
    #set ( $list = "List " )
    #foreach ($fk in $table.Referrers)
      #set ( $tblFK = $fk.Table )
      #if ( !($tblFK.Name.equals($table.Name)) )
          #set ( $className = $tblFK.JavaName )
          #set ( $relCol = "" )
          #foreach ($columnName in $fk.LocalColumns)
              #set ( $column = $tblFK.getColumn($columnName) )
              #if ($column.isMultipleFK())
                  #set ( $relCol = $strings.concat([$relCol, $column.JavaName]) )
              #end
          #end
  
          #if ($relCol == "")
              #set ( $pCollName = $strings.concat([$className, "s"]) )
          #else
              #set ( $pCollName = $strings.concat([$className, "sRelatedBy", $relCol]) )
          #end
  
           ${list}v = copyObj.get${pCollName}();
           for (int i=0; i<v.size(); i++)
           {
               ((Persistent)v.get(i)).setNew(true);
           }
          #set ( $list = "" )
      #end
    #end 
  #end
  
  #foreach ($col in $table.Columns)
      #if ($col.isPrimaryKey())
          #set ( $pkid = "null" )
          #set ( $cjtype = $col.JavaNative )
          copyObj.set${col.JavaName}((${cjtype})${pkid});
      #end
  #end 
          return copyObj;
      }
  #end
  }
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/om/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  #set ($db = $table.Database)
  #if ($db.Package)
      #set ($package = $db.Package)
  #else
      #set ($package = $targetPackage)
  #end
  package ${package};
  
  import java.util.*;
  import java.math.*;
  import java.sql.*;
  import com.workingdogs.village.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.TurbineException;
  
  // Local classes
  import ${package}.map.*;
  
  /**
  #if ($addTimeStamp)
   * This class was autogenerated by Torque on:
   *
   * [$now]
   *
  #end
   */
  public abstract class $basePrefix${table.JavaName}Peer 
      extends $table.BasePeer
  {
  #if (!$table.isAlias())
  
      /** the mapbuilder for this class */
      private static final ${table.JavaName}MapBuilder mapBuilder = 
          (${table.JavaName}MapBuilder)getMapBuilder(${table.JavaName}MapBuilder.CLASS_NAME);
  
      /** the table name for this class */
      public static final String TABLE_NAME = mapBuilder.getTable();
  
      /** 
       * @return the map builder for this peer
       */
      public static MapBuilder getMapBuilder()
      {
         return(mapBuilder);
      }
  
  #foreach ($col in $table.Columns)
      #set ( $tfc=$table.JavaName )
      #set ( $cfc=$col.JavaName )
      #set ( $cup=$col.Name.toUpperCase() )
      /** the column name for the $cup field */
      public static final String $cup = mapBuilder.get${tfc}_${cfc}();
  #end
  
  #end ## ends if (!$table.isAlias())
  
      /** number of columns for this peer */
      public static final int numColumns =  $table.NumColumns;
  
      /** A class that can be returned by this peer. */
      protected static final String CLASSNAME_DEFAULT = 
          "${package}.$table.JavaName";
  
      /** A class that can be returned by this peer. */
      protected static final Class CLASS_DEFAULT = initClass();
  
      /** Initialization method for static CLASS_DEFAULT attribute */
      private static Class initClass()
      {
          Class c = null;
          try
          { 
              c = Class.forName(CLASSNAME_DEFAULT);
          }
          catch (Exception e)
          {
              Log.error("A FATAL ERROR has occurred which should not" +
                  "have happened under any circumstance.  Please notify" +
                  "Turbine and give as many details as possible including the " +
                  "error stacktrace.", e);
          }
          return c;
      }
  
  #if (!$table.isAlias())
  
      /**
       * Get the list of objects for a ResultSet.  Please not that your
       * resultset MUST return columns in the right order.  You can use
       * getFieldNames() in BaseObject to get the correct sequence.
       */
      public static Vector resultSet2Objects (java.sql.ResultSet results) throws Exception
      {
          QueryDataSet qds = null;
          Vector rows = null;
          try
          {
              qds = new QueryDataSet( results );
              rows = getSelectResults( qds );
          }
          finally
          {
              if (qds != null) qds.close();
          }
  
          return populateObjects (rows);
  
      }
  
  
  #if ($table.ChildrenColumn)
  
      #set ($col = $table.ChildrenColumn)
      #set ( $tfc=$table.JavaName )
      #set ( $cfc=$col.JavaName )
      #set ( $cup=$col.Name.toUpperCase() )
  
      #if ($col.isEnumeratedClasses())
          ## NOTE: this hack requires a class type definition column to
          ## be a primitive type or a String. Should not be a bad assumption
          #if ($col.isPrimitive())
              #set ($quote = "")
          #else
              #set ($quote = '"')
          #end
  
          #foreach ($child in $col.Children)
      /** A key representing a particular subclass */
      public static final $col.JavaNative CLASSKEY_$child.Key.toUpperCase() = 
          $quote$child.Key$quote;
  
      /** A class that can be returned by this peer. */
      public static final String CLASSNAME_$child.Key.toUpperCase() = 
          "${package}.$child.ClassName";
  
      /** A class that can be returned by this peer. */
      public static final Class CLASS_$child.Key.toUpperCase() = 
          init${child.Key.toUpperCase()}Class();
  
      /** Initialization method for static CLASS_$child.Key.toUpperCase() attribute */
      private static Class init${child.Key.toUpperCase()}Class()
      {
          Class c = null;
          try
          { 
              c = Class.forName(CLASSNAME_$child.Key.toUpperCase());
          }
          catch (Exception e)
          {
              Log.error("A FATAL ERROR has occurred which should not" +
                  "have happened under any circumstance.  Please notify " +
                  "Turbine and give as many details as possible including the " +
                  "error stacktrace.", e);
          }
          return c;
      }
          #end
      #end
  #end
  
      /** Method to do inserts */
      public static ObjectKey doInsert( Criteria criteria ) throws Exception
      {
      #if ($table.Database.Name != "default")
          criteria.setDbName(mapBuilder.getDatabaseMap().getName());
      #end
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
          return BasePeer.doInsert( criteria );
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(Criteria) method.  It will take care of 
       * the connection details internally. 
       */
      public static ObjectKey doInsert( Criteria criteria, DBConnection dbCon ) 
          throws Exception
      {
      #if ($table.Database.Name != "default")
          criteria.setDbName(mapBuilder.getDatabaseMap().getName());
      #end
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
          return BasePeer.doInsert( criteria, dbCon );
      }
  
      /** Add all the columns needed to create a new object */
      public static void addSelectColumns (Criteria criteria) throws Exception
      {
      #foreach ($col in $table.Columns)
          #set ( $cup=$col.Name.toUpperCase() )
          criteria.addSelectColumn( $cup );
      #end
      }
  
  
      /** 
       * Create a new object of type cls from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static $table.JavaName row2Object (Record row, 
                                                int offset, 
                                                Class cls ) 
          throws Exception
      {
          $table.JavaName obj = ($table.JavaName)cls.newInstance();
          populateObject(row, offset, obj);
          #if ($addSaveMethod)
              obj.setModified(false);
          #end
          obj.setNew(false);
  
          return obj;
      }
  
      /** 
       * Populates an object from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static void populateObject (Record row, 
                                         int offset, 
                                         $table.JavaName obj ) 
          throws Exception
      {
          #set ( $n=0 )
          #foreach ($col in $table.Columns)
              #if ($col.isBooleanChar())
              obj.set${col.JavaName}
                  ("Y".equals(row.getValue(offset+$n).$col.VillageMethod));
              #elseif ($col.isBooleanInt())
              obj.set${col.JavaName}
                  (1 == row.getValue(offset+$n).$col.VillageMethod);
              #else
                  #if ($col.isPrimaryKey() || $col.isForeignKey() )
              obj.set${col.JavaName}(
                  new ${col.JavaNative}(row.getValue(offset+$n).$col.VillageMethod));
                  #else
              obj.set${col.JavaName}(row.getValue(offset+$n).$col.VillageMethod);
                  #end
              #end
                  #set ( $n = $n + 1 )
          #end
      }
  
      /** Method to do selects */
      public static Vector doSelect( Criteria criteria ) throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria) ); 
      }
  
  
      /** Method to do selects within a transaction */
      public static Vector doSelect( Criteria criteria, 
                                     DBConnection dbCon ) 
          throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria, dbCon) ); 
      }
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method handles connections internally.  The Record objects
       * returned by this method should be considered readonly.  Do not
       * alter the data and call save(), your results may vary, but are
       * certainly likely to result in hard to track MT bugs.
       */
      public static Vector doSelectVillageRecords( Criteria criteria ) 
          throws Exception
      {
      #if ($table.Database.Name != "default")
          criteria.setDbName(mapBuilder.getDatabaseMap().getName());
      #end
          if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
  
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria);
      }
  
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method should be used for transactions 
       */
      public static Vector doSelectVillageRecords( Criteria criteria, 
                                                   DBConnection dbCon ) 
          throws Exception
      {
          if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
  
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria, dbCon);
      }
  
      /** 
       * The returned vector will contain objects of the default type or
       * objects that inherit from the default.
       */
      public static Vector populateObjects(Vector records) 
          throws Exception
      {
          Vector results = new Vector(records.size());
  
          // populate the object(s)
          for ( int i=0; i<records.size(); i++ )
          {
              Record row = (Record)records.elementAt(i);
  #if ($table.ChildrenColumn)
              results.add(${table.JavaName}Peer.row2Object(row, 1,
                  ${table.JavaName}Peer.getOMClass(row, 1)));
  #else
              results.add(${table.JavaName}Peer.row2Object(row, 1,
                  ${table.JavaName}Peer.getOMClass()));
  #end
          }
          return results;
      }
  #end ## ends if(!$table.isAlias())
  
  #if ($table.ChildrenColumn)
  
      #set ($col = $table.ChildrenColumn)
      /** 
       * The returned Class will contain objects of the default type or
       * objects that inherit from the default.
       */
      public static Class getOMClass(Record record, int offset) 
          throws Exception
      {
      #if ($col.isEnumeratedClasses())
              Class omClass = null;
              $col.JavaNative classKey = 
                  record.getValue(offset-1 + $col.Position)
                  .$col.VillageMethod;
          #set ($if = "if")
          #foreach ($child in $col.Children)
              #if ($col.isPrimitive())
              $if (classKey == CLASSKEY_$child.Key.toUpperCase())
              #else
              $if (CLASSKEY_${child.Key.toUpperCase()}.equals(classKey))
              #end
              {
                  omClass = CLASS_$child.Key.toUpperCase();
              }
              #set ($if = "else if")
          #end
              else
              {
                  omClass = getOMClass();
              }
              return omClass;
      #else
              return Class.forName( 
                  record.getValue(offset-1 + $col.Position).asString());
      #end
      }
      
  #end
  
      /** 
       * The class that the Peer will make instances of. 
       * If the BO is abstract then you must implement this method
       * in the BO.
       */
      public static Class getOMClass() 
          throws Exception
      {
      #if ($table.isAbstract())
          String error = "You must implement the getOMClass method in your";
                 error += " Peer object in order for things to work properly.";
                 error += " This method should return the proper Class that";
                 error += " represents the Peer's Business Object.";
          throw new TurbineException (error);
      #else
          return CLASS_DEFAULT;
      #end
      }
  
  #if (!$table.isAlias())
  
      /**
       * Method to do updates. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria) throws Exception
      {
      #if ($table.Database.Name != "default")
          criteria.setDbName(mapBuilder.getDatabaseMap().getName());
      #end
          Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) ) 
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
          }
           #end
           #if($col.isPrimaryKey())
           selectCriteria.put( $cup, criteria.remove($cup) );
           #end
       #end
           BasePeer.doUpdate( selectCriteria, criteria );
      }
  
      /** 
       * Method to do updates.  This method is to be used during a transaction,
       * otherwise use the doUpdate(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria, DBConnection dbCon) throws Exception
      {
      #if ($table.Database.Name != "default")
          criteria.setDbName(mapBuilder.getDatabaseMap().getName());
      #end
          Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
           }
           #end
           #if($col.isPrimaryKey())
           selectCriteria.put( $cup, criteria.remove($cup) );
           #end
       #end
           BasePeer.doUpdate( selectCriteria, criteria, dbCon );
       }
  
      /** 
       * Method to do deletes.
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria) throws Exception
       {
      #if ($table.Database.Name != "default")
          criteria.setDbName(mapBuilder.getDatabaseMap().getName());
      #end
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
           BasePeer.doDelete ( criteria );
       }
  
      /** 
       * Method to do deletes.  This method is to be used during a transaction,
       * otherwise use the doDelete(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria, DBConnection dbCon) throws Exception
       {
      #if ($table.Database.Name != "default")
          criteria.setDbName(mapBuilder.getDatabaseMap().getName());
      #end
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, 1);
                  }
                  else
                  {   
                      criteria.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( criteria.containsKey($cup) )
          {
              Object possibleBoolean = criteria.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      criteria.add($cup, "Y");
                  }
                  else
                  {   
                      criteria.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
           BasePeer.doDelete ( criteria, dbCon );
       }
  
      /** Method to do inserts */
      public static void doInsert( $table.JavaName obj ) throws Exception
      {
          #if ($table.IdMethod.equals("none"))
          doInsert(buildCriteria(obj));
          #else
          obj.setPrimaryKey(doInsert(buildCriteria(obj)));
          #end
          obj.setNew(false);
      }
  
      /**
       * @param obj the data object to update in the database.
       */
      public static void doUpdate($table.JavaName obj) throws Exception
      {
          doUpdate(buildCriteria(obj));
      }
      /**
       * @param obj the data object to delete in the database.
       */
      public static void doDelete($table.JavaName obj) throws Exception
      {
          doDelete(buildCriteria(obj));
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert($table.JavaName) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to insert into the database.
       */
      public static void doInsert( $table.JavaName obj, DBConnection dbCon) throws Exception
      {
          #if ($table.IdMethod.equals("none"))
          doInsert(buildCriteria(obj), dbCon);
          #else
          obj.setPrimaryKey(doInsert(buildCriteria(obj), dbCon));
          #end
          obj.setNew(false);
      }
  
      /**
       * Method to do update.  This method is to be used during a transaction,
       * otherwise use the doUpdate($table.JavaName) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to update in the database.
       */
      public static void doUpdate($table.JavaName obj, DBConnection dbCon) throws Exception
      {
          doUpdate(buildCriteria(obj), dbCon);
      }
      /**
       * Method to delete.  This method is to be used during a transaction,
       * otherwise use the doDelete($table.JavaName) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to delete in the database.
       */
      public static void doDelete($table.JavaName obj, DBConnection dbCon) throws Exception
      {
          doDelete(buildCriteria(obj), dbCon);
      }
  
      /** Build a Criteria object from the data object for this peer */
      public static Criteria buildCriteria( $table.JavaName obj )
      {
          Criteria criteria = new Criteria();
          #foreach ($col in $table.Columns)
              #set ( $cfc=$col.JavaName )
              #set ( $cup=$col.Name.toUpperCase() )
              #if ($col.isPrimaryKey() && !$table.IdMethod.equals("none"))
          if ( !obj.isNew() )
             #end
              criteria.add( $cup, obj.get${cfc}() );
          #end
          return criteria;
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       */
      public static $table.JavaName retrieveByPK( ObjectKey pk )
          throws Exception
      {
          DBConnection db = null;
          $table.JavaName retVal = null;
         try
          {
             db = TurbineDB.getConnection( mapBuilder.getDatabaseMap().getName() );
             retVal = retrieveByPK( pk, db );
          }
          finally
          {
             if (db != null)
                TurbineDB.releaseConnection(db);
          }
          return(retVal);
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       * @param DBConnection dbcon
       */
      public static $table.JavaName retrieveByPK( ObjectKey pk, DBConnection dbcon )
          throws Exception
      {
  
          Criteria criteria = new Criteria();
  #if ($table.PrimaryKeys.size() == 1)
              criteria.add( $table.PrimaryKeys.get(0).Name.toUpperCase(), pk );
  #else
          SimpleKey[] keys = (SimpleKey[])pk.getValue();
      #set ( $i = 0 )
      #foreach ($col in $table.PrimaryKeys)
          #set ( $cup=$col.Name.toUpperCase() )
              criteria.add( $cup, keys[$i] );
          #set ( $i = $i + 1 )
      #end
  #end
          Vector v = doSelect(criteria, dbcon);
          if ( v.size() != 1)
          {
              throw new Exception("Failed to select one and only one row.");
          }
          else
          {
              return ($table.JavaName)v.firstElement();
          }
      }
  
  
  #if ($table.PrimaryKeys.size() > 1)
  #set ( $comma = false )
      /** 
       * retrieve object using using pk values.
       *
  #foreach ($col in $table.PrimaryKeys)
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype= $col.JavaNative )
       * @param $cjtype $clo
  #end
       */
      public static $table.JavaName retrieveByPK(
  #foreach ($col in $table.PrimaryKeys)
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype = $col.JavaNative )
      #if ($comma),#end $cjtype $clo
          #set ( $comma = true )
  #end
          ) throws Exception
      {
          DBConnection db = null;
          $table.JavaName retVal = null;
         try
          {
             db = TurbineDB.getConnection( mapBuilder.getDatabaseMap().getName() );
             retVal = retrieveByPK( 
             #set ( $comma = false )
             #foreach ($col in $table.PrimaryKeys)
           #set ( $clo=$col.Name.toLowerCase() )
           #if ($comma),#end $clo
                #set ( $comma = true )
             #end
                 , db);
          }
          finally
          {
             if (db != null)
                TurbineDB.releaseConnection(db);
          }
          return(retVal);
      }   
  
  #set ( $comma = false )
      /** 
       * retrieve object using using pk values.
       *
  #foreach ($col in $table.PrimaryKeys)
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype= $col.JavaNative )
       * @param $cjtype $clo
  #end
       * @param DBConnection dbcon
       */
      public static $table.JavaName retrieveByPK(
  #foreach ($col in $table.PrimaryKeys)
      #set ( $clo=$col.Name.toLowerCase() )
      #set ( $cjtype = $col.JavaNative )
      #if ($comma),#end $cjtype $clo
          #set ( $comma = true )
  #end
         ,DBConnection dbcon ) throws Exception
      {
      
          Criteria criteria = new Criteria(5);
  #foreach ($col in $table.PrimaryKeys)
      #set ( $cup=$col.Name.toUpperCase() )
      #set ( $clo=$col.Name.toLowerCase() )
          criteria.add( $cup, $clo );
  #end
          Vector v = doSelect(criteria, dbcon);
          if ( v.size() != 1)
          {
              throw new Exception("Failed to select one and only one row.");
          }
          else
          {
              return ($table.JavaName) v.firstElement();
          }
      }
  #end
  
  #end ## ends if (!$table.isAlias())
  
  #if ($complexObjectModel)
  
   ## 
   ## setup joins
   ##
   #set ( $className = $table.JavaName ) 
   #set ( $countFK = 0 )  
   #foreach ($dummyFK in $table.ForeignKeys)
        #set ( $countFK = $countFK + 1 )
   #end
  
   #if ($countFK >= 1)
   #foreach ($fk in $table.ForeignKeys)
     ## want to cover this case, but the code is not there yet.
     #if ( !($fk.ForeignTableName.equals($table.Name)) )
  
       #set ( $partJoinName = "" )
       #foreach ($columnName in $fk.LocalColumns)
          #set ( $column = $table.getColumn($columnName) )
          #if ($column.isMultipleFK())
              #set ( $partJoinName=$strings.concat([$partJoinName,$column.JavaName]) )
          #elseif ( $fk.ForeignTableName.equals($table.Name) )
              #set ( $partJoinName=$strings.concat([$partJoinName,$column.JavaName]) )
          #end
       #end
  
       #set ( $joinTable = $table.Database.getTable($fk.ForeignTableName) )
       #set ( $joinClassName = $joinTable.JavaName )
  
       #if ($partJoinName == "")
          #set ( $joinColumnId = $joinClassName )
          #set ( $collThisTable = $strings.concat([$className, "s"]) )
          #set ( $collThisTableMs = $className )
       #else
          #set ( $joinColumnId=$strings.concat([$joinClassName,"RelatedBy",$partJoinName]) )
          #set ( $collThisTable=$strings.concat([$className,"sRelatedBy",$partJoinName]) )
          #set ( $collThisTableMs=$strings.concat([$className,"RelatedBy",$partJoinName]) )
       #end
  
  
  ## ------------------------------------------------------------
  
     /**
      * selects a collection of $className objects pre-filled with their
      * $joinClassName objects.
      */
      protected static Vector doSelectJoin${joinColumnId}(Criteria c)
          throws Exception
      {
           c.setDbName(mapBuilder.getDatabaseMap().getName());
  
          ${table.JavaName}Peer.addSelectColumns(c);
          int offset = numColumns + 1;
          ${joinClassName}Peer.addSelectColumns(c);
  
  
       #set ( $lfMap = $fk.LocalForeignMapping )
       #foreach ($columnName in $fk.LocalColumns)
          #set ( $column = $table.getColumn($columnName) )
          #set ( $columnFk = $joinTable.getColumn( $lfMap.get($columnName) ) )
          c.addJoin(${table.JavaName}Peer.$column.Name.toUpperCase(),
              ${joinClassName}Peer.$columnFk.Name.toUpperCase());
       #end
  
  
  
  
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( c.containsKey($cup) )
          {
              Object possibleBoolean = c.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      c.add($cup, 1);
                  }
                  else
                  {   
                      c.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( c.containsKey($cup) )
          {
              Object possibleBoolean = c.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      c.add($cup, "Y");
                  }
                  else
                  {   
                      c.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
          
          Vector rows = BasePeer.doSelect(c);
          Vector results = new Vector();
  
          for (int i=0; i<rows.size(); i++)
          {
              Record row = (Record)rows.elementAt(i);
  
  #set ($classDecl = "Class")
  #if ($table.ChildrenColumn)
              $classDecl omClass = ${table.JavaName}Peer.getOMClass(row, 1);
  #else
              $classDecl omClass = ${table.JavaName}Peer.getOMClass();
  #end
  #set ($classDecl = "")
  
              $className obj1 = ($className)${table.JavaName}Peer
                  .row2Object( row, 1, omClass);
  
  
  #if ($joinTable.ChildrenColumn)
              $classDecl omClass = ${joinClassName}Peer.getOMClass(row, offset);
  #else
              $classDecl omClass = ${joinClassName}Peer.getOMClass();
  #end
  #set ($classDecl = "")
              $joinClassName obj2 = ($joinClassName)${joinClassName}Peer
                  .row2Object(row, offset, omClass);
              
              boolean newObject = true;
              for (int j=0; j<results.size(); j++)
              {
                  $className temp_obj1 = ($className)results.elementAt(j);
                  $joinClassName temp_obj2 = temp_obj1.get${joinColumnId}();
                  if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
                  {
                      newObject = false;
                      temp_obj2.add${collThisTableMs}(obj1);
                      break;
                  }
              }
              if (newObject)
              {
                  obj2.init${collThisTable}();
                  obj2.add${collThisTableMs}(obj1);
              }
              results.add(obj1);
  
          }
  
          return results;
      }
    #end
   #end 
   #end 
  
  ## ===========================================================
  
    #if ($countFK > 2)
  
    #foreach ($fk in $table.ForeignKeys)
  
       #set ( $excludeTable = $table.Database.getTable($fk.ForeignTableName) )
       #set ( $excludeClassName = $excludeTable.JavaName )
  
       #set ( $relatedByCol = "" )
       #foreach ($columnName in $fk.LocalColumns)
          #set ( $column = $table.getColumn($columnName) )
          #if ($column.isMultipleFK())
              #set ($relatedByCol=$strings.concat([$relatedByCol,$column.JavaName]))
          #end
       #end
  
       #if ($relatedByCol == "")
          #set ( $excludeString = $excludeClassName )
          #set ( $collThisTable = $strings.concat([$className, "s"]) )
          #set ( $collThisTableMs = $className )
       #else
          #set ( $excludeString=$strings.concat([$excludeClassName,"RelatedBy",$relatedByCol]) )
          #set ( $collThisTable=$strings.concat([$className,"sRelatedBy",$relatedByCol]) )
          #set ( $collThisTableMs=$strings.concat([$className,"RelatedBy",$relatedByCol]) )
       #end
  
  
  
     /**
      * selects a collection of $className objects pre-filled with 
      * all related objects.
      */
      protected static Vector doSelectJoinAllExcept${excludeString}(Criteria c) 
          throws Exception
      {
           c.setDbName(mapBuilder.getDatabaseMap().getName());
  
          addSelectColumns(c);
          int offset2 = numColumns + 1;
      #set ( $index = 2 )
      #foreach ($fk in $table.ForeignKeys)
        ## want to cover this case, but the code is not there yet.
        #if ( !($fk.ForeignTableName.equals($table.Name)) )
          #set ( $joinTable = $table.Database.getTable($fk.ForeignTableName) )
          #set ( $joinClassName = $joinTable.JavaName )
  
          #if (!$joinClassName.equals($excludeClassName))
              #set ( $new_index = $index + 1 )
          ${joinClassName}Peer.addSelectColumns(c);
          int offset$new_index = offset$index + ${joinClassName}Peer.numColumns;
              #set ( $index = $new_index )
          #end
        #end
      #end
       #foreach ($col in $table.Columns)
           #set ( $cup=$col.Name.toUpperCase() )
           #if($col.isBooleanInt())
          // check for conversion from boolean to int
          if ( c.containsKey($cup) )
          {
              Object possibleBoolean = c.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      c.add($cup, 1);
                  }
                  else
                  {   
                      c.add($cup, 0);
                  }
              }                     
           }
           #elseif ($col.isBooleanChar())
          // check for conversion from boolean to Y/N
          if ( c.containsKey($cup) )
          {
              Object possibleBoolean = c.get($cup);
              if ( possibleBoolean instanceof Boolean )
              {
                  if ( ((Boolean)possibleBoolean).booleanValue() )
                  {
                      c.add($cup, "Y");
                  }
                  else
                  {   
                      c.add($cup, "N");
                  }
              }                     
           }
           #end
       #end
  
          Vector rows = BasePeer.doSelect(c);
          Vector results = new Vector();
  
          for (int i=0; i<rows.size(); i++)
          {
              Record row = (Record)rows.elementAt(i);
  
        #set ($classDecl = "Class")
        #if ($table.ChildrenColumn)
              $classDecl omClass = ${table.JavaName}Peer.getOMClass(row, 1);
        #else
              $classDecl omClass = ${table.JavaName}Peer.getOMClass();
        #end
        #set ($classDecl = "")
  
              $className obj1 = ($className)${table.JavaName}Peer
                  .row2Object( row, 1, omClass);
  
  
      #set ( $index = 1 )
      #foreach ($fk in $table.ForeignKeys)
        ## want to cover this case, but the code is not there yet.
        #if ( !($fk.ForeignTableName.equals($table.Name)) )
          #set ( $joinTable = $table.Database.getTable($fk.ForeignTableName) )
          #set ( $joinClassName = $joinTable.JavaName )
  
          #if (!$joinClassName.equals($excludeClassName))
              #set ( $partJoinName = "" )
              #foreach ($columnName in $fk.LocalColumns)
                  #set ( $column = $table.getColumn($columnName) )
                  #if ($column.isMultipleFK())
                      #set ( $partJoinName=$strings.concat([$partJoinName,$column.JavaName]) )
                  #end
              #end
  
              #if ($partJoinName == "")
                  #set ( $joinString = $joinClassName )
                  #set ( $collThisTable = $strings.concat([$className, "s"]) )
                  #set ( $collThisTableMs = $className )
              #else
                  #set ( $joinString=$strings.concat([$joinClassName,"RelatedBy",$partJoinName]) )
                  #set ( $collThisTable=$strings.concat([$className,"sRelatedBy",$partJoinName]) )
                  #set ( $collThisTableMs=$strings.concat([$className,"RelatedBy",$partJoinName]) )
              #end
  
              #set ( $index = $index + 1 )
  
      #if ($joinTable.ChildrenColumn)
              $classDecl omClass = ${joinClassName}Peer.getOMClass(row, offset$index);
      #else
              $classDecl omClass = ${joinClassName}Peer.getOMClass();
      #end
      #set ($classDecl = "")
              $joinClassName obj$index = ($joinClassName)${joinClassName}Peer
                  .row2Object( row, offset$index, omClass);
              
              #if ($index == 2) boolean #end newObject = true;
              for (int j=0; j<results.size(); j++)    
              {
                  $className temp_obj1 = ($className)results.elementAt(j);
                  $joinClassName temp_obj$index = temp_obj1.get${joinString}();
                  if ( temp_obj${index}.getPrimaryKey().equals(obj${index}.getPrimaryKey() ) )
                  {
                      newObject = false;
                      temp_obj${index}.add${collThisTableMs}(obj1);
                      break;
                  }
              }
              if (newObject)
              {
                  obj${index}.init${collThisTable}();
                  obj${index}.add${collThisTableMs}(obj1);
              }
        #end
      #end
    #end
              results.add(obj1);
  
          }
  
          return results;
      }
   #end
   #end  
  #end
  
  ## ------------------------------------------------------------
  
  
  #if (!$table.isAlias())
      /** 
       * Returns the TableMap related to this peer.  This method is not 
       * needed for general use but a specific application could have a
       * need.
       */
      protected static TableMap getTableMap()
      {
          return mapBuilder.getDatabaseMap().getTable(TABLE_NAME);
      }     
  #end ## ends if (!$table.isAlias())
  
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/service/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $basepath = "service" )
  
  #set ( $sourceFile = "Turbine${baseName}Service.java" )
  $generator.parse("$basepath/ServiceImplementation.vm",$sourceFile)
  
  #set ( $sourceFile = "${baseName}Service.java" )
  $generator.parse("$basepath/ServiceInterface.vm",$sourceFile)
  
  #set ( $sourceFile = "Turbine${baseName}.java" )
  $generator.parse("$basepath/ServiceStaticHelper.vm",$sourceFile)
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/service/ServiceImplementation.vm
  
  Index: ServiceImplementation.vm
  ===================================================================
  package $package;
  
  $license
  
  import org.apache.turbine.services.TurbineBaseService;
  
  /**
   *
   * @author <a href="mailto:$email">$name</a>
   */
  public class Turbine${baseName}Service extends TurbineBaseService
      implements ${baseName}Service
  
  {
      /**
       * Initialize the Turbine${baseName} Service.
       */
      public void init()
      {
          setInit(true);
      }
  }
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/service/ServiceInterface.vm
  
  Index: ServiceInterface.vm
  ===================================================================
  package $package;
  
  $license
  
  import org.apache.turbine.services.Service;
  
  /**
   *
   * @author <a href="mailto:$email">$name</a>
   */
  public interface ${baseName}Service extends Service
  {
      public static final String SERVICE_NAME = "${baseName}Service";
  }
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/service/ServiceStaticHelper.vm
  
  Index: ServiceStaticHelper.vm
  ===================================================================
  package $package;
  
  $license
  
  import org.apache.turbine.services.TurbineServices;
  
  /**
   *
   *
   * @author <a href="mailto:$email">$name</a>
   */
  public class Turbine$baseName
  {
      /**
       * Utility method for accessing the service 
       * implementation
       *
       * @return a ${baseName}Service implementation instance
       */
      protected static ${baseName}Service getService()
      {
          return (${baseName}Service)TurbineServices
              .getInstance().getService(${baseName}Service.SERVICE_NAME);
      }
  }
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $basepath = "sql/base/$targetDatabase" )
  #set ( $dbprops = $properties.load("$generator.TemplatePath/sql/base/$targetDatabase/db.props") )
  #set ( $fname= "sql/base/$targetDatabase/table.vm" )
  #set ( $fnamekeys= "sql/base/$targetDatabase/tablefk.vm" )
  
  #foreach ($databaseModel in $appData.Databases)
      
      #if ($project)
          
          We have a defined project: $project
          
          #if ($appData.MultipleDatabases)
              #set ( $outFile = "${project}-${databaseModel.Name}-schema.sql" )
          #else
              #set ( $outFile = "${project}-schema.sql" )
          #end
          
          File to be created: $outFile
          
          #foreach ($tbl in $databaseModel.Tables)
              #if (!$tbl.isSkipSql())
                  $generator.parse($fname,$outFile,"table",$tbl)
              #end
          #end
          #foreach ($tbl in $databaseModel.Tables)
              #if (!$tbl.isSkipSql())
                  $generator.parse($fnamekeys,$outFile,"tablefk",$tbl)
              #end
          #end    
      #else
          #foreach ($tbl in $databaseModel.Tables)
              #if (!$tbl.isSkipSql())
                  $generator.parse($fname,"","table",$tbl)
              #end
          #end
          #foreach ($tbl in $databaseModel.Tables)
              #if (!$tbl.isSkipSql())
                  $generator.parse($fnamekeys,"","tablefk",$tbl)
              #end
          #end    
      #end
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), $dbprops.get("AUTOINCREMENT"),"") )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"") )
      #set ( $nullString = $strings.select($col.isAutoIncrement(), "", $dbprops.get("NOTNULL")) )
      #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to Oracle mappings.
  
  BIT =
  TINYINT =
  SMALLINT =
  INTEGER = INT
  BIGINT =
  FLOAT =
  REAL =
  DOUBLE =
  NUMERIC =
  DECIMAL =
  CHAR = VARCHAR
  VARCHAR = VARCHAR
  LONGVARCHAR = VARCHAR
  DATE =
  TIME =
  TIMESTAMP = DATE
  BINARY =
  VARBINARY = BLOB (16777215)
  LONGVARBINARY =
  NULL =
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  AUTOINCREMENT = GENERATED ALWAYS AS IDENTITY
  NOTNULL = NOT NULL
  
  removeNotNullWithAutoIncrement = true
  
  suppressDefaults = false
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/drop.vm
  
  Index: drop.vm
  ===================================================================
  drop table $table.Name;
  drop sequence if exists $table.SequenceName;
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_FK_${velocityCount} FOREIGN KEY ($fk.LocalColumnNames)
      REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
  USING INDEX;
  
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.IsUnique)UNIQUE#end INDEX $index.IndexName ON $table.Name ($index.IndexColumnList);
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_PK 
  PRIMARY KEY ($table.printPrimaryKey());
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/sequence.vm
  
  Index: sequence.vm
  ===================================================================
  #if ($table.IdMethod == "native")
  CREATE SEQUENCE $table.SequenceName;
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/table.vm
  
  Index: table.vm
  ===================================================================
  
  -----------------------------------------------------------------------------
  -- $table.Name
  -----------------------------------------------------------------------------
  $generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$unique]))$strings.chop($cols,2)#else$cols#end
  #if($unique.length()>0)$strings.chop($unique,2)#end
  
  );
  
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  #if($pk.length()>0)$pk#end
  
  #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #if ($fk.length()>0)$fk#end
  
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($index.length() > 0)$index#end
  
  ##set $sequence = $generator.parse("$basepath/sequence.vm", "", "table", $tbl)
  ##if ($sequence.length()>0)$sequence#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/tablefk.vm
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/db2/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"") )
      #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), $dbprops.get("AUTOINCREMENT"),"") )
      #set ( $entry = "$col.Name $type $size $autoIncrement," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to Hypersonic mappings.
  
  BIT =
  TINYINT =
  SMALLINT =
  INTEGER = integer
  BIGINT =
  FLOAT =
  REAL =
  DOUBLE =
  NUMERIC =
  DECIMAL =
  CHAR = VARCHAR
  VARCHAR = VARCHAR
  LONGVARCHAR = VARCHAR
  DATE =
  TIME =
  TIMESTAMP = timestamp
  BINARY =
  VARBINARY = BINARY
  LONGVARBINARY =
  NULL =
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  AUTOINCREMENT = IDENTITY
  NOTNULL = NOT NULL
  
  primaryKeyInsideTableDirective = true
  indexInsideTableDirective = false
  
  removeNotNullWithAutoIncrement = false
  
  suppressDefaults = true
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/drop.vm
  
  Index: drop.vm
  ===================================================================
  drop table if exists $table.Name;
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
      FOREIGN KEY ($fk.LocalColumnNames) REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames),
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.IsUnique)UNIQUE#end INDEX $index.IndexName ON $table.Name ($index.IndexColumnList);
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
      PRIMARY KEY($table.printPrimaryKey()),
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/table.vm
  
  Index: table.vm
  ===================================================================
  
  -----------------------------------------------------------------------------
  -- $table.Name
  -----------------------------------------------------------------------------
  ##$generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  ##set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,1)#else$cols#end
  #if($strings.allEmpty([$unique]) && $pk.length()>0)$strings.chop($pk,2)#else$pk#end
  ##if($strings.allEmpty([$unique,$index]) && $fk.length() >0)$strings.chop($fk,2)#else$fk#end
  #if($unique.length()>0)$strings.chop($unique,2)#else$unique#end
  
  );
  
  #if($index.length() > 0)$strings.chop($index,1)#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/tablefk.vm
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/hypersonic/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"") )
      #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), $dbprops.get("AUTOINCREMENT"),"") )
      #set ( $colName = $strings.concat(['"',$col.Name,'"']) )
      #set ( $entry = "$colName $type $size $default $nullString $autoIncrement," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to Interbase mappings.
  
  BIT =
  TINYINT =
  SMALLINT =
  INTEGER = INTEGER
  BIGINT =
  FLOAT =
  REAL =
  DOUBLE =
  NUMERIC =
  DECIMAL =
  CHAR = VARCHAR
  VARCHAR = VARCHAR
  LONGVARCHAR = VARCHAR
  DATE =
  TIME =
  TIMESTAMP = timestamp
  BINARY =
  VARBINARY = BLOB
  LONGVARBINARY =
  NULL =
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  AUTOINCREMENT = IDENTITY
  NOTNULL = NOT NULL
  
  primaryKeyInsideTableDirective = true
  indexInsideTableDirective = false
  
  removeNotNullWithAutoIncrement = false
  
  suppressDefaults = true
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/drop.vm
  
  Index: drop.vm
  ===================================================================
  drop table if exists $table.Name;
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
      FOREIGN KEY ($fk.LocalColumnNames) REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames),
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.IsUnique)UNIQUE#end INDEX $index.IndexName ON $table.Name ($index.IndexColumnList);
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
      PRIMARY KEY($table.printPrimaryKey()),
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/table.vm
  
  Index: table.vm
  ===================================================================
  
  /* --------------------------------------------------------------------------
  $table.Name
  -------------------------------------------------------------------------- */
  ##$generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  ##set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,1)#else$cols#end
  #if($strings.allEmpty([$unique]) && $pk.length()>0)$strings.chop($pk,2)#else$pk#end
  ##if($strings.allEmpty([$unique,$index]) && $fk.length() >0)$strings.chop($fk,2)#else$fk#end
  #if($unique.length()>0)$strings.chop($unique,2)#else$unique#end
  
  );
  
  #if($index.length() > 0)$strings.chop($index,1)#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/tablefk.vm
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/interbase/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),$dbprops.get("NULL")) )
      #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), $dbprops.get("AUTOINCREMENT"),"") )
      #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/db.props
  
  Index: db.props
  ===================================================================
  BIT = BIT
  TINYINT = TINYINT
  SMALLINT = SMALLINT
  INTEGER = INT
  BIGINT =
  FLOAT = FLOAT
  REAL = REAL
  DOUBLE =
  NUMERIC = NUMERIC
  DECIMAL = DECIMAL
  CHAR = VARCHAR
  VARCHAR = VARCHAR
  LONGVARCHAR = TEXT
  DATE = DATETIME
  TIME = DATETIME
  TIMESTAMP = DATETIME
  BINARY = BINARY
  VARBINARY = IMAGE
  LONGVARBINARY = IMAGE
  NULL = NULL
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  AUTOINCREMENT = true
  NOTNULL = NOT NULL
  
  removeNotNullWithAutoIncrement = false
  
  suppressDefaults = false
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/drop.vm
  
  Index: drop.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  IF EXISTS (SELECT 1 FROM sysobjects WHERE type ='RI' AND name='${table.Name}_FK_${velocityCount}')
      ALTER TABLE $table.Name DROP CONSTRAINT ${table.Name}_FK_${velocityCount};
  #end
  IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = '$table.Name')
  BEGIN
       DECLARE @reftable nvarchar(60), @constraintname nvarchar(60)
       DECLARE refcursor CURSOR FOR
       select reftables.name tablename, cons.name constraitname
        from sysobjects tables,
             sysobjects reftables,
             sysobjects cons,
             sysreferences ref
         where tables.id = ref.rkeyid
           and cons.id = ref.constid
           and reftables.id = ref.fkeyid
           and tables.name = '$table.Name'
       OPEN refcursor
       FETCH NEXT from refcursor into @reftable, @constraintname
       while @@FETCH_STATUS = 0
       BEGIN
         exec ('alter table '+@reftable+' drop constraint '+@constraintname)
         FETCH NEXT from refcursor into @reftable, @constraintname
       END
       CLOSE refcursor
       DEALLOCATE refcursor
       DROP TABLE $table.Name
  END
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  BEGIN
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_FK_${velocityCount} FOREIGN KEY ($fk.LocalColumnNames)
      REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
  END    
  ;
  
  #end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.IsUnique)UNIQUE#end INDEX $index.IndexName ON $table.Name ($index.IndexColumnList);
  #end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
      CONSTRAINT ${table.Name}_PK PRIMARY KEY($table.printPrimaryKey()),
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/table.vm
  
  Index: table.vm
  ===================================================================
  
  /* ---------------------------------------------------------------------- */
  /* $table.Name                                                      */
  /* ---------------------------------------------------------------------- */
  
  $generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,1)#else$cols#end
  #if($strings.allEmpty([$unique]) && $pk.length()>0)$strings.chop($pk,2)#else$pk#end
  #if($unique.length()>0)$strings.chop($unique,2)#end
  );
  
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($index.length() > 0)$index#end
  
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/tablefk.vm
  
  Index: tablefk.vm
  ===================================================================
  
  /* ---------------------------------------------------------------------- */
  /* $table.Name                                                      */
  /* ---------------------------------------------------------------------- */
  
  #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #if($fk.length() >0)$fk#end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mssql/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"") )
      #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), $dbprops.get("AUTOINCREMENT"),"") )
      #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to MySQL mappings.
  #
  # A good MySQL resource for determining these mappings is at
  # http://www.mysql.com/doc/C/o/Column_types.html
  
  BIT = BIT
  TINYINT = TINYINT
  SMALLINT = SMALLINT
  INTEGER = INTEGER
  BIGINT = BIGINT
  FLOAT = FLOAT
  REAL = REAL
  DOUBLE = DOUBLE
  NUMERIC = DECIMAL 
  DECIMAL = DECIMAL
  CHAR = CHAR
  VARCHAR = VARCHAR
  LONGVARCHAR = MEDIUMTEXT
  DATE = DATETIME
  TIME = TIME
  TIMESTAMP = TIMESTAMP
  BINARY = BLOB
  VARBINARY = MEDIUMBLOB
  LONGVARBINARY = LONGBLOB
  NULL =
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB = LONGBLOB
  CLOB = LONGTEXT
  REF =
  
  AUTOINCREMENT = AUTO_INCREMENT
  NOTNULL = NOT NULL
   
  removeNotNullWithAutoIncrement = false
  suppressDefaults = false
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/drop.vm
  
  Index: drop.vm
  ===================================================================
  drop table if exists $table.Name;
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
      FOREIGN KEY ($fk.LocalColumnNames) REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames),
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/index.vm
  
  Index: index.vm
  ===================================================================
  #set ( $comma = "" )
  #foreach ($index in $table.Indices)
      ${comma}INDEX $index.IndexName ($index.IndexColumnList)
      #set ($comma = ",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
      PRIMARY KEY($table.printPrimaryKey()),
  #set ($pk = $table.getPrimaryKey())#if ($pk.size() > 1)#foreach ($index in $table.getAdditionalIndicesForPrimaryKey())    INDEX($index),
  #end#end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/table.vm
  
  Index: table.vm
  ===================================================================
  
  # -----------------------------------------------------------------------
  # $table.Name
  # -----------------------------------------------------------------------
  $generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$pk,$fk,$unique,$index]))$strings.chop($cols,1)#else$cols#end
  #if($strings.allEmpty([$fk,$unique,$index]) && $pk.length()>0)$strings.chop($pk,2)#else$pk#end
  #if($strings.allEmpty([$unique,$index]) && $fk.length() >0)$strings.chop($fk,2)#else$fk#end
  #if($strings.allEmpty([$index]) && $unique.length()>0)$strings.chop($unique,2)#else$unique#end
  #if($index.length() > 0)$strings.chop($index,1)#end
  
  );
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/tablefk.vm
  
  Index: tablefk.vm
  ===================================================================
    
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/mysql/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"") )
      #set ( $entry = "$col.Name $type $size $default $nullString," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to Oracle mappings.
  #
  # Good Oracle resources for determining these mappings include:
  # http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/basic3.htm
  # http://technet.oracle.com/docs/tech/migration/workbench/doc_library/MSAccess/ch3.htm
  
  BIT = NUMBER (1, 0)
  TINYINT = NUMBER (3, 0)
  SMALLINT = NUMBER (5, 0)
  INTEGER = INT
  BIGINT = NUMBER (20, 0)
  FLOAT = FLOAT
  REAL = NUMBER
  DOUBLE = FLOAT
  NUMERIC = NUMBER
  DECIMAL = NUMBER
  CHAR = CHAR
  VARCHAR = VARCHAR2
  LONGVARCHAR = VARCHAR2 (2000)
  DATE = DATE
  TIME = DATE
  TIMESTAMP = DATE
  BINARY = RAW
  VARBINARY = RAW
  LONGVARBINARY = LONG RAW
  NULL =
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB = BLOB
  CLOB = CLOB
  REF =
  
  NOTNULL = NOT NULL
  
  primaryKeyInsideTableDirective = true
  foreignKeyInsideTableDirective = true
  indexInsideTableDirective = false
  
  removeNotNullWithAutoIncrement = false
  
  suppressDefaults = false
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/drop.vm
  
  Index: drop.vm
  ===================================================================
  DROP TABLE $table.Name CASCADE CONSTRAINTS;
  #if ($table.IdMethod == "native")
  DROP SEQUENCE $table.SequenceName;
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_FK_${velocityCount} FOREIGN KEY ($fk.LocalColumnNames)
      REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
  ;
  
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.IsUnique)UNIQUE#end INDEX $index.IndexName ON $table.Name ($index.IndexColumnList);
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_PK 
  PRIMARY KEY ($table.printPrimaryKey());
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/sequence.vm
  
  Index: sequence.vm
  ===================================================================
  #if ($table.IdMethod == "native")
  CREATE SEQUENCE $table.SequenceName INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE ORDER;
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/table.vm
  
  Index: table.vm
  ===================================================================
  
  -----------------------------------------------------------------------------
  -- $table.Name
  -----------------------------------------------------------------------------
  $generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$unique]))$strings.chop($cols,2)#else$cols#end
  #if($unique.length()>0)$strings.chop($unique,2)#end
  
  );
  
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  #if($pk.length()>0)$pk#end
  
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($index.length() > 0)$index#end
  
  #set ( $sequence = $generator.parse("$basepath/sequence.vm", "", "table", $tbl) )
  #if ($sequence.length()>0)$sequence#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/tablefk.vm
  
  Index: tablefk.vm
  ===================================================================
  #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #if ($fk.length()>0)$fk#end
  
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/oracle/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"") )
      #set ( $entry = "$col.Name $type $size $default $nullString," )
      #set ( $autoIncrement = $dbprops.get("AUTOINCREMENT") )
      #set ( $entry = $strings.select($col.isAutoIncrement(), "$col.Name $autoIncrement,", $entry) )
      #set ( $entry = $strings.collapseSpaces($entry) )
      $strings.sub($entry," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to PostgreSQL mappings.
  
  BIT =
  TINYINT = int2
  SMALLINT = int2
  INTEGER = integer
  BIGINT = int4
  FLOAT = float
  REAL = float
  
  
  DOUBLE =
  NUMERIC =
  DECIMAL =
  CHAR = varchar
  VARCHAR = varchar
  LONGVARCHAR = varchar
  DATE = date
  TIME = time
  TIMESTAMP = timestamp
  BINARY =
  VARBINARY = oid
  LONGVARBINARY =
  NULL =
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  AUTOINCREMENT = serial
  NOTNULL = NOT NULL
  
  primaryKeyInsideTableDirective = true
  indexInsideTableDirective = false
  
  removeNotNullWithAutoIncrement = true
  
  suppressDefaults = false
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/drop.vm
  
  Index: drop.vm
  ===================================================================
  drop table $table.Name;
  #if ($table.IdMethod == "native")
  drop sequence $table.SequenceName;
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  ALTER TABLE $table.Name
      ADD CONSTRAINT $fk.LocalColumnNames FOREIGN KEY ($fk.LocalColumnNames)
      REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames);
  
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  create #if($index.IsUnique)unique#end INDEX $index.IndexName on $table.Name ($index.IndexColumnList);
  #end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
      PRIMARY KEY($table.printPrimaryKey()),
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/table.vm
  
  Index: table.vm
  ===================================================================
  
  -----------------------------------------------------------------------------
  -- $table.Name
  -----------------------------------------------------------------------------
  $generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table",$tbl) )
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,1)#else$cols#end
  #if($strings.allEmpty([$unique]) && $pk.length()>0)$strings.chop($pk,2)#else$pk#end
  #if($unique.length() > 0)$strings.chop($unique,2)#end
  
  );
  #if($index.length() > 0)$strings.chop($index,1)#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/tablefk.vm
  
  Index: tablefk.vm
  ===================================================================
  
  ----------------------------------------------------------------------
  -- $table.Name                                                      
  ----------------------------------------------------------------------
  
  #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #if($fk.length() >0)$fk#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/postgresql/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"") )
      #set ( $entry = "$col.Name $type $size $default $nullString," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to SapDB mappings.
  
  BIT =
  TINYINT =
  SMALLINT =
  INTEGER = INT
  BIGINT =
  FLOAT =
  REAL =
  DOUBLE =
  NUMERIC =
  DECIMAL =
  CHAR = VARCHAR2
  VARCHAR = VARCHAR2
  LONGVARCHAR = VARCHAR2
  DATE = DATE
  TIME =
  TIMESTAMP = DATE
  BINARY =
  VARBINARY = LONG RAW
  LONGVARBINARY =
  NULL =
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  AUTOINCREMENT = AUTO_INCREMENT
  NOTNULL = NOT NULL
  
  primaryKeyInsideTableDirective = true
  foreignKeyInsideTableDirective = true
  indexInsideTableDirective = false
  
  removeNotNullWithAutoIncrement = false
  
  suppressDefaults = false
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/drop.vm
  
  Index: drop.vm
  ===================================================================
  drop table $table.Name cascade constraints;
  #if ($table.IdMethod == "native")
  drop sequence $table.SequenceName;
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_FK_${velocityCount} FOREIGN KEY ($fk.LocalColumnNames)
      REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
  ;
  
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.IsUnique)UNIQUE#end INDEX $index.IndexName ON $table.Name ($index.IndexColumnList);
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_PK 
  PRIMARY KEY ($table.printPrimaryKey());
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/sequence.vm
  
  Index: sequence.vm
  ===================================================================
  #if ($table.IdMethod == "native")
  CREATE SEQUENCE $table.SequenceName;
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/table.vm
  
  Index: table.vm
  ===================================================================
  
  -----------------------------------------------------------------------------
  -- $table.Name
  -----------------------------------------------------------------------------
  $generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$unique]))$strings.chop($cols,2)#else$cols#end
  #if($unique.length()>0)$strings.chop($unique,2)#end
  
  );
  
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  #if($pk.length()>0)$pk#end
  
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($index.length() > 0)$index#end
  
  #set ( $sequence = $generator.parse("$basepath/sequence.vm", "", "table", $tbl) )
  #if ($sequence.length()>0)$sequence#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/tablefk.vm
  
  Index: tablefk.vm
  ===================================================================
  #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #if ($fk.length()>0)$fk#end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sapdb/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #if ( $dbprops.get("supressDefaults") == "true" )
          #set ( $default = "" )
      #else
          #set ( $default = $col.DefaultSetting )
      #end
      #if ( ($dbprops.get("removeNotNullWithAutoIncrement") == "true") && $col.isAutoIncrement() && $col.isNotNull() )
         #set ( $nullString = "" )
      #else
         #set ( $nullString = $strings.select($col.isNotNull(), $dbprops.get("NOTNULL"),"NULL") )
      #end
      #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), $dbprops.get("AUTOINCREMENT"),"") )
      #set ( $entry = "$col.Name $type $size $default $nullString $autoIncrement," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/db.props
  
  Index: db.props
  ===================================================================
  # Taken from java.sql.Types in the IBM 1.3 JDK
  # JDBC to Sybase mappings.
  
  BIT = BIT
  TINYINT =
  SMALLINT =
  INTEGER = INT
  BIGINT =
  FLOAT =
  REAL =
  DOUBLE =
  NUMERIC = NUMERIC
  DECIMAL =
  CHAR = CHAR
  VARCHAR = VARCHAR
  LONGVARCHAR = TEXT
  DATE = DATETIME
  TIME = TIMESTAMP
  TIMESTAMP = DATETIME
  BINARY = BINARY
  VARBINARY = IMAGE
  LONGVARBINARY = IMAGE
  NULL = NULL
  OTHER =
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  #
  # This is the autoincrement value if using native methods for
  # incrementing keys.  Most likely IDENTITIY wrt Sybase ASE.
  # Leaving the value blank should be used when Turbine's IDBroker
  # is used to autoincrement keys.
  #
  # Default: [blank]
  #
  AUTOINCREMENT =
  
  #
  # If true, the NOT NULL values will not be printed in generated 
  # SQL files if the column is set to autoincrement.  Should be true
  # when the internal IDENTITY attribute ( above ) is used in a column
  # for autoincrementing keys.
  #
  # Default: false
  #
  removeNotNullWithAutoIncrement = false
  
  #
  # If true, defaults are not included in generated SQL.
  #
  # Default: false
  #
  suppressDefaults = false
  
  #
  # The string to place in the generated SQL for columns which cannot
  # be NULL.
  #
  # Default: NOT NULL
  #
  NOTNULL = NOT NULL
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/drop.vm
  
  Index: drop.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  IF EXISTS (SELECT 1 FROM sysobjects WHERE type ='RI' AND name='${table.Name}_FK_${velocityCount}')
      ALTER TABLE $table.Name DROP CONSTRAINT ${table.Name}_FK_${velocityCount};
  #end
  IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = '$table.Name')
  BEGIN
  	DROP TABLE $table.Name
  END
  ;
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  BEGIN
  ALTER TABLE $table.Name
      ADD CONSTRAINT ${table.Name}_FK_${velocityCount} FOREIGN KEY ($fk.LocalColumnNames)
      REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames)
  END    
  ;
  
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.IsUnique)UNIQUE#end INDEX $index.IndexName ON $table.Name ($index.IndexColumnList);
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
      CONSTRAINT ${table.Name}_PK PRIMARY KEY($table.printPrimaryKey()),
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/table.vm
  
  Index: table.vm
  ===================================================================
  
  /* ---------------------------------------------------------------------- */
  /* $table.Name                                                      */
  /* ---------------------------------------------------------------------- */
  
  $generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$pk,$unique]))$strings.chop($cols,1)#else$cols#end
  #if($strings.allEmpty([$unique]) && $pk.length()>0)$strings.chop($pk,2)#else$pk#end
  #if($unique.length()>0)$strings.chop($unique,2)#end
  
  );
  
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($index.length() > 0)$index#end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/tablefk.vm
  
  Index: tablefk.vm
  ===================================================================
  
  /* ---------------------------------------------------------------------- */
  /* $table.Name                                                      */
  /* ---------------------------------------------------------------------- */
  
  #set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #if($fk.length() >0)$fk#end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/base/sybase/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
      UNIQUE ($unique.ColumnList),
  #end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $fname = "sql/db-init/$targetDatabase/${targetPlatform}.vm" )
  $generator.parse($fname,"")
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/hypersonic/unix.vm
  
  Index: unix.vm
  ===================================================================
  #!/bin/sh
  
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/hypersonic/windows.vm
  
  Index: windows.vm
  ===================================================================
  ECHO Not implemented
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/mssql/unix.vm
  
  Index: unix.vm
  ===================================================================
  #!/bin/sh
  
  #foreach ($databaseModel in $appData.Databases)
  dropdb $databaseModel.Name
  createdb $databaseModel.Name
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/mssql/windows.vm
  
  Index: windows.vm
  ===================================================================
  ECHO Not implemented
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/mysql/unix.vm
  
  Index: unix.vm
  ===================================================================
  #!/bin/sh
  
  #if ($databaseUser)
      #set ($user = "-u $databaseUser")
  #else
      #set ($user = "")
  #end
  
  #if ($databasePassword)
      #set ($password = "-p$databasePassword")
  #else
      #set ($password = "")
  #end
  
  #if ($databaseHost)
      #set ($host = "-h $databaseHost")
  #else
      #set ($host = "")
  #end
  
  #foreach ($databaseModel in $appData.Databases)
  mysqladmin $user $password $host --force drop $databaseModel.Name
  mysqladmin $user $password $host --force create $databaseModel.Name
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/mysql/windows.vm
  
  Index: windows.vm
  ===================================================================
  REM - Batch file to automatically create
  REM - MySQL database from Windows machines :-)
  
  #if ($databaseUser)
      #set ($user = "-u $databaseUser")
  #else
      #set ($user = "")
  #end
  
  #if ($databasePassword)
      #set ($password = "-p$databasePassword")
  #else
      #set ($password = "")
  #end
  
  #if ($databaseHost)
      #set ($host = "-h $databaseHost")
  #else
      #set ($host = "")
  #end
  
  #foreach ($databaseModel in $appData.Databases)
  mysqladmin $user $password $host --force drop $databaseModel.Name
  mysqladmin $user $password $host --force create $databaseModel.Name
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/postgresql/unix.vm
  
  Index: unix.vm
  ===================================================================
  #!/bin/sh
  
  #foreach ($databaseModel in $appData.Databases)
  dropdb $databaseModel.Name
  createdb $databaseModel.Name
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/sapdb/unix.vm
  
  Index: unix.vm
  ===================================================================
  #!/bin/sh
  
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/sapdb/windows.vm
  
  Index: windows.vm
  ===================================================================
  ECHO Not implemented
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/sybase/unix.vm
  
  Index: unix.vm
  ===================================================================
  #foreach ($databaseModel in $appData.Databases)
  USE MASTER
  ;
  
  DROP DATABASE $databaseModel.Name
  ;
  
  CREATE DATABASE $databaseModel.Name
  ON $sybaseDatadev = $sybaseDatasize
  LOG ON $sybaseLogdev = $sybaseLogsize
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/db-init/sybase/windows.vm
  
  Index: windows.vm
  ===================================================================
  #foreach ($databaseModel in $appData.Databases)
  USE MASTER
  ;
  
  DROP DATABASE $databaseModel.Name
  ;
  
  CREATE DATABASE $databaseModel.Name
  ON $sybaseDatadev = $sybaseDatasize
  LOG ON $sybaseLogdev = $sybaseLogsize
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $fname = "sql/id-table/idtable.$targetDatabase" )
  
  #foreach ($databaseModel in $appData.Databases)
    #if ($project)
      #if ($appData.MultipleDatabases)
        #set ( $outFile = "${project}-${databaseModel.Name}-id-table-init.sql" )
      #else
        #set ( $outFile = "${project}-id-table-init.sql" )
      #end
    #else
      #set ( $outFile = "" )
    #end
  
  $generator.parse($fname,$outFile,"tables",$databaseModel.Tables)
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.db2
  
  Index: idtable.db2
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.hypersonic
  
  Index: idtable.hypersonic
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.interbase
  
  Index: idtable.interbase
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.mssql
  
  Index: idtable.mssql
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.mysql
  
  Index: idtable.mysql
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.oracle
  
  Index: idtable.oracle
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.postgresql
  
  Index: idtable.postgresql
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.sapdb
  
  Index: idtable.sapdb
  ===================================================================
  delete from ID_TABLE where id_table_id >= $initialID;
  
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/idtable.sybase
  
  Index: idtable.sybase
  ===================================================================
  delete from ID_TABLE where ID_TABLE_ID >= $initialID;
  #foreach ($tbl in $tables)
  insert into ID_TABLE (ID_TABLE_ID, TABLE_NAME, NEXT_ID, QUANTITY) VALUES ($initialID, '$tbl.Name', 100, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/project.props
  
  Index: project.props
  ===================================================================
  # -------------------------------------------------------------------------
  # The values for the ID_TABLE_ID column in the ID_TABLE start
  # at 101 for tables used in projects.
  # -------------------------------------------------------------------------
  initialID = 101
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/id-table/turbine.props
  
  Index: turbine.props
  ===================================================================
  # -------------------------------------------------------------------------
  # The values for the ID_TABLE_ID column in the ID_TABLE will have
  # reserved values from 1-100 for turbine tables. The rest will
  # be for tables used for projects.
  # -------------------------------------------------------------------------
  initialID = 1
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/load/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $fname= "sql/load/${targetDatabase}/row.vm" )
  
  #foreach ($r in $data)
  $generator.parse($fname,"","row",$r)
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/load/hypersonic/row.vm
  
  Index: row.vm
  ===================================================================
  INSERT INTO $row.Table.Name (##
  #set ($comma="")#foreach($col in $row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end)
      VALUES (#set ($comma="")#foreach($col in $row.ColumnValues)$comma${generator.parse("sql/load/mysql/val.vm", "", "column", $col)}#set ($comma=",")#end);
      
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/load/hypersonic/val.vm
  
  Index: val.vm
  ===================================================================
  #if($column.Column.TorqueType=="VARCHAR")'$column.Value'#else$column.Value#end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/load/mysql/row.vm
  
  Index: row.vm
  ===================================================================
  INSERT INTO $row.Table.Name (##
  #set ($comma="")#foreach($col in $row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end)
      VALUES (#set ($comma="")#foreach($col in $row.ColumnValues)$comma${generator.parse("sql/load/mysql/val.vm", "", "column", $col)}#set ($comma=",")#end);
      
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/load/mysql/val.vm
  
  Index: val.vm
  ===================================================================
  #if($column.Column.TorqueType=="VARCHAR")'$column.Value'#else$column.Value#end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/load/postgresql/row.vm
  
  Index: row.vm
  ===================================================================
  INSERT INTO $row.Table.Name (##
  #set ($comma="")#foreach($col in $row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end)
      VALUES (#set ($comma="")#foreach($col in $row.ColumnValues)$comma${generator.parse("sql/load/mysql/val.vm", "", "column", $col)}#set ($comma=",")#end);
      
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/load/postgresql/val.vm
  
  Index: val.vm
  ===================================================================
  #if($column.Column.TorqueType=="VARCHAR")'$column.Value'#else$column.Value#end
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/security/Control.vm
  
  Index: Control.vm
  ===================================================================
  #set ( $dbprops = $properties.load("$generator.TemplatePath/sql/security/db.props") )
  #set ( $fname = "sql/security/${dbprops.get($targetDatabase)}-roles-perms.vm" )
  $generator.parse($fname,"")
  
  #if ($dbprops.get("secure.passwords") == "true")
  #set ( $fname= "sql/security/${dbprops.get($targetDatabase)}-secure-passwords.vm" )
  $generator.parse($fname,"")
  #end
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/security/default-roles-perms.vm
  
  Index: default-roles-perms.vm
  ===================================================================
  /* Script to fill the tables with default roles and permissions */
  /* Currently tested with MySQL, Oracle, Postgres and Hypersonic only. */
  
  /* Create the global group */
  /* this group is used to assign system-wide roles to users */
   
  INSERT INTO TURBINE_GROUP (GROUP_ID, GROUP_NAME) VALUES (1,'global');
  
  /* Create the root role */
  
  INSERT INTO TURBINE_ROLE (ROLE_ID, ROLE_NAME) VALUES (1, 'turbine_root');
  
  /* Create an account, turbine, for system administartor */
  /* Remember to set a good password for this user in a production system! */
  
  INSERT INTO TURBINE_USER 
      (USER_ID, LOGIN_NAME, PASSWORD_VALUE, FIRST_NAME, LAST_NAME) 
      VALUES
      (0, 'turbine', 'turbine', 'turbine', 'turbine');
  
  /* Assign the user, turbine, a system-wide role, turbine_root */
  
  INSERT INTO TURBINE_USER_GROUP_ROLE ( USER_ID, GROUP_ID, ROLE_ID ) 
  SELECT TURBINE_USER.USER_ID, TURBINE_GROUP.GROUP_ID, TURBINE_ROLE.ROLE_ID from 
  TURBINE_USER, TURBINE_GROUP, TURBINE_ROLE 
  WHERE TURBINE_USER.LOGIN_NAME = 'turbine' AND 
  TURBINE_GROUP.GROUP_NAME = 'global' AND TURBINE_ROLE.ROLE_NAME = 'turbine_root';
  
  /* Add some default permissions */
  
  INSERT INTO TURBINE_PERMISSION 
      (PERMISSION_ID, PERMISSION_NAME) 
      VALUES 
      (1, 'admin_users');
  
  /* Add some permissions for the root role */
  
  INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID) 
  SELECT TURBINE_ROLE.ROLE_ID, TURBINE_PERMISSION.PERMISSION_ID FROM 
  TURBINE_ROLE, TURBINE_PERMISSION
  WHERE TURBINE_PERMISSION.PERMISSION_NAME = 'admin_users' AND 
  TURBINE_ROLE.ROLE_NAME = 'turbine_root';
  
  
  
  1.1                  jakarta-jetspeed/build/torque/templates/sql/security/default-secure-passwords.vm
  
  Index: default-secure-passwords.vm
  ===================================================================
  /* Use this script to bootstrap you system into usage of secure passwords. */
  /* It will set the administrators password to turbine (using SHA digest)   */
  /* Then, you will be able to log in and change administrator's passwords,  */
  /* and then set initial passwords for your users.                          */
  
  UPDATE TURBINE_USER SET PASSWORD_VALUE = '4vUZ7HvhmiKt/W54Xyuz7oza' WHERE LOGIN_NAME = 'turbine';
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message