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

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


        assertTrue("Attribute set should be empty by default", attributes.isEmpty());
    }

    public void testAddAttribute() {
        String NAME = "My name";
        Attribute a = new DefaultModelFactory().createAttribute();
        // set name
        a.setName(NAME);
        // add
        bean.addAttribute(a);
        // check
        assertFalse("Attribute set should not be empty", bean.getAttributes().isEmpty());
    }
View Full Code Here


        assertFalse("Attribute set should not be empty", bean.getAttributes().isEmpty());
    }

    public void testDeleteAttribute() {
        String NAME = "My name";
        Attribute a = new DefaultModelFactory().createAttribute();
        // set name
        a.setName(NAME);
        // add
        bean.addAttribute(a);
        // check
        assertFalse("Attribute set should not be empty", bean.getAttributes().isEmpty());
        // delete
View Full Code Here

        assertTrue("Attribute set should be empty", bean.getAttributes().isEmpty());
    }

    public void testFindAttributeByName() {
        String NAME = "My name";
        Attribute a = new DefaultModelFactory().createAttribute();
        // set name
        a.setName(NAME);
        // add
        bean.addAttribute(a);
        // check
        assertSame("Unable to find attribute", a, bean.findAttributeByName(NAME));
    }
View Full Code Here

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

        // create UDT attribute object
        Attribute column = factory.createAttribute();

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

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

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

        // owner
        column.setOwner(udt);
        // 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); //

        // ********************
        // *** Attribute ***
        // ********************

        // 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 attribute to the UDT
        udt.addAttribute(column);

View Full Code Here

TOP

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

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.