Package org.apache.tuscany.das.rdb.config

Examples of org.apache.tuscany.das.rdb.config.Column


        ChangeSummary summary = changedObject.getDataGraph().getChangeSummary();
        Iterator i = getChangedFields(mapping, summary, changedObject).iterator();

        while (i.hasNext()) {
            Property property = (Property) i.next();
            Column c = t.getColumnByPropertyName(property.getName());
            if ((c != null) && (c.isCollision() || c.isPrimaryKey())) {
                // get rid of comma if OCC or PK is last field
                if (!i.hasNext()) {
                    statement.delete(statement.length() - 2, statement.length());
                }
            } else {
                updatedProperties.add(property);
                statement.append(c == null ? property.getName() : c.getColumnName());
                statement.append(" = ?");
                if (i.hasNext()) {
                    statement.append(", ");
                }
            }
        }

        Column c = t.getManagedColumn();
        if (c != null) {
            statement.append(", ");
            statement.append(c.getColumnName());
            statement.append(" = ?");
            managedProperties.add(changedObject.getProperty(t.getManagedColumnPropertyName()));
        }
        statement.append(" where ");
View Full Code Here


        Table t = findOrCreateTable(tableName);

        Iterator i = t.getColumn().iterator();
        boolean hasPK = false;
        while (i.hasNext()) {
            Column c = (Column) i.next();
            if (c.isPrimaryKey()) {
                hasPK = true;
            }
        }

        if (!hasPK) {
            Column c = findOrCreateColumn(t, columnName);
            c.setPrimaryKey(true);
        }

    }
View Full Code Here

        Iterator i = mapping.getConfig().getTable().iterator();
        while (i.hasNext()) {
            Table t = (Table) i.next();
            Iterator columns = t.getColumn().iterator();
            while (columns.hasNext()) {
                Column c = (Column) columns.next();
                if (c.isPrimaryKey() && c.isGenerated()) {
                    if (this.logger.isDebugEnabled()) {
                        this.logger.debug("adding generated key " + t.getTableName() + "." + c.getColumnName());
                    }

                    generatedKeys.put(t.getTableName(), c.getColumnName());
                }
            }
        }
    }
View Full Code Here

    public Collection getPrimaryKeyNames() {
        List pkNames = new ArrayList();
        Iterator i = table.getColumn().iterator();
        while (i.hasNext()) {
            Column c = (Column) i.next();
            if (c.isPrimaryKey()) {
                pkNames.add(c.getColumnName());
            }
        }
        return pkNames;
    }
View Full Code Here

    public Collection getPrimaryKeyProperties() {

        List keyProperties = new ArrayList();
        Iterator columns = table.getColumn().iterator();
        while (columns.hasNext()) {
            Column c = (Column) columns.next();
            if (c.isPrimaryKey()) {
                keyProperties.add(getColumnPropertyName(c));
            }
        }

        return keyProperties;
View Full Code Here

        return c.getColumnName();
    }

    public boolean isGeneratedColumnProperty(String name) {
        Column c = getColumnByPropertyName(name);
        return c == null ? false : c.isGenerated();
    }
View Full Code Here

        Column c = getColumnByPropertyName(name);
        return c == null ? false : c.isGenerated();
    }

    public String getConverter(String propertyName) {
        Column c = getColumnByPropertyName(propertyName);
        return (c == null) ? null : c.getConverterClassName();
    }
View Full Code Here

    }

    public Column getColumnByPropertyName(String propertyName) {
        Iterator columns = table.getColumn().iterator();
        while (columns.hasNext()) {
            Column c = (Column) columns.next();
            String property = c.getPropertyName();
            if (property == null) {
                property = c.getColumnName();
            }
            if (propertyName.equals(property)) {
                return c;
            }
        }
View Full Code Here

    }

    public Column getCollisionColumn() {
        Iterator columns = table.getColumn().iterator();
        while (columns.hasNext()) {
            Column c = (Column) columns.next();
            if (c.isCollision()) {
                return c;
            }
        }

        return null;
View Full Code Here

        return null;

    }

    public String getCollisionColumnPropertyName() {
        Column c = getCollisionColumn();
        if (c.getPropertyName() != null) {
            return c.getPropertyName();
        }
        return c.getColumnName();
       
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.das.rdb.config.Column

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.