Package org.jitterbit.integration.data.structure.database

Examples of org.jitterbit.integration.data.structure.database.DbTranRelations$Relation


    }

    protected abstract DatabaseObject translate(DatabaseObject original, BeginEndQuote quotes);

    private void processRelationships() {
        DbTranRelations original = dbStruct.getRelations();
        List<Relation> copiedJoins = Lists.newArrayList();
        for (Relation join : original.getRelations()) {
            DatabaseObject parent = translatedObjects.get(join.getParentName());
            DatabaseObject child = translatedObjects.get(join.getChildName());
            if (parent != null && child != null) {
                DatabaseColumn parentField = parent.findColumn(join.getParentField());
                DatabaseColumn childField = child.findColumn(join.getChildField());
                if (parentField != null && childField != null) {
                    TableRelationship tr = new TableRelationship(parent, child);
                    tr.setRelationshipNature(join.getCardinality());
                    FieldRelationship fr = new FieldRelationship(parentField, childField);
                    copiedJoins.add(new Relation(tr, fr));
                }
            }
        }
        DbTranRelations copy = new DbTranRelations();
        for (Relation r : copiedJoins) {
            copy.addRelation(r);
        }
        dbStruct.setRelations(copy);
    }
View Full Code Here


        script.setManualSqlStatement(statementDetails.getName());
        s.setSqlScript(script);
        s.setDbTables(new DbTables());
        s.setDbFields(new DbFields());
        s.setHierarchicalFilters(new DbTranFilters());
        s.setRelations(new DbTranRelations());
    }
View Full Code Here

     * @return a <code>List</code> of <code>String</code> arrays. Each entry in the list corresponds
     *         to a row in <code>Tran_RelationsTab</code>. An empty list is returned if there are no
     *         table relations to insert.
     */
    public List<String[]> build(DatabaseStructure structure, String tranId) {
        DbTranRelations dbTranRelations = structure.getRelations();
        for (DbTranRelations.Relation relation : dbTranRelations.getRelations()) {
            MapKey key = new MapKey(relation);
            JoinedTables tab = null;
            if (joins.containsKey(key)) {
                tab = joins.get(key);
            } else {
View Full Code Here

        return tables;
    }

    @Override
    public void applyTo(DatabaseStructure s) {
        DbTranRelations dbRelations = new DbTranRelations();
        setRelationships(dbRelations);
        s.setRelations(dbRelations);
    }
View Full Code Here

     * affect the data stored in this object.
     *
     * @see #getRelations()
     */
    public void setRelations(DbTranRelations newRelations) {
        DbTranRelations old;
        synchronized (getDataLock()) {
            old = this.relations;
            this.relations = (newRelations == null) ? new DbTranRelations() : newRelations.getCopy();
        }
        if (differs(newRelations, old)) {
            firePropertyChange(DB_RELATIONS, old, newRelations);
        }
    }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public Relation parseRecord(ResultSet resultSet) {
    try {
      return new Relation(
        new CommonEntityData(
          resultSet.getLong("id"),
          resultSet.getInt("version"),
          new Date(resultSet.getTimestamp("tstamp").getTime()),
          buildUser(resultSet),
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public Relation mapRow(ResultSet rs, int rowNumber) throws SQLException {
    return new Relation(mapCommonEntityData(rs));
  }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer relationContainer) {
    Relation relation;
   
    relation = relationContainer.getEntity();
   
    for (RelationMember relationMember : relation.getMembers()) {
      EntityType memberType;
     
      memberType = relationMember.getMemberType();
     
      if (EntityType.Node.equals(memberType)) {
        if (!nodeBitSet.get(relationMember.getMemberId())) {
          initialize();
         
          write("Relation," + relation.getId() + ",Node," + relationMember.getMemberId());
          writeNewLine();
        }
      } else if (EntityType.Way.equals(memberType)) {
        if (!wayBitSet.get(relationMember.getMemberId())) {
          initialize();
         
          write("Relation," + relation.getId() + ",Way," + relationMember.getMemberId());
          writeNewLine();
        }
      }
    }
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public Relation getEntity(long entityId) {
    Relation entity;
   
    entity = super.getEntity(entityId);
   
    loadFeatures(entityId, entity);
   
View Full Code Here

  /**
   * Test writing out a normal Relation element.
   */
  @Test
  public final void testProcessNormalRelation() {
    Relation relation =
      new Relation(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
    relation.getMembers().add(new RelationMember(2345, EntityType.Node, "noderole"));
    relation.getMembers().add(new RelationMember(3456, EntityType.Way, "wayrole"));
    relation.getMembers().add(new RelationMember(4567, EntityType.Relation, "relationrole"));
    relation.getTags().add(new Tag("relationkey", "relationvalue"));
   
    testRelationWriter.process(relation);
    try {
      testBufferedWriter.flush();
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.structure.database.DbTranRelations$Relation

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.