Package org.castor.ddlgen

Examples of org.castor.ddlgen.GeneratorException


     */
    public final void merge(final ForeignKey fk) throws GeneratorException {
        if (fk == null) {
            String msg = "Foreign key to merge is missing.";
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (!equals(getName(), fk.getName())) {
            String msg = "Name of foreign key differs from: " + getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (!equals(getTable(), fk.getTable())) {
            String msg = "Table of foreign key differs from: " + getTable().getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (getFieldCount() != fk.getFieldCount()) {
            String msg = "Field count of foreign key differs from: " + getFieldCount();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        for (int i = 0; i < getFieldCount(); i++) {
            if (!equals(getField(i), fk.getField(i))) {
                String msg = "Field of foreign key differs from: "
                           + getField(i).getName();
                LOG.error(msg);
                throw new GeneratorException(msg);
            }
        }
       
        if (!equals(getReferenceTable().getName(), fk.getReferenceTable().getName())) {
            String msg = "Referenced table of foreign key differs from: "
                       + getReferenceTable().getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (getReferenceFieldCount() != fk.getReferenceFieldCount()) {
            String msg = "Referenced field count of foreign key differs from: "
                       + getReferenceFieldCount();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        for (int i = 0; i < getReferenceFieldCount(); i++) {
            if (!equals(getReferenceField(i), fk.getReferenceField(i))) {
                String msg = "Referenced field of foreign key differs from: "
                           + getReferenceField(i).getName();
                LOG.error(msg);
                throw new GeneratorException(msg);
            }
        }
    }
View Full Code Here


     * {@inheritDoc}
     */
    public void toCreateDDL(final DDLWriter writer) throws GeneratorException {
        if (isIdentity() && (getKeyGenerator() instanceof IdentityKeyGenerator)) {
            String msg = "IDENTITY key generator is not supported for this database";
            throw new GeneratorException(msg);
        }
       
        writer.print(getName());
        writer.print(" ");
        writer.print(getType().toDDL(this));
View Full Code Here

     */
    public final void merge(final Table table) throws GeneratorException {
        if (table == null) {
            String msg = "Table to merge is missing.";
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (!equals(getName(), table.getName())) {
            String msg = "Name of table differs from: " + getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (getFieldCount() != table.getFieldCount()) {
            String msg = "Field count of table differs from: " + getFieldCount();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        for (int i = 0; i < getFieldCount(); i++) {
            Field field1 = getField(i);
            Field field2 = null;
View Full Code Here

     */
    public final void merge(final Field field) throws GeneratorException {
        if (field == null) {
            String msg = "Field to merge is missing.";
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (!equals(getName(), field.getName())) {
            String msg = "Name of field differs from: " + getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (!equals(getTable(), field.getTable())) {
            String msg = "Table of field differs from: " + getTable().getName();
            LOG.error(msg);
            throw new GeneratorException(msg);
        }
       
        if (_isIdentity != field._isIdentity) {
            LOG.warn("Merge table: Field 'identity' attributes are different");
        }
View Full Code Here

                _valueColumn = value;
            } else if (PARAM_GRAB_SIZE.equalsIgnoreCase(value)) {
                try {
                    _grabSize = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {
                    throw new GeneratorException("Can't parse integer" + value, nfe);
                }
            } else if (PARAM_SAME_CONNECTION.equalsIgnoreCase(name)) {
                _isSameConnection = Boolean.valueOf(value).booleanValue();
            } else if (PARAM_GLOBAL_KEYS.equals(name.toLowerCase())) {
                _isGlobal = Boolean.valueOf(value).booleanValue();
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public KeyGenerator createKeyGenerator() throws GeneratorException {
        throw new GeneratorException("Creation of default key generator not support");
    }
View Full Code Here

                _isTrigger = Boolean.valueOf(value).booleanValue();
            } else if (PARAM_INCREMENT.equalsIgnoreCase(name)) {
                try {
                    _increment = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {
                    throw new GeneratorException("Can't parse integer" + name, nfe);
                }
            }           
        }               
    }
View Full Code Here

     */
    public String toDDL(final Field field) throws GeneratorException {
        Integer length = field.getLength();
        if (length == null) { length = _defaultLength; }
        if (length == null) {
            throw new GeneratorException(
                    "Reguired length attribute missing for field '" + field.getName()
                    + "' of type '" + getJdbcType() + "'");
        }
       
        int len = length.intValue();
View Full Code Here

     */
    public String toDDL(final Field field) throws GeneratorException {
        Integer length = field.getLength();
        if (length == null) { length = _defaultLength; }
        if (length == null) {
            throw new GeneratorException(
                    "Reguired length attribute missing for field '" + field.getName()
                    + "' of type '" + getJdbcType() + "'");
        }
       
        StringBuffer sb = new StringBuffer();
View Full Code Here

        Integer decimals = field.getDecimals();
        if ((presision == null) && (decimals == null)) {
            presision = _defaultPresision;
            decimals = _defaultDecimals;
        } else if ((presision == null) || (decimals == null)) {
            throw new GeneratorException(
                    "Precision or decimal attribute missing for field '" + field.getName()
                    + "' of type '" + getJdbcType() + "'");
        }
       
        StringBuffer sb = new StringBuffer();
View Full Code Here

TOP

Related Classes of org.castor.ddlgen.GeneratorException

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.