Package org.apache.torque.map

Examples of org.apache.torque.map.ColumnMap


                {
                    columnName = strippedColumnName.substring(
                            dotPos + 1,
                            spacePos);
                }
                ColumnMap column = dbMap.getTable(table).getColumn(columnName);
               
                // only ignore case in order by for string columns
                // which do not have a function around them
                if (column.getType() instanceof String
                        && orderByColumn.indexOf('(') == -1)
                {
                    // find space pos relative to orderByColumn
                    spacePos = orderByColumn.indexOf(' ');
                    if (spacePos == -1)
View Full Code Here


        DatabaseMap dbMap = Torque.getDatabaseMap(dbName);
        TableMap tableMap = dbMap.getTable(table);
        Object keyInfo = tableMap.getPrimaryKeyMethodInfo();
        IdGenerator keyGen = tableMap.getIdGenerator();

        ColumnMap pk = getPrimaryKey(criteria);

        // If the keyMethod is SEQUENCE or IDBROKERTABLE, get the id
        // before the insert.
        if (keyGen != null && keyGen.isPriorToInsert())
        {
            // pk will be null if there is no primary key defined for the table
            // we're inserting into.
            if (pk != null && !criteria.containsKey(pk.getFullyQualifiedName()))
            {
                if (keyGen == null)
                {
                    throw new TorqueException(
                            "IdGenerator for table '" + table + "' is null");
                }
               
                id = getId(pk, keyGen, con, keyInfo);
                criteria.add(pk.getFullyQualifiedName(), id);
            }
        }

        // Use Village to perform the insert.
        TableDataSet tds = null;
View Full Code Here

        ColumnMap[] columnMaps = dbMap.getTable(table).getColumns();
        boolean shouldSave = false;
        for (int j = 0; j < columnMaps.length; j++)
        {
            ColumnMap colMap = columnMaps[j];
            String colName = colMap.getColumnName();
            String key = new StringBuffer(colMap.getTableName())
                    .append('.')
                    .append(colName)
                    .toString();
            if (criteria.containsKey(key))
            {
View Full Code Here

    {
        // Assume all the keys are for the same table.
        String key = (String) criteria.keys().nextElement();

        String table = criteria.getTableName(key);
        ColumnMap pk = null;

        if (!table.equals(""))
        {
            DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
            if (dbMap == null)
View Full Code Here

     *         rethrown wrapped into a TorqueException.
     */
    public static void doUpdate(Criteria updateValues, Connection con)
        throws TorqueException
    {
        ColumnMap pk = getPrimaryKey(updateValues);
        Criteria selectCriteria = null;

        if (pk != null && updateValues.containsKey(pk.getFullyQualifiedName()))
        {
            selectCriteria = new Criteria(2);
            selectCriteria.put(pk.getFullyQualifiedName(),
                updateValues.remove(pk.getFullyQualifiedName()));
        }
        else
        {
            throw new TorqueException("No PK specified for database update");
        }
View Full Code Here

            ColumnMap[] columnMaps = dbMap.getTable(table).getColumns();

            for (int j = 0; j < columnMaps.length; j++)
            {
                ColumnMap colMap = columnMaps[j];
                if (colMap.isPrimaryKey())
                {
                    kd.addAttrib(colMap.getColumnName());
                }

                String key = new StringBuffer(colMap.getTableName())
                        .append('.')
                        .append(colMap.getColumnName())
                        .toString();

                if (crit.containsKey(key))
                {
                    if (crit
                            .getComparison(key)
                            .equals(Criteria.CUSTOM))
                    {
                        whereClause.add(crit.getString(key));
                    }
                    else
                    {
                        whereClause.add(
                                SqlExpression.build(
                                        colMap.getColumnName(),
                                        crit.getValue(key),
                                        crit.getComparison(key),
                                        crit.isIgnoreCase(),
                                        db));
                    }
View Full Code Here

        tMap.setJavaName("TurbineRolePermission");
        tMap.setOMClass( org.apache.turbine.services.security.torque.om.TurbineRolePermission.class );
        tMap.setPeerClass( org.apache.turbine.services.security.torque.om.TurbineRolePermissionPeer.class );
        tMap.setPrimaryKeyMethod("none");

        ColumnMap cMap = null;


  // ------------- Column: ROLE_ID --------------------
        cMap = new ColumnMap( "ROLE_ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "RoleId" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setForeignKey("TURBINE_ROLE", "ROLE_ID");
        cMap.setPosition(1);
        tMap.addColumn(cMap);
  // ------------- Column: PERMISSION_ID --------------------
        cMap = new ColumnMap( "PERMISSION_ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "PermissionId" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setForeignKey("TURBINE_PERMISSION", "PERMISSION_ID");
        cMap.setPosition(2);
        tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here

        tMap.setOMClass( org.apache.turbine.services.security.torque.om.TurbineUser.class );
        tMap.setPeerClass( org.apache.turbine.services.security.torque.om.TurbineUserPeer.class );
        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
        tMap.setPrimaryKeyMethodInfo(tMap.getName());

        ColumnMap cMap = null;


  // ------------- Column: USER_ID --------------------
        cMap = new ColumnMap( "USER_ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "UserId" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setPosition(1);
        tMap.addColumn(cMap);
  // ------------- Column: LOGIN_NAME --------------------
        cMap = new ColumnMap( "LOGIN_NAME", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "UserName" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setSize( 64 );
        cMap.setPosition(2);
        tMap.addColumn(cMap);
  // ------------- Column: PASSWORD_VALUE --------------------
        cMap = new ColumnMap( "PASSWORD_VALUE", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Password" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setSize( 16 );
        cMap.setPosition(3);
        tMap.addColumn(cMap);
  // ------------- Column: FIRST_NAME --------------------
        cMap = new ColumnMap( "FIRST_NAME", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "FirstName" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setSize( 64 );
        cMap.setPosition(4);
        tMap.addColumn(cMap);
  // ------------- Column: LAST_NAME --------------------
        cMap = new ColumnMap( "LAST_NAME", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "LastName" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setSize( 64 );
        cMap.setPosition(5);
        tMap.addColumn(cMap);
  // ------------- Column: EMAIL --------------------
        cMap = new ColumnMap( "EMAIL", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(false);
        cMap.setJavaName( "Email" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setSize( 64 );
        cMap.setPosition(6);
        tMap.addColumn(cMap);
  // ------------- Column: CONFIRM_VALUE --------------------
        cMap = new ColumnMap( "CONFIRM_VALUE", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(false);
        cMap.setJavaName( "Confirmed" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setSize( 16 );
        cMap.setPosition(7);
        tMap.addColumn(cMap);
  // ------------- Column: MODIFIED --------------------
        cMap = new ColumnMap( "MODIFIED", tMap);
        cMap.setType( new Date() );
        cMap.setTorqueType( "TIMESTAMP" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(false);
        cMap.setJavaName( "Modified" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setPosition(8);
        tMap.addColumn(cMap);
  // ------------- Column: CREATED --------------------
        cMap = new ColumnMap( "CREATED", tMap);
        cMap.setType( new Date() );
        cMap.setTorqueType( "TIMESTAMP" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(false);
        cMap.setJavaName( "CreateDate" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setPosition(9);
        tMap.addColumn(cMap);
  // ------------- Column: LAST_LOGIN --------------------
        cMap = new ColumnMap( "LAST_LOGIN", tMap);
        cMap.setType( new Date() );
        cMap.setTorqueType( "TIMESTAMP" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(false);
        cMap.setJavaName( "LastLogin" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setPosition(10);
        tMap.addColumn(cMap);
  // ------------- Column: OBJECTDATA --------------------
        cMap = new ColumnMap( "OBJECTDATA", tMap);
        cMap.setType( new Object() );
        cMap.setTorqueType( "VARBINARY" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(false);
        cMap.setJavaName( "Objectdata" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setPosition(11);
        tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here

        tMap.setOMClass( org.apache.turbine.services.security.torque.om.TurbineRole.class );
        tMap.setPeerClass( org.apache.turbine.services.security.torque.om.TurbineRolePeer.class );
        tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
        tMap.setPrimaryKeyMethodInfo(tMap.getName());

        ColumnMap cMap = null;


  // ------------- Column: ROLE_ID --------------------
        cMap = new ColumnMap( "ROLE_ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "RoleId" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setPosition(1);
        tMap.addColumn(cMap);
  // ------------- Column: ROLE_NAME --------------------
        cMap = new ColumnMap( "ROLE_NAME", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Name" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setSize( 64 );
        cMap.setPosition(2);
        tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here

        tMap.setJavaName("TurbineUserGroupRole");
        tMap.setOMClass( org.apache.turbine.services.security.torque.om.TurbineUserGroupRole.class );
        tMap.setPeerClass( org.apache.turbine.services.security.torque.om.TurbineUserGroupRolePeer.class );
        tMap.setPrimaryKeyMethod("none");

        ColumnMap cMap = null;


  // ------------- Column: USER_ID --------------------
        cMap = new ColumnMap( "USER_ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "UserId" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setForeignKey("TURBINE_USER", "USER_ID");
        cMap.setPosition(1);
        tMap.addColumn(cMap);
  // ------------- Column: GROUP_ID --------------------
        cMap = new ColumnMap( "GROUP_ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "GroupId" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setForeignKey("TURBINE_GROUP", "GROUP_ID");
        cMap.setPosition(2);
        tMap.addColumn(cMap);
  // ------------- Column: ROLE_ID --------------------
        cMap = new ColumnMap( "ROLE_ID", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "RoleId" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
        cMap.setInheritance("false");
        cMap.setForeignKey("TURBINE_ROLE", "ROLE_ID");
        cMap.setPosition(3);
        tMap.addColumn(cMap);
        tMap.setUseInheritance(false);
    }
View Full Code Here

TOP

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

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.