|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.gbif.datatester.JdbcRecordSet
public class JdbcRecordSet
This class implements a JDBC GenericRecordSet. In this
case records come from a table or view inside a relational database.
| Constructor Summary | |
|---|---|
JdbcRecordSet(java.sql.Connection connection,
java.lang.String tableName,
java.util.Map conceptMapping,
java.util.List idDefinition)
Constructs a JDBCRecordSet based on a JDBC connection, a table or view name, a concept mapping ( Concepts pointing to fields),
and a List of Concepts used to identify the records. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
Compare two record sets for equality based on database name, table name, concept mapping and id definition. |
protected void |
executeQuery()
Executes the query. |
java.util.Set |
getAvailableConcepts()
Returns a Set of Concept objects for which
each record has an associated value. |
protected java.util.Set |
getConceptsBeingUsed()
Returns the Concepts being used by the record set. |
int |
hashCode()
Returns a hash code based on database name, table name, concept mapping and id definition. |
void |
limitConceptsTo(java.util.Set concepts)
Method used to indicate which Concepts will be
used, so that this implementation can optimize performance
by restricting the scope of search and storage of values. |
GenericRecord |
nextRecord()
Moves the cursor to the next record and returns a reference to it (or null if there's no next record). |
void |
resetCursor()
Resets the cursor so that when nextRecord is called it will return the first one. |
void |
setRecordFilter(RecordFilter recordFilter)
Sets a RecordFilter that can indicate which records should be skipped
during validation. |
void |
setWhereClause(java.lang.String whereClause)
Specific method that can be used to set an optional SQL "where" clause to be used when retrieving records. |
int |
size()
Returns the number of records. |
void |
sortBy(java.util.LinkedHashMap concepts)
Sorts the record set by the specified Concepts. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JdbcRecordSet(java.sql.Connection connection,
java.lang.String tableName,
java.util.Map conceptMapping,
java.util.List idDefinition)
Constructs a JDBCRecordSet based on a JDBC connection, a
table or view name, a concept mapping (Concepts pointing to fields),
and a List of Concepts used to identify the records.
connection - JDBC Connection to the database.tableName - Table or view name containing the records.conceptMapping - Mapping between Concepts and field names.idDefinition - Concepts used to identify records.
java.lang.IllegalArgumentException| Method Detail |
|---|
public java.util.Set getAvailableConcepts()
Returns a Set of Concept objects for which
each record has an associated value.
getAvailableConcepts in interface GenericRecordSetConcepts.
public void limitConceptsTo(java.util.Set concepts)
throws RecordSetException
Method used to indicate which Concepts will be
used, so that this implementation can optimize performance
by restricting the scope of search and storage of values.
limitConceptsTo in interface GenericRecordSetconcepts - Set of Concepts that will be used.
When not specified, then use all Concepts.
java.lang.IllegalArgumentException
RecordSetException
public GenericRecord nextRecord()
throws RecordSetException
Moves the cursor to the next record and returns a reference to it (or null if there's no next record).
nextRecord in interface GenericRecordSetRecordSetExceptionpublic void sortBy(java.util.LinkedHashMap concepts)
Sorts the record set by the specified Concepts.
sortBy in interface GenericRecordSetconcepts - LiknedHashMap where key is Concept object and
value is a Boolean indicating if the order is ascending.
public void resetCursor()
throws RecordSetException
Resets the cursor so that when nextRecord is called it will return the first one.
resetCursor in interface GenericRecordSetRecordSetException
public int size()
throws RecordSetException
Returns the number of records.
size in interface GenericRecordSetRecordSetExceptionpublic void setRecordFilter(RecordFilter recordFilter)
Sets a RecordFilter that can indicate which records should be skipped
during validation.
setRecordFilter in interface GenericRecordSetrecordFilter - A RecordFilter object that can indicate if a
specific record should be skipped during the test or not.protected java.util.Set getConceptsBeingUsed()
Returns the Concepts being used by the record set.
Concepts being used.
protected void executeQuery()
throws java.sql.SQLException
Executes the query.
java.sql.SQLExceptionpublic void setWhereClause(java.lang.String whereClause)
Specific method that can be used to set an optional SQL "where" clause to be used when retrieving records. Only available on the JdbcRecordSet implementation.
whereClause - SQL where clause to be included in the SQL statement.public int hashCode()
Returns a hash code based on database name, table name, concept mapping and id definition. Note: This implementation cannot distinguish between databases installed in different machines if they have the same name, the same table and the same mapping!
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
Compare two record sets for equality based on database name, table name, concept mapping and id definition. Note: This implementation cannot distinguish between databases installed in different machines if they have the same name, the same table and the same mapping!.
equals in class java.lang.Objectobj - Object to be compared.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||