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

Examples of org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper


    public ResultMetadata(ResultSet rs, Config model, ResultSetShape shape)
            throws SQLException {
        debug("Creating new ResultMetadata with mapping model " + model);
        this.resultSet = rs;
        this.mappingWrapper = new MappingWrapper(model);

        if (shape == null)
            this.resultSetShape = new ResultSetShape(rs.getMetaData());
        else
            this.resultSetShape = shape;
View Full Code Here


  public DataObject get(String tablePropertyName) {
    return (DataObject) objectsByTableName.get(tablePropertyName);
  }

  void processRelationships() {
    MappingWrapper wrapper = new MappingWrapper(metadata.getMapping());
    if (wrapper.hasRecursiveRelationships()) {
      processRecursiveRelationships(wrapper);
      return;
    }

    Iterator i = metadata.getRelationships().iterator();
    while (i.hasNext()) {
      Relationship r = (Relationship) i.next();

     
            DataObject parentTable = get(wrapper
          .getTablePropertyName(r.getPrimaryKeyTable()));
      DataObject childTable = get(wrapper
          .getTablePropertyName(r.getForeignKeyTable()));

      DebugUtil.debugln(getClass(), debug, "Parent table: " + parentTable);
      DebugUtil.debugln(getClass(), debug, "Child table: " + childTable);
View Full Code Here

    public ApplyChangesCommandImpl() {
    }

    public ApplyChangesCommandImpl(Config config){
      this.configWrapper = new MappingWrapper(config);
        if (config.getConnectionProperties() != null)
            setConnection(config.getConnectionProperties());
    }
View Full Code Here

        if (config.getConnectionProperties() != null)
            setConnection(config.getConnectionProperties());
    }
   
    public ApplyChangesCommandImpl(Config config, Connection connection){
        this.configWrapper = new MappingWrapper(config);
        setConnection(connection);
    }
View Full Code Here

    private static final boolean debug = false;

    private HashMap keyMappings = new HashMap();

    public DatabaseObject(Config model, DataObject changedObject) {
        this.mappingWrapper = new MappingWrapper(model);
        this.dataObject = changedObject;
        initialize();
    }
View Full Code Here

  private boolean hasState(Property ref, DataObject changedObject) {
    if ( ref.getOpposite().isMany() ) {
      return true;
    } else {
      MappingWrapper mw = this.mapping;
      if ( mw.getConfig() == null )
        mw = registry.getFactory(changedObject.getType()).getConfig();
      if ( mw.getConfig() == null )
        return false;
     
      Relationship rel = mw.getRelationshipByReference(ref);     
     
      if ( !rel.isMany()) {
        // This is a one-one relationship
        Table t = mapping.getTableByPropertyName(changedObject.getType().getName());
        TableWrapper tw = new TableWrapper(t);
View Full Code Here

    protected void setEndRow(int endRow) {
        this.endRow = endRow;
    }

    private void setMappingModel(Config config) {
        configWrapper = new MappingWrapper(config);
        //TODO - need to refactor and take into regression that lost ability to use Datasource
        if (getConnection() == null)
            if (config.getConnectionProperties() != null)
                setConnection(config.getConnectionProperties());
    }
View Full Code Here

    private ConfigFactory factory = ConfigFactoryImpl.eINSTANCE;

    public ConfigHelper() {
        config = factory.createConfig();
        configWrapper = new MappingWrapper(config);
    }
View Full Code Here

        configWrapper = new MappingWrapper(config);
    }

    public ConfigHelper(Config config) {
        this.config = config;
        configWrapper = new MappingWrapper(config);
    }
View Full Code Here

      }
    }

    if (metadata.hasMappingModel()) {
      MappingWrapper wrapper = new MappingWrapper(metadata.getMapping());
      Iterator i = metadata.getRelationships().iterator();
      while (i.hasNext()) {
        Relationship r = (Relationship) i.next();

        Type parent = rootType.getProperty(
            wrapper.getTablePropertyName(r.getPrimaryKeyTable())).getType();
        Type child = rootType.getProperty(
            wrapper.getTablePropertyName(r.getForeignKeyTable())).getType();
        if (parent == null) {
          throw new RuntimeException("The parent table ("
              + r.getPrimaryKeyTable() + ") in relationship "
              + r.getName()
              + " was not found in the mapping information.");
View Full Code Here

TOP

Related Classes of org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper

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.