public abstract class AbstractMetaDataBasedSearchCallback extends AbstractNodesFilterSearchCallback
getEdges()
method using the database meta-data.Modifier and Type | Field and Description |
---|---|
protected static int |
EXPORT |
protected static int[] |
FK_INDEXES |
protected static int |
IMPORT |
protected static int[] |
PK_INDEXES |
protected static int[] |
SCHEMANAME_INDEXES |
protected static int[] |
TABLENAME_INDEXES
indexes of the column names on the MetaData result sets.
|
ALLOW_MODE, DENY_MODE, NO_MODE
Constructor and Description |
---|
AbstractMetaDataBasedSearchCallback(IDatabaseConnection connection)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected static ForeignKeyRelationshipEdge |
createFKEdge(java.sql.ResultSet rs,
int type,
java.lang.String from,
java.lang.String to,
java.lang.String fkColumn,
java.lang.String pkColumn)
Creates an edge representing a foreign key relationship between 2 tables.
|
IDatabaseConnection |
getConnection()
Get the connection where the edges will be calculated from.
|
protected java.util.SortedSet |
getNodesFromExportedKeys(java.lang.Object node)
Get the nodes using the reverse foreign key dependency, i.e, if table C has
a FK for a table A, then getNodesFromExportedKeys(A) will return C.
NOTE: this method should be used only as an auxiliary method for sub-classes that also use getNodesFromImportedKeys()
or something similar, otherwise the generated sequence of tables might not
work when inserted in the database (as some tables might be missing). |
protected java.util.SortedSet |
getNodesFromImportAndExportKeys(java.lang.Object node)
Get the nodes using the both direct and reverse foreign key dependency, i.e,
if table C has a FK for a table A and table A has a FK for a table B, then
getNodesFromImportAndExportedKeys(A) will return B and C.
|
protected java.util.SortedSet |
getNodesFromImportedKeys(java.lang.Object node)
Get the nodes using the direct foreign key dependency, i.e, if table A has
a FK for a table B, then getNodesFromImportedKeys(A) will return B.
|
protected IEdge |
newEdge(java.sql.ResultSet rs,
int type,
java.lang.String from,
java.lang.String to,
java.lang.String fkColumn,
java.lang.String pkColumn)
This method can be overwritten by the sub-classes if they need to decorate
the edge (for instance, providing an Edge that contains the primary and
foreign keys used).
|
getFilteredNodes, getFilteringMode, nodeAdded, searchNode, setAllowedNodes, setAllowedNodes, setDeniedNodes, setDeniedNodes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEdges
protected static final int IMPORT
protected static final int EXPORT
protected static final int[] TABLENAME_INDEXES
protected static final int[] SCHEMANAME_INDEXES
protected static final int[] PK_INDEXES
protected static final int[] FK_INDEXES
public AbstractMetaDataBasedSearchCallback(IDatabaseConnection connection)
connection
- connection where the edges will be calculated frompublic IDatabaseConnection getConnection()
protected java.util.SortedSet getNodesFromImportedKeys(java.lang.Object node) throws SearchException
node
- table nameSearchException
protected java.util.SortedSet getNodesFromExportedKeys(java.lang.Object node) throws SearchException
getNodesFromImportedKeys()
or something similar, otherwise the generated sequence of tables might not
work when inserted in the database (as some tables might be missing).
node
- table nameSearchException
protected java.util.SortedSet getNodesFromImportAndExportKeys(java.lang.Object node) throws SearchException
node
- table nameSearchException
protected static ForeignKeyRelationshipEdge createFKEdge(java.sql.ResultSet rs, int type, java.lang.String from, java.lang.String to, java.lang.String fkColumn, java.lang.String pkColumn) throws SearchException
rs
- database meta-data result settype
- type of relationship (IMPORT or EXPORT)from
- name of the table representing the 'from' nodeto
- name of the table representing the 'to' nodefkColumn
- name of the foreign key columnpkColumn
- name of the primary key columnSearchException
- not thrown in this method (but might on sub-classes)protected IEdge newEdge(java.sql.ResultSet rs, int type, java.lang.String from, java.lang.String to, java.lang.String fkColumn, java.lang.String pkColumn) throws SearchException
rs
- database meta-data result settype
- type of relationship (IMPORT or EXPORT)from
- name of the table representing the 'from' nodeto
- name of the table representing the 'to' nodefkColumn
- name of the foreign key columnpkColumn
- name of the primary key columnSearchException
- not thrown in this method (but might on sub-classes)Copyright © 2002-2020. All Rights Reserved.