Package org.jboss.dna.common.jdbc.model.api

Examples of org.jboss.dna.common.jdbc.model.api.TableColumn


    /**
     * test SetSourceColumn
     */
    public void testSetSourceColumn() {
        // create source column
        TableColumn sourceColumn = new DefaultModelFactory().createTableColumn();
        // set
        bean.setSourceColumn(sourceColumn);
        // check that it was really set
        assertSame("Unable to set source column", sourceColumn, bean.getSourceColumn());
    }
View Full Code Here


    }

    public void testAddColumn() {
        String COLUMN_NAME = "My column";
        // create column
        TableColumn column = factory.createTableColumn();
        // set name
        column.setName(COLUMN_NAME);
        // add
        bean.addColumn(column);
        // check
        assertFalse("column set should not be empty", bean.getColumns().isEmpty());
    }
View Full Code Here

    }

    public void testDeleteColumn() {
        String COLUMN_NAME = "My column";
        // create column
        TableColumn column = factory.createTableColumn();
        // set name
        column.setName(COLUMN_NAME);
        // add
        bean.addColumn(column);
        // check
        assertFalse("column set should not be empty", bean.getColumns().isEmpty());
View Full Code Here

    }

    public void testFindColumnByName() {
        String COLUMN_NAME = "My column";
        // create column
        TableColumn column = factory.createTableColumn();
        // set name
        column.setName(COLUMN_NAME);
        // add
        bean.addColumn(column);
        // check
        assertFalse("column set should not be empty", bean.getColumns().isEmpty());
        // check
View Full Code Here

    }

    public void testAddVersionColumn() {
        String COLUMN_NAME = "My column";
        // create column
        TableColumn column = factory.createTableColumn();
        // set name
        column.setName(COLUMN_NAME);
        // add
        bean.addVersionColumn(column);
        // check
        assertFalse("column set should not be empty", bean.getVersionColumns().isEmpty());
    }
View Full Code Here

    }

    public void testDeleteVersionColumn() {
        String COLUMN_NAME = "My column";
        // create column
        TableColumn column = factory.createTableColumn();
        // set name
        column.setName(COLUMN_NAME);
        // add
        bean.addVersionColumn(column);
        // check
        assertFalse("column set should not be empty", bean.getVersionColumns().isEmpty());
View Full Code Here

    }

    public void testFindVersionColumnByName() {
        String COLUMN_NAME = "My column";
        // create column
        TableColumn column = factory.createTableColumn();
        // set name
        column.setName(COLUMN_NAME);
        // add
        bean.addVersionColumn(column);
        // check
        assertFalse("column set should not be empty", bean.getVersionColumns().isEmpty());
        // check
View Full Code Here

        String scopeTable = getString(resultSet, "SCOPE_TABLE", false);
        // sourceDataType
        Integer sourceDataType = getInteger(resultSet, "SOURCE_DATA_TYPE", false);

        // create table column object
        TableColumn column = factory.createTableColumn();

        // ***************************************
        // *** DatabaseNamedObject properties ***
        // ***************************************

        // name
        column.setName(columnName);
        // remarks
        column.setRemarks(remarks);
        // TODO set extra properties
        // column.addExtraProperty (String key, Object value);

        // ***************
        // *** Column ***
        // ***************

        // owner
        column.setOwner(table);
        // nullability. The isNullableString is not used so far
        column.setNullabilityType(getNullabilityType(nullableType));
        // SQL type
        column.setSqlType(getSqlType(dataType));
        // type name
        column.setTypeName(typeName);
        // Size
        column.setSize(size);
        // precision
        column.setPrecision(precision);
        // Radix
        column.setRadix(radix);
        // DefaultValue
        column.setDefaultValue(defaultValue);
        // OrdinalPosition
        column.setOrdinalPosition(ordinalPosition);
        // CharOctetLength
        column.setCharOctetLength(charOctetLength);
        // addPrivilege
        // column.addPrivilege (privilege); //

        // ********************
        // *** Table Column ***
        // ********************

        // pseudo type
        column.setPseudoType(ColumnPseudoType.NOT_PSEUDO);

        // set reference
        if ((scopeCatalog != null) || (scopeSchema != null) || (scopeTable != null) || (sourceDataType != null)) {
            // create reference
            Reference reference = factory.createReference();
            // set Source Data Type
            reference.setSourceDataType(getSqlType(sourceDataType));
            // find table and set as source
            reference.setSourceTable(database.findTableByName(scopeCatalog, scopeSchema, scopeTable));

            // set reference
            column.setReference(reference);
        }

        // add column to the table
        table.addColumn(column);

View Full Code Here

        brId.setScopeType(scopeType);

        // determine if current record shows pseudo column
        boolean isPseudoColumn = ((getColumnPseudoType(pseudoColumn) != null) && (getColumnPseudoType(pseudoColumn) == ColumnPseudoType.PSEUDO));

        TableColumn column = null;

        if (isPseudoColumn) {
            // create
            column = factory.createTableColumn();

            // ***************************************
            // *** DatabaseNamedObject properties ***
            // ***************************************

            // name
            column.setName(columnName);
            // remarks
            // column.setRemarks (remarks); // N/A
            // TODO set extra properties
            // column.addExtraProperty (String key, Object value);

            // ***************
            // *** Column ***
            // ***************

            // owner
            column.setOwner(table);
            // SQL type
            column.setSqlType(getSqlType(dataType));
            // type name
            column.setTypeName(typeName);
            // precision
            column.setPrecision(precision);
            // size
            column.setSize(precision);
            // scale
            column.setRadix(scale);
            // pseudo type
            column.setPseudoType(getColumnPseudoType(pseudoColumn));
            // add to the table
            table.addColumn(column);
        } else {
            // trying to find column
            column = table.findColumnByName(columnName);

            // if column exists
            if (column != null) {
                // pseudo type
                column.setPseudoType(getColumnPseudoType(pseudoColumn));
            }
        }

        // if column exists
        if (column != null) {
View Full Code Here

            String columnName = getString(resultSet, "COLUMN_NAME", false);
            // sequence number within primary key
            Integer ordinalPosition = getInteger(resultSet, "KEY_SEQ", false);

            // trying to find table column with specified name
            TableColumn tableColumn = table.findColumnByName(columnName);

            String errMessage = null;
            // warn if null
            if (tableColumn == null) {
                errMessage = String.format("[Database %s] Unable to find table column '%5$s' for the table %s (schema %s, catalog %s)",
                                           database.getName(),
                                           tableName,
                                           schemaName,
                                           catalogName,
                                           columnName);
                traceLog.debug(errMessage);
            }
            // if fail is enabled
            if (failOnError && (tableColumn == null)) {
                throw new DatabaseMetaDataMethodException(errMessage, "populatePrimaryKey");
            }

            // create PK column
            PrimaryKeyColumn pkColumn = factory.createPrimaryKeyColumn();
            // check if we found the original table column
            if (tableColumn != null) {
                // mark original table column as part of PK
                tableColumn.setPrimaryKeyColumn(Boolean.TRUE);
                // clone properties from original table column to the pkcolumn
                PropertyUtils.copyProperties(pkColumn, tableColumn);
            } else { // recovery if table column is not found but we still want to create pk column
                // set name at least
                pkColumn.setName(columnName);
View Full Code Here

TOP

Related Classes of org.jboss.dna.common.jdbc.model.api.TableColumn

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.