Search in sources :

Example 1 with Relation

use of org.openstreetmap.osmosis.core.domain.v0_6.Relation in project voltdb by VoltDB.

the class VoltDBOsmSink method process.

/**
     * {@inheritDoc}
     */
public void process(RelationContainer relationContainer) {
    Relation relation;
    int memberSequenceId;
    relation = relationContainer.getEntity();
    try {
        client.callProcedure(new InsertCallback(), INS_RELATIONS_PROC, relation.getId(), relation.getVersion(), relation.getUser().getId(), relation.getTimestamp(), relation.getChangesetId());
    } catch (NoConnectionsException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    memberSequenceId = 0;
    for (RelationMember member : relation.getMembers()) {
        try {
            client.callProcedure(new InsertCallback(), INS_RELATIONS_MEMBER_PROC, relation.getId(), member.getMemberId(), member.getMemberType().ordinal(), member.getMemberRole(), memberSequenceId);
        } catch (NoConnectionsException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        memberSequenceId++;
    }
    for (Tag tag : relation.getTags()) {
        try {
            client.callProcedure(new InsertCallback(), INS_RELATION_TAGS_PROC, relation.getId(), tag.getKey(), tag.getValue());
        } catch (NoConnectionsException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
Also used : Relation(org.openstreetmap.osmosis.core.domain.v0_6.Relation) NoConnectionsException(org.voltdb.client.NoConnectionsException) RelationMember(org.openstreetmap.osmosis.core.domain.v0_6.RelationMember) IOException(java.io.IOException) Tag(org.openstreetmap.osmosis.core.domain.v0_6.Tag)

Aggregations

IOException (java.io.IOException)1 Relation (org.openstreetmap.osmosis.core.domain.v0_6.Relation)1 RelationMember (org.openstreetmap.osmosis.core.domain.v0_6.RelationMember)1 Tag (org.openstreetmap.osmosis.core.domain.v0_6.Tag)1 NoConnectionsException (org.voltdb.client.NoConnectionsException)1