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

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


            String columnName = (String) i.next();

            QualifiedColumn pkColumn = null;
             pkColumn = new QualifiedColumn(columnName, this.config.isDatabaseSchemaNameSupported());
            //Table t = findOrCreateTable(pkColumn.getTableName());
            Table t = findOrCreateTable(pkColumn);
            Column c = findOrCreateColumn(t, pkColumn.getColumnName());
            c.setPrimaryKey(true);
        }
    }
View Full Code Here


            c.setPrimaryKey(true);
        }
    }

    public String getTableTypeName(String tableName) {
        Table t = getTable(tableName);
        if (t == null) {
            return tableName;
        }
        String propertyName = t.getTypeName();

        if (propertyName == null) {
            return tableName;
        }
View Full Code Here

        return null;
    }

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

        return propertyName;
    }

    public Table addTable(String tableName, String typeName) {
        Table table = getTable(tableName);
        if (table != null) {
            throw new RuntimeException("Table " + tableName + "already exists");
        }

        table = ConfigFactory.INSTANCE.createTable();
        table.setTableName(tableName);
        table.setTypeName(typeName);
        config.getTable().add(table);

        return table;
    }
View Full Code Here

        return table;
    }

    //JIRA-952
    public Table addTable(String tableName, String schemaName, String typeName) {     
        Table table = null;
       
        if(this.config.isDatabaseSchemaNameSupported()){
          table = getTable(schemaName+"."+tableName)
        }
        else{
          table = getTable(tableName);
        }
       
        if (table != null) {
          if(this.config.isDatabaseSchemaNameSupported()){
            throw new RuntimeException("Table " + schemaName+"."+tableName + "already exists")
          }
          else{
            throw new RuntimeException("Table " + tableName + "already exists");
          }           
        }

        table = ConfigFactory.INSTANCE.createTable();
        table.setTableName(tableName);
       
        if(this.config.isDatabaseSchemaNameSupported()){
          table.setSchemaName(schemaName);
        }
        else{
          table.setSchemaName("");
        }
       
        table.setTypeName(typeName);
        config.getTable().add(table);

        return table;
    }
View Full Code Here

        return column;
    }
   
    //JIRA-952
    private Table findOrCreateTable(String schemaName, String tableName) {
        Table table = null;
       
        if(this.config.isDatabaseSchemaNameSupported()){
          table = getTable(schemaName+"."+tableName)
        }
        else{
          table = getTable(tableName)
        }       
        if (table == null) {
            table = ConfigFactory.INSTANCE.createTable();
            table.setTableName(tableName);
            table.setSchemaName(schemaName);
           
            if(this.config.isDatabaseSchemaNameSupported()){
              table.setTypeName(schemaName+"."+tableName);
            }
            else{
              table.setTypeName(tableName);
            }
            config.getTable().add(table);
        }
        return table;
View Full Code Here

    }

    //JIRA-952
    private Table findOrCreateTable(QualifiedColumn column) {    
      Table table = null;
      if(this.config.isDatabaseSchemaNameSupported()){
        table = getTable(column.getSchemaName()+"."+column.getTableName());
      }
      else{
        table = getTable(column.getTableName());
      }

        if (table == null) {
            table = ConfigFactory.INSTANCE.createTable();
            table.setTableName(column.getTableName());
            table.setSchemaName(column.getSchemaName());
            config.getTable().add(table);
        }
        return table;

    }
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

        Column c = findOrCreateColumn(t, column.getColumnName());
        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

        return cmd;
    }

    //JIRA-952
    public void addImpliedPrimaryKey(String schemaName, String tableName, String columnName) {
        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;
View Full Code Here

TOP

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

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.