Package org.apache.torque.generator.source.transform

Examples of org.apache.torque.generator.source.transform.SourceTransformerException


            }
            String name = (String) databaseElement.getAttribute(
                    TorqueSchemaAttributeName.NAME.getName());
            if (name == null)
            {
                throw new SourceTransformerException("The attribute "
                        + TorqueSchemaAttributeName.NAME.getName()
                        + " on element "
                        + databaseElement.getName()
                        + " is null");
            }
View Full Code Here


        {
            Object inputName = tableElement.getAttribute(
                    TorqueSchemaAttributeName.NAME);
            if (inputName == null)
            {
                throw new SourceTransformerException("The required attribute "
                        + TorqueSchemaAttributeName.NAME
                        + " on element "
                        + tableElement.getName()
                        + " is null");
            }
View Full Code Here

        {
            idMethod = tableElement.getParent().getAttribute(
                    TorqueSchemaAttributeName.DEFAULT_ID_METHOD);
            if (idMethod == null)
            {
                throw new SourceTransformerException("The attribute "
                        + TorqueSchemaAttributeName.DEFAULT_ID_METHOD
                        + " is not set on the database element "
                        + " and no id method is given on table "
                        + tableElement.getName());
            }
View Full Code Here

        }
        else
        {
            if (StringUtils.isBlank(interfaceName))
            {
                throw new SourceTransformerException("The attribute "
                        + TorqueSchemaAttributeName.INTERFACE
                        + " is blank on table "
                        + tableElement.getName());
            }
            int dotPosition = interfaceName.lastIndexOf(".");
            if (dotPosition != -1)
            {
                interfaceName = interfaceName.substring(dotPosition + 1);
            }
            if (StringUtils.isBlank(interfaceName))
            {
                throw new SourceTransformerException("The attribute "
                        + TorqueSchemaAttributeName.INTERFACE
                        + " ends with a dot on table "
                        + tableElement.getName());
            }
View Full Code Here

                    columnElement.getAttribute(
                        TorqueSchemaAttributeName.INHERITANCE)))
            {
                if (inheritanceFound)
                {
                    throw new SourceTransformerException(
                            "more than one column with "
                                + TorqueSchemaAttributeName.INHERITANCE
                                + " set to \"single\" found in table "
                                + tableElement.getAttribute(
                                        tableElement.getName()));
View Full Code Here

                                database,
                                foreignTableName,
                                true);
                        if (foreignTable == null)
                        {
                            throw new SourceTransformerException(
                                    "Foreign table with name "
                                    + foreignTableName
                                    + " not found for a foreignKey of table "
                                    + localTableName);
                        }
                        SourceElement foreignColumn = FindHelper.findColumn(
                                foreignTable,
                                foreignColumnName);
                        if (foreignColumn == null)
                        {
                            throw new SourceTransformerException(
                                    "Referenced Column with table name "
                                    + foreignTableName
                                    + " and column name "
                                    + foreignColumnName
                                    + " not found for a foreignKey of table "
                                    + localTableName);
                        }
                        referencedColumn.getChildren().add(foreignColumn);
                        column.getChildren().add(referencedColumn);
                        break;
                    }
                }
            }
        }

        //create the referencing-column elements
        List<SourceElement> allTables
                = database.getChildren(TorqueSchemaElementName.TABLE.getName());
        for (SourceElement foreignTable : allTables)
        {
            String foreignTableName
                    = (String) foreignTable.getAttribute(
                            TorqueSchemaAttributeName.NAME);
            List<SourceElement> foreignKeys
                    = foreignTable.getChildren(
                        TorqueSchemaElementName.FOREIGN_KEY.getName());
            for (SourceElement foreignKey : foreignKeys)
            {
                if (!localTableName.equals(foreignKey.getAttribute(
                        TorqueSchemaAttributeName.FOREIGN_TABLE)))
                {
                    continue;
                }
                List<SourceElement> references
                        = foreignKey.getChildren(
                            TorqueSchemaElementName.REFERENCE.getName());
                for (SourceElement reference : references)
                {
                    Object referenceForeignColumnName
                            = reference.getAttribute(
                                    TorqueSchemaAttributeName.FOREIGN);
                    String referenceLocalColumnName
                            = (String) reference.getAttribute(
                                    TorqueSchemaAttributeName.LOCAL);
                    if (localColumnName.equals(referenceForeignColumnName))
                    {
                        SourceElement referencingColumn
                                = new SourceElement(
                                        ColumnChildElementName.REFERENCING_COLUMN);
                        referencingColumn.getChildren().add(foreignKey);
                        referencingColumn.getChildren().add(foreignTable);
                        SourceElement localColumn = FindHelper.findColumn(
                                foreignTable,
                                referenceLocalColumnName);
                        if (localColumn == null)
                        {
                            throw new SourceTransformerException(
                                    "Local Column with column name "
                                    + referenceLocalColumnName
                                    + " not found in one of the foreignKeys"
                                    + " of table "
                                    + foreignTableName);
View Full Code Here

TOP

Related Classes of org.apache.torque.generator.source.transform.SourceTransformerException

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.