Package org.apache.torque.map

Examples of org.apache.torque.map.TableMap


            return;
        }
        dbMap = Torque.getDatabaseMap("OSLCM");

        dbMap.addTable("OSLCM_ROLES");
        TableMap tMap = dbMap.getTable("OSLCM_ROLES");
        tMap.setJavaName("Role");
        tMap.setOMClass( org.oslcm.om.Role.class );
        tMap.setPeerClass( org.oslcm.om.RolePeer.class );
        tMap.setPrimaryKeyMethod("none");

        ColumnMap cMap = null;


    // ------------- Column: ID_ROL --------------------
        cMap = new ColumnMap( "ID_ROL", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "IdRol" );
        cMap.setAutoIncrement(true);
        cMap.setProtected(false);
                cMap.setInheritance("false");
                    cMap.setPosition(1);
          tMap.addColumn(cMap);
    // ------------- Column: NAME --------------------
        cMap = new ColumnMap( "NAME", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "CHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Name" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
            cMap.setDescription("Rol");
              cMap.setInheritance("false");
                cMap.setSize( 30 );
                  cMap.setPosition(2);
          tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here


            return;
        }
        dbMap = Torque.getDatabaseMap("OSLCM");

        dbMap.addTable("OSLCM_REV_ENV");
        TableMap tMap = dbMap.getTable("OSLCM_REV_ENV");
        tMap.setJavaName("Revenv");
        tMap.setOMClass( org.oslcm.om.Revenv.class );
        tMap.setPeerClass( org.oslcm.om.RevenvPeer.class );
        tMap.setPrimaryKeyMethod("none");

        ColumnMap cMap = null;


    // ------------- Column: ID --------------------
        cMap = new ColumnMap( "ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "Id" );
        cMap.setAutoIncrement(true);
        cMap.setProtected(false);
                cMap.setInheritance("false");
                    cMap.setPosition(1);
          tMap.addColumn(cMap);
    // ------------- Column: ID_REVISION --------------------
        cMap = new ColumnMap( "ID_REVISION", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "IdRevision" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
                cMap.setInheritance("false");
                  cMap.setForeignKey("OSLCM_REVISIONS", "ID_REVISION");
            cMap.setPosition(2);
          tMap.addColumn(cMap);
    // ------------- Column: ID_ENVIRONMENT --------------------
        cMap = new ColumnMap( "ID_ENVIRONMENT", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "IdEnvironment" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
                cMap.setInheritance("false");
                  cMap.setForeignKey("OSLCM_ENVIRONMENTS", "ID_ENVIRONMENT");
            cMap.setPosition(3);
          tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here

            return;
        }
        dbMap = Torque.getDatabaseMap("OSLCM");

        dbMap.addTable("OSLCM_ROL_URS");
        TableMap tMap = dbMap.getTable("OSLCM_ROL_URS");
        tMap.setJavaName("RolesUser");
        tMap.setOMClass( org.oslcm.om.RolesUser.class );
        tMap.setPeerClass( org.oslcm.om.RolesUserPeer.class );
        tMap.setPrimaryKeyMethod("none");

        ColumnMap cMap = null;


    // ------------- Column: ID --------------------
        cMap = new ColumnMap( "ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "Id" );
        cMap.setAutoIncrement(true);
        cMap.setProtected(false);
                cMap.setInheritance("false");
                    cMap.setPosition(1);
          tMap.addColumn(cMap);
    // ------------- Column: ID_USER --------------------
        cMap = new ColumnMap( "ID_USER", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "IdUser" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
                cMap.setInheritance("false");
                  cMap.setForeignKey("OSLCM_USERS", "ID_USER");
            cMap.setPosition(2);
          tMap.addColumn(cMap);
    // ------------- Column: ID_ROL --------------------
        cMap = new ColumnMap( "ID_ROL", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "IdRol" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
                cMap.setInheritance("false");
                  cMap.setForeignKey("OSLCM_ROLES", "ID_ROL");
            cMap.setPosition(3);
          tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here

            return;
        }
        dbMap = Torque.getDatabaseMap("OSLCM");

        dbMap.addTable("OSLCM_ENVIRONMENTS");
        TableMap tMap = dbMap.getTable("OSLCM_ENVIRONMENTS");
        tMap.setJavaName("Environment");
        tMap.setOMClass( org.oslcm.om.Environment.class );
        tMap.setPeerClass( org.oslcm.om.EnvironmentPeer.class );
        tMap.setDescription("Entornos");
        tMap.setPrimaryKeyMethod("none");

        ColumnMap cMap = null;


    // ------------- Column: ID_ENVIRONMENT --------------------
        cMap = new ColumnMap( "ID_ENVIRONMENT", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "IdEnvironment" );
        cMap.setAutoIncrement(true);
        cMap.setProtected(false);
            cMap.setDescription("Codigo unico del entorno");
              cMap.setInheritance("false");
                    cMap.setPosition(1);
          tMap.addColumn(cMap);
    // ------------- Column: TYPE --------------------
        cMap = new ColumnMap( "TYPE", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Type" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
            cMap.setDescription("Typo de entorno");
              cMap.setInheritance("false");
                    cMap.setPosition(2);
          tMap.addColumn(cMap);
    // ------------- Column: DESCRIPTION --------------------
        cMap = new ColumnMap( "DESCRIPTION", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Description" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
            cMap.setDescription("La descripcion");
              cMap.setInheritance("false");
                cMap.setSize( 150 );
                  cMap.setPosition(3);
          tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here

     */
    public void doBuild()
            throws Exception
    {
        // Reusable TableMap
        TableMap tMap;

        // Make some objects.
        String string = new String("");
        Integer integer = new Integer(0);
        java.util.Date date = new Date();

        // Get default map.
        dbMap = Torque.getDatabaseMap();

        // Add tables.
        dbMap.addTable(getTableUser());
        dbMap.addTable(getTableGroup());
        dbMap.addTable(getTableRole());
        dbMap.addTable(getTablePermission());
        dbMap.addTable(getTableUserGroupRole());
        dbMap.addTable(getTableRolePermission());

        // Add User columns.
        tMap = dbMap.getTable(getTableUser());
        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
        tMap.setPrimaryKeyMethodInfo(tMap.getName());
        tMap.addPrimaryKey(getUserId(), integer);
        tMap.addColumn(getUsername(), string);
        tMap.addColumn(getPassword(), string);
        tMap.addColumn(getFirstName(), string);
        tMap.addColumn(getLastName(), string);
        tMap.addColumn(getEmail(), string);
        tMap.addColumn(getConfirmValue(), string);
        tMap.addColumn(getCreated(), date);
        tMap.addColumn(getModified(), date);
        tMap.addColumn(getLastLogin(), date);
        tMap.addColumn(getObjectData(), new Hashtable(1));

        // Add Group columns.
        tMap = dbMap.getTable(getTableGroup());
        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
        tMap.setPrimaryKeyMethodInfo(tMap.getName());
        tMap.addPrimaryKey(getGroupId(), integer);
        tMap.addColumn(getGroupName(), string);
        tMap.addColumn(getObjectData(), new Hashtable(1));

        // Add Role columns.
        tMap = dbMap.getTable(getTableRole());
        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
        tMap.setPrimaryKeyMethodInfo(tMap.getName());
        tMap.addPrimaryKey(getRoleId(), integer);
        tMap.addColumn(getRoleName(), string);
        tMap.addColumn(getObjectData(), new Hashtable(1));

        // Add Permission columns.
        tMap = dbMap.getTable(getTablePermission());
        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
        tMap.setPrimaryKeyMethodInfo(tMap.getName());
        tMap.addPrimaryKey(getPermissionId(), integer);
        tMap.addColumn(getPermissionName(), string);
        tMap.addColumn(getObjectData(), new Hashtable(1));

        // Add RolePermission columns.
        tMap = dbMap.getTable(getTableRolePermission());
        tMap.addForeignPrimaryKey(getPermissionId(),
                integer,
                getTablePermission(),
                getPermissionId());
        tMap.addForeignPrimaryKey(getRoleId(),
                integer,
                getTableRole(),
                getRoleId());

        // Add UserGroupRole columns.
        tMap = dbMap.getTable(getTableUserGroupRole());
        tMap.addForeignPrimaryKey(getUserId(),
                integer,
                getTableUser(),
                getUserId());
        tMap.addForeignPrimaryKey(getGroupId(),
                integer,
                getTableGroup(),
                getGroupId());
        tMap.addForeignPrimaryKey(getRoleId(),
                integer,
                getTableRole(),
                getRoleId());
    }
View Full Code Here

     *
     * @param tableName The name for the ID table.
     */
    public void setIdTable(String tableName)
    {
        TableMap tmap = new TableMap(tableName, getDatabaseMap());
        setIdTable(tmap);
    }
View Full Code Here

        if (idBroker != null)
        {
            return false;
        }
        setIdTable("ID_TABLE");
        TableMap tMap = getIdTable();
        ColumnMap idTableId = new ColumnMap("QUANTITY", tMap);
        idTableId.setType(Integer.valueOf(0));
        idTableId.setPrimaryKey(true);
        tMap.addColumn(idTableId);
        ColumnMap tableName = new ColumnMap("TABLE_NAME", tMap);
        tableName.setType("");
        tMap.addColumn(tableName);
        ColumnMap nextId = new ColumnMap("NEXT_ID", tMap);
        nextId.setType(Integer.valueOf(0));
        tMap.addColumn(nextId);
        ColumnMap quantity = new ColumnMap("QUANTITY", tMap);
        quantity.setType(Integer.valueOf(0));
        tMap.addColumn(quantity);
        idBroker = new IDBroker(this);
        addIdGenerator(IDMethod.ID_BROKER, idBroker);
        return true;
    }
View Full Code Here

                    column,
                    criteria);
            ColumnMap columnMap = null;
            {
                DatabaseMap databaseMap = database.getDatabaseMap();
                TableMap tableMap = databaseMap.getTable(
                        databaseColumn.getTableName());
                if (tableMap != null)
                {
                    columnMap = tableMap.getColumn(
                            databaseColumn.getColumnName());
                }
            }
            if (columnMap != null)
            {
View Full Code Here

            throw new TorqueException("Could not find database map"
                    + " for database "
                    + dbName);
        }
        String unqualifiedTableName = getUnqualifiedName(tableName, dbName);
        TableMap result = databaseMap.getTable(unqualifiedTableName);
        if (result == null)
        {
            throw new TorqueException("Could not find table "
                    + tableName
                    + " in database map of database "
View Full Code Here

                column,
                criteria);
        ColumnMap columnMap = null;
        {
            DatabaseMap databaseMap = database.getDatabaseMap();
            TableMap tableMap = databaseMap.getTable(
                    databaseColumn.getTableName());
            if (tableMap != null)
            {
                columnMap = tableMap.getColumn(
                        databaseColumn.getColumnName());
            }
        }
        if (columnMap == null)
        {
View Full Code Here

TOP

Related Classes of org.apache.torque.map.TableMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.