Package org.jboss.as.cmp.jdbc.metadata

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCCMPFieldPropertyMetaData


    }


    private static JDBCCMPFieldPropertyMetaData parseProperty(final XMLStreamReader reader) throws XMLStreamException {

        final JDBCCMPFieldPropertyMetaData metaData = new JDBCCMPFieldPropertyMetaData();
        for (Element element : children(reader)) {
            switch (element) {
                case PROPERTY_NAME: {
                    metaData.setPropertyName(getElementText(reader));
                    break;
                }
                case COLUMN_NAME: {
                    metaData.setColumnName(getElementText(reader));
                    break;
                }
                case NOT_NULL: {
                    metaData.setNotNul(Boolean.parseBoolean(getElementText(reader)));
                    break;
                }
                case JDBC_TYPE: {
                    metaData.setJdbcType(getJdbcTypeFromName(getElementText(reader)));
                    break;
                }
                case SQL_TYPE: {
                    metaData.setSqlType(getElementText(reader));
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
View Full Code Here


    }


    private static JDBCCMPFieldPropertyMetaData parseProperty(final XMLStreamReader reader) throws XMLStreamException {

        final JDBCCMPFieldPropertyMetaData metaData = new JDBCCMPFieldPropertyMetaData();
        for (Element element : children(reader)) {
            switch (element) {
                case PROPERTY_NAME: {
                    metaData.setPropertyName(getElementText(reader));
                    break;
                }
                case COLUMN_NAME: {
                    metaData.setColumnName(getElementText(reader));
                    break;
                }
                case NOT_NULL: {
                    metaData.setNotNul(Boolean.parseBoolean(getElementText(reader)));
                    break;
                }
                case JDBC_TYPE: {
                    metaData.setJdbcType(getJdbcTypeFromName(getElementText(reader)));
                    break;
                }
                case SQL_TYPE: {
                    metaData.setSqlType(getElementText(reader));
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
View Full Code Here

        // create a map of the overrides based on flat property name
        HashMap overrides = new HashMap();

        for (int i = 0; i < cmpField.getPropertyOverrides().size(); ++i) {
            JDBCCMPFieldPropertyMetaData p = (JDBCCMPFieldPropertyMetaData) cmpField.getPropertyOverrides().get(i);
            overrides.put(p.getPropertyName(), p);
        }

        // array that will hold the final properites after overrides
        JDBCTypeComplexProperty[] finalProperties = new JDBCTypeComplexProperty[defaultProperties.length];

        // override property default values
        for (int i = 0; i < defaultProperties.length; i++) {
            // pop off the override, if present
            JDBCCMPFieldPropertyMetaData override;
            override = (JDBCCMPFieldPropertyMetaData) overrides.remove(defaultProperties[i].getPropertyName());

            if (override == null) {
                finalProperties[i] = defaultProperties[i];
                finalProperties[i] = new JDBCTypeComplexProperty(
                        defaultProperties[i],
                        cmpField.getColumnName() + "_" +
                                defaultProperties[i].getColumnName(),
                        defaultProperties[i].getJDBCType(),
                        defaultProperties[i].getSQLType(),
                        cmpField.isNotNull() || defaultProperties[i].isNotNull());
            } else {
                // columnName
                String columnName = override.getColumnName();
                if (columnName == null) {
                    columnName = cmpField.getColumnName() + "_" + defaultProperties[i].getColumnName();
                }

                // sql and jdbc type
                String sqlType = override.getSQLType();
                int jdbcType;
                if (sqlType != null) {
                    jdbcType = override.getJDBCType();
                } else {
                    sqlType = defaultProperties[i].getSQLType();
                    jdbcType = defaultProperties[i].getJDBCType();
                }

                boolean notNull = cmpField.isNotNull() ||
                        override.isNotNull() ||
                        defaultProperties[i].isNotNull();

                finalProperties[i] = new JDBCTypeComplexProperty(
                        defaultProperties[i],
                        columnName,
View Full Code Here

    }


    private static JDBCCMPFieldPropertyMetaData parseProperty(final XMLStreamReader reader) throws XMLStreamException {

        final JDBCCMPFieldPropertyMetaData metaData = new JDBCCMPFieldPropertyMetaData();
        for (Element element : children(reader)) {
            switch (element) {
                case PROPERTY_NAME: {
                    metaData.setPropertyName(getElementText(reader));
                    break;
                }
                case COLUMN_NAME: {
                    metaData.setColumnName(getElementText(reader));
                    break;
                }
                case NOT_NULL: {
                    metaData.setNotNull(Boolean.parseBoolean(getElementText(reader)));
                    break;
                }
                case JDBC_TYPE: {
                    metaData.setJdbcType(getJdbcTypeFromName(getElementText(reader)));
                    break;
                }
                case SQL_TYPE: {
                    metaData.setSqlType(getElementText(reader));
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
View Full Code Here

        // create a map of the overrides based on flat property name
        HashMap overrides = new HashMap();

        for (int i = 0; i < cmpField.getPropertyOverrides().size(); ++i) {
            JDBCCMPFieldPropertyMetaData p = (JDBCCMPFieldPropertyMetaData) cmpField.getPropertyOverrides().get(i);
            overrides.put(p.getPropertyName(), p);
        }

        // array that will hold the final properties after overrides
        JDBCTypeComplexProperty[] finalProperties = new JDBCTypeComplexProperty[defaultProperties.length];

        // override property default values
        for (int i = 0; i < defaultProperties.length; i++) {
            // pop off the override, if present
            JDBCCMPFieldPropertyMetaData override;
            override = (JDBCCMPFieldPropertyMetaData) overrides.remove(defaultProperties[i].getPropertyName());

            if (override == null) {
                finalProperties[i] = defaultProperties[i];
                finalProperties[i] = new JDBCTypeComplexProperty(
                        defaultProperties[i],
                        cmpField.getColumnName() + "_" +
                                defaultProperties[i].getColumnName(),
                        defaultProperties[i].getJDBCType(),
                        defaultProperties[i].getSQLType(),
                        cmpField.isNotNull() || defaultProperties[i].isNotNull());
            } else {
                // columnName
                String columnName = override.getColumnName();
                if (columnName == null) {
                    columnName = cmpField.getColumnName() + "_" + defaultProperties[i].getColumnName();
                }

                // sql and jdbc type
                String sqlType = override.getSQLType();
                int jdbcType;
                if (sqlType != null) {
                    jdbcType = override.getJDBCType();
                } else {
                    sqlType = defaultProperties[i].getSQLType();
                    jdbcType = defaultProperties[i].getJDBCType();
                }

                boolean notNull = cmpField.isNotNull() ||
                        override.isNotNull() ||
                        defaultProperties[i].isNotNull();

                finalProperties[i] = new JDBCTypeComplexProperty(
                        defaultProperties[i],
                        columnName,
View Full Code Here

TOP

Related Classes of org.jboss.as.cmp.jdbc.metadata.JDBCCMPFieldPropertyMetaData

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.