org.openstreetmap.osmosis.core.mysql.v0_5.impl
Class NodeHistoryReader

java.lang.Object
  extended by org.openstreetmap.osmosis.core.mysql.common.BaseTableReader<T>
      extended by org.openstreetmap.osmosis.core.mysql.v0_5.impl.BaseEntityReader<EntityHistory<Node>>
          extended by org.openstreetmap.osmosis.core.mysql.v0_5.impl.NodeHistoryReader
All Implemented Interfaces:
java.util.Iterator<EntityHistory<Node>>, Releasable, ReleasableIterator<EntityHistory<Node>>

public class NodeHistoryReader
extends BaseEntityReader<EntityHistory<Node>>

Reads node history records for nodes that have been modified within a time interval. All history items will be returned for the node from node creation up to the end of the time interval. We need the complete history instead of just the history within the interval so we can determine if the node was created during the interval or prior to the interval, a version attribute would eliminate the need for full history.

Author:
Brett Henderson

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openstreetmap.osmosis.core.mysql.common.BaseTableReader
BaseTableReader.ReadResult<T>
 
Constructor Summary
NodeHistoryReader(DatabaseLoginCredentials loginCredentials, boolean readAllUsers, java.util.Date intervalBegin, java.util.Date intervalEnd)
          Creates a new instance.
 
Method Summary
protected  BaseTableReader.ReadResult<EntityHistory<Node>> createNextValue(java.sql.ResultSet resultSet)
          Builds an entity object from the current recordset row.
protected  java.sql.ResultSet createResultSet(DatabaseContext queryDbCtx)
          Builds the result set that the reader will iterate over.
 
Methods inherited from class org.openstreetmap.osmosis.core.mysql.v0_5.impl.BaseEntityReader
readUserField
 
Methods inherited from class org.openstreetmap.osmosis.core.mysql.common.BaseTableReader
createLastValue, hasNext, next, release, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeHistoryReader

public NodeHistoryReader(DatabaseLoginCredentials loginCredentials,
                         boolean readAllUsers,
                         java.util.Date intervalBegin,
                         java.util.Date intervalEnd)
Creates a new instance.

Parameters:
loginCredentials - Contains all information required to connect to the database.
readAllUsers - If this flag is true, all users will be read from the database regardless of their public edits flag.
intervalBegin - Marks the beginning (inclusive) of the time interval to be checked.
intervalEnd - Marks the end (exclusive) of the time interval to be checked.
Method Detail

createResultSet

protected java.sql.ResultSet createResultSet(DatabaseContext queryDbCtx)
Builds the result set that the reader will iterate over.

Specified by:
createResultSet in class BaseTableReader<EntityHistory<Node>>
Parameters:
queryDbCtx - The database context to query against.
Returns:
A result set positioned before the first record.

createNextValue

protected BaseTableReader.ReadResult<EntityHistory<Node>> createNextValue(java.sql.ResultSet resultSet)
Builds an entity object from the current recordset row.

Specified by:
createNextValue in class BaseTableReader<EntityHistory<Node>>
Parameters:
resultSet - The record set to retrieve the data from.
Returns:
The result of the read.