head	1.2;
access;
symbols
	TIGRIS_1_1_0RC2:1.1
	TIGRIS_1_1_0RC1:1.1
	TIGRIS_1_1:1.1.0.4
	TIGRIS_1_0_8:1.1
	TIGRIS_1_0_8RC3:1.1
	TIGRIS_1_0_8RC2:1.1
	TIGRIS_1_0_8RC1:1.1
	TIGRIS_1_0_7:1.1
	TIGRIS_1_0_7RC3:1.1
	TIGRIS_1_0_7RC2:1.1
	TIGRIS_1_0_7RC1:1.1
	TIGRIS_1_0_6:1.1
	TIGRIS_1_0_6RC5:1.1
	TIGRIS_1_0_6RC4:1.1
	TIGRIS_1_0_6RC3:1.1
	TIGRIS_1_0_6RC2:1.1
	TIGRIS_1_0_6RC1:1.1
	TIGRIS_1_0_5:1.1
	TIGRIS_1_0_5RC6:1.1
	TIGRIS_1_0_5RC5:1.1
	TIGRIS_1_0_5RC4:1.1
	TIGRIS_1_0_5RC3:1.1
	TIGRIS_1_0_5RC2:1.1
	TIGRIS_1_0_5RC1:1.1
	TIGRIS_1_0_4:1.1
	TIGRIS_1_0_3:1.1
	TIGRIS_1_0_2:1.1
	TIGRIS_1_0_1:1.1
	TIGRIS_1_0:1.1.0.6
	TIGRIS_1_0_0:1.1
	TIGRIS_1_0_0_RC1:1.1.0.2;
locks; strict;
comment	@# @;


1.2
date	2001.08.11.09.08.13;	author dlr;	state dead;
branches;
next	1.1;

1.1
date	2001.02.27.01.45.46;	author lucas;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@package ${package}.map;

// JDK classes
import java.util.*;
import java.math.*;

// Turbine classes
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;

/**
  *  This class was autogenerated by Torque on: 
  *
  * [$now]
  *
  */
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 == "autoincrement")
        tMap.setPrimaryKeyMethod(TableMap.AUTOINCREMENT);
#elseif ($table.IdMethod == "sequence")
        tMap.setPrimaryKeyMethod(TableMap.SEQUENCE);
#elseif ($table.IdMethod == "none")
        tMap.setPrimaryKeyMethod(TableMap.NONE);
#else
        tMap.setPrimaryKeyMethod(TableMap.IDBROKERTABLE);
#end

#if ($table.IdMethodParameters)
        // this might need upgrading based on what all the databases
        // need, but for now assume one parameter.
    #set ($imp = $table.IdMethodParameters.firstElement() )
        tMap.setPrimaryKeyMethodInfo("$imp.Value");
#elseif ($table.IdMethod == "idbroker")
        tMap.setPrimaryKeyMethodInfo(tMap.getName());
#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
log
@Added the ability for torque to be called from within the Helm build procedure.  The only major restructure is that the helm-schema.xml file will now live in the sql/schema directory instead of sql/org/tigris/helm.
@
text
@@

