Package org.apache.torque.map

Examples of org.apache.torque.map.ColumnMap


                {
                    columnName = orderByColumn.substring(
                            orderByColumn.indexOf('.') + 1,
                            spacePos);
                }
                ColumnMap column = dbMap.getTable(table).getColumn(columnName);
                if (column.getType() instanceof String)
                {
                    if (spacePos == -1)
                    {
                        orderByClause.add(
                            db.ignoreCaseInOrderBy(orderByColumn));
View Full Code Here


                {
                    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

        TableMap tableMap = dbMap.getTable(table);
        Object keyInfo = tableMap.getPrimaryKeyMethodInfo();
        IdGenerator keyGen
                = database.getIdGenerator(tableMap.getPrimaryKeyMethod());

        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()))
            {
                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

            {
                // no description of table available, do not modify anything
                continue;
            }

            ColumnMap columnMap = tableMap.getColumn(columnName);
            if (columnMap != null)
            {
                if ("BOOLEANINT".equals(columnMap.getTorqueType()))
                {
                    Criteria.Criterion criterion = criteria.getCriterion(key);
                    replaceBooleanValues(
                            criterion,
                            new Integer(1),
                            new Integer(0));
                }
                else if ("BOOLEANCHAR".equals(columnMap.getTorqueType()))
                {
                    Criteria.Criterion criterion = criteria.getCriterion(key);
                    replaceBooleanValues(criterion, "Y", "N");
                 }
            }
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

        DatabaseMap dbMap = Torque.getDatabaseMap(Torque.getDefaultDB());

        TableMap tableMap = new TableMap("AUTHOR", dbMap);
        dbMap.addTable(tableMap);

        ColumnMap columnMap = new ColumnMap("NAME", tableMap);
        columnMap.setType("");
        tableMap.addColumn(columnMap);

        columnMap = new ColumnMap("AUTHOR_ID", tableMap);
        columnMap.setType(new Integer(0));
        tableMap.addColumn(columnMap);

        // check that alias'ed tables are referenced by their alias
        // name when added to the select clause.
        Criteria criteria = new Criteria();
View Full Code Here

        tMap.setOMClass( org.oslcm.om.Repository.class );
        tMap.setPeerClass( org.oslcm.om.RepositoryPeer.class );
        tMap.setDescription("Tabla repositorios");
        tMap.setPrimaryKeyMethod("none");

        ColumnMap cMap = null;


    // ------------- Column: ID_REPOSITORY --------------------
        cMap = new ColumnMap( "ID_REPOSITORY", tMap);
        cMap.setType( new Integer(0) );
        cMap.setTorqueType( "INTEGER" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(true);
        cMap.setNotNull(true);
        cMap.setJavaName( "IdRepository" );
        cMap.setAutoIncrement(true);
        cMap.setProtected(false);
            cMap.setDescription("Codigo unico repositorio");
              cMap.setInheritance("false");
                    cMap.setPosition(1);
          tMap.addColumn(cMap);
    // ------------- Column: TYPE --------------------
        cMap = new ColumnMap( "TYPE", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "CHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Type" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
            cMap.setDescription("Tipo de repositorio: CV => CVS, SV => Subversion");
              cMap.setInheritance("false");
                cMap.setSize( 2 );
                  cMap.setPosition(2);
          tMap.addColumn(cMap);
    // ------------- Column: USER --------------------
        cMap = new ColumnMap( "USER", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "User" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
            cMap.setDescription("Usuario con permisos rw para conectarse al repositorio");
              cMap.setInheritance("false");
                cMap.setSize( 15 );
                  cMap.setPosition(3);
          tMap.addColumn(cMap);
    // ------------- Column: PASSWORD --------------------
        cMap = new ColumnMap( "PASSWORD", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "CHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Password" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
            cMap.setDescription("Contrase�a para la conexion al repositorio");
              cMap.setInheritance("false");
                cMap.setSize( 50 );
                  cMap.setPosition(4);
          tMap.addColumn(cMap);
    // ------------- Column: URL --------------------
        cMap = new ColumnMap( "URL", tMap);
        cMap.setType( "" );
        cMap.setTorqueType( "VARCHAR" );
        cMap.setUsePrimitive(true);
        cMap.setPrimaryKey(false);
        cMap.setNotNull(true);
        cMap.setJavaName( "Url" );
        cMap.setAutoIncrement(false);
        cMap.setProtected(false);
            cMap.setDescription("Url para la conexion al reposotiro");
              cMap.setInheritance("false");
                cMap.setSize( 200 );
                  cMap.setPosition(5);
          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.