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

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


        config.getTable().add(table);

        return table;
    }
    public Column addColumn(Table table, String name, String propertyName) {
        Column column = ConfigFactory.INSTANCE.createColumn();
        column.setColumnName(name);
        column.setPropertyName(propertyName);
       
        table.getColumn().add(column);
        return column;
    }
View Full Code Here


    }
    private Column findOrCreateColumn(Table t, String name) {
        Iterator i = t.getColumn().iterator();
        while (i.hasNext()) {
            Column c = (Column) i.next();
            if (name.equals(c.getColumnName())) {
                return c;
            }
        }

        Column c = ConfigFactory.INSTANCE.createColumn();
        c.setColumnName(name);
        t.getColumn().add(c);
        return c;
    }
View Full Code Here

    //JIRA-952
    public void addConverter(String name, String converter) {
        QualifiedColumn column = new QualifiedColumn(name, this.config.isDatabaseSchemaNameSupported());
        Table t = null;
         t = findOrCreateTable(column);
        Column c = findOrCreateColumn(t, column.getColumnName());
        c.setConverterClassName(converter);
    }
View Full Code Here

        c.setConverterClassName(converter);
    }

    public String getConverter(String tableName, String columnName) {
        Table t = getTable(tableName);
        Column c = getColumn(t, columnName);
        if (c != null) {
            return c.getConverterClassName();
        }
        return null;
    }
View Full Code Here

    public Map getConverters(Table table) {
        Map converters = new HashMap();

        Iterator columns = table.getColumn().iterator();
        while (columns.hasNext()) {
            Column c = (Column) columns.next();
            if (c.getConverterClassName() != null) {
                String property = c.getPropertyName();
                if (property == null) {
                    property = c.getColumnName();
                }
                converters.put(property, c.getConverterClassName());
            }
        }
        return converters;
    }
View Full Code Here

        Table t = findOrCreateTable(schemaName, tableName);//JIRA-952

        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

       
        Table t = mappingWrapper.getTable(getTableName());
        if (t == null) {
            return false;
        }
        Column c = mappingWrapper.getColumnByPropertyName(t, parameter);
        if (c == null) {
            return false;
        }
       
        return c.isPrimaryKey();
    }
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

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.