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

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


  /**
   * Test writing of a Relation element with no user.
   */
  @Test
  public final void testProcessRelationWithNoUser() {
    Relation relation =
      new Relation(new CommonEntityData(1234, 2, timestamp, OsmUser.NONE, 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


  /**
   * Test writing out a Relation element with no tags.
   */
  @Test
  public final void testProcessRelationNoTags() {
    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"));
   
    testRelationWriter.process(relation);
    try {
      testBufferedWriter.flush();
    } catch (IOException e) {
View Full Code Here

    long id;
    int version;
    TimestampContainer timestamp;
    OsmUser user;
    long changesetId;
    Relation relation;
   
    id = Long.parseLong(reader.getAttributeValue(null, ATTRIBUTE_NAME_ID));
    version = Integer.parseInt(reader.getAttributeValue(null, ATTRIBUTE_NAME_VERSION));
    timestamp = parseTimestamp(reader.getAttributeValue(null, ATTRIBUTE_NAME_TIMESTAMP));
    user = readUser();
    changesetId = readChangesetId();
   
    relation = new Relation(new CommonEntityData(id, version, timestamp, user, changesetId));
   
    reader.nextTag();
    while (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
      if (reader.getLocalName().equals(ELEMENT_NAME_TAG)) {
        relation.getTags().add(readTag());
      } else if (reader.getLocalName().equals(ELEMENT_NAME_MEMBER)) {
        relation.getMembers().add(readRelationMember());
      } else {
        readUnknownElement();
      }
    }
    reader.nextTag();
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer relationContainer) {
    Relation relation;
    int memberSequenceId;
   
    relation = relationContainer.getEntity();
   
    relationWriter.writeField(relation.getId());
    relationWriter.writeField(relation.getVersion());
    relationWriter.writeField(relation.getUser().getId());
    relationWriter.writeField(relation.getTimestamp());
    relationWriter.writeField(relation.getChangesetId());
    relationWriter.writeField(buildTags(relation));
    relationWriter.endRecord();
   
    memberSequenceId = 0;
    for (RelationMember member : relation.getMembers()) {
      relationMemberWriter.writeField(relation.getId());
      relationMemberWriter.writeField(member.getMemberId());
      relationMemberWriter.writeField(memberTypeValueMapper.getMemberType(member.getMemberType()));
      relationMemberWriter.writeField(member.getMemberRole());
      relationMemberWriter.writeField(memberSequenceId++);
      relationMemberWriter.endRecord();
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public void process(CommonEntityData data, ResultSet resultSet) throws SQLException {
    Relation relation;
   
        relation = new Relation(data);
       
        listener.process(relation, resultSet);
  }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer container) {
    Relation relation;

    // mark all nodes as required
    relation = container.getEntity();
    for (RelationMember memberReference : relation.getMembers()) {
      if (memberReference.getMemberType() == EntityType.Node) {
        long nodeId = memberReference.getMemberId();
        requiredNodes.set(nodeId);
      }
    }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(RelationContainer container) {
    Relation relation;

    // mark all nodes as required
    relation = container.getEntity();
    for (RelationMember memberReference : relation.getMembers()) {
      if (memberReference.getMemberType() == EntityType.Way) {
        long wayId = memberReference.getMemberId();
        requiredWays.set(wayId);
      }
    }
View Full Code Here

     
      processedRelations = new ArrayList<Relation>(INSERT_BULK_ROW_COUNT_RELATION);
     
      prmIndex = 1;
      for (int i = 0; i < INSERT_BULK_ROW_COUNT_RELATION; i++) {
        Relation relation;
       
        relation = relationBuffer.remove(0);
        processedRelations.add(relation);
       
        prmIndex = relationBuilder.populateEntityParameters(bulkRelationStatement, prmIndex, relation);
      }
     
      try {
        bulkRelationStatement.executeUpdate();
      } catch (SQLException e) {
        throw new OsmosisRuntimeException("Unable to bulk insert relations into the database.", e);
      }
     
      for (Relation relation : processedRelations) {
        addRelationTags(relation);
        addRelationMembers(relation);
      }
    }
   
    if (complete) {
      while (relationBuffer.size() > 0) {
        Relation relation;
       
        relation = relationBuffer.remove(0);
       
        relationBuilder.populateEntityParameters(singleRelationStatement, 1, relation);
       
View Full Code Here

    rawUserName = attributes.getValue(ATTRIBUTE_NAME_USER);
    changesetId = buildChangesetId(attributes.getValue(ATTRIBUTE_NAME_CHANGESET_ID));
   
    user = buildUser(rawUserId, rawUserName);
   
    relation = new Relation(new CommonEntityData(id, version, timestampContainer, user, changesetId));
  }
View Full Code Here

            }
            // long id, int version, TimestampContainer timestampContainer,
            // OsmUser user,
            // long changesetId, Collection<Tag> tags,
            // List<RelationMember> members
            Relation tmp;
            if (i.hasInfo()) {
                Osmformat.Info info = i.getInfo();
                tmp = new Relation(new CommonEntityData(id, info.getVersion(), getDate(info),
                        getUser(info), info.getChangeset(), tags), nodes);
            } else {
                tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
                        NOCHANGESET, tags), nodes);
            }
            sink.process(new RelationContainer(tmp));
        }
    }
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.