Class JdbcTable
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.jdbc.JdbcTable
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,JdbcSink,JdbcSource,Serializable
Metadata for a database table or view (name, schema, type, columns, keys and indexes), as loaded by
JdbcConnection.loadTables(LoadTablesRequest).- See Also:
-
Field Summary
Fields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddColumn(JdbcTableColumn column) Adds the column and sets this as its table.Adds the exported key and sets this as its table.Adds the imported key and sets this as its table.Adds the index and sets this as its table.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).Returns the column with the given name, ignoring case, ornullif there is none.getColumns(String... names) Returns the columns with the given names, ignoring case, in the order given; unknown names are skipped.getColumns(Collection<String> names) Returns the columns with the given names, ignoring case, in the order given; unknown names are skipped.Returns the connection this table was added to, ornull.getExportedKey(String primaryKeyName) Returns the first exported key entry whose primary key constraint name matches, ignoring case, ornull.getExportedKeyColumns(String foreignKeyName) Returns this table's primary key columns referenced by another table's named foreign key (ignoring case), in key sequence order.Returns the other tables' foreign keys that reference this table's primary key, one entry per key column.getImportedKey(String foriegnKeyName) Returns the first entry of the named foreign key, ignoring case, ornull; a multi-column key has one entry per column.getImportedKeyColumns(String foreignKeyName) Returns this table's columns in the named foreign key (ignoring case), in key sequence order.Returns this table's foreign keys to other tables, one entry per key column.Returns the index with the given name, ignoring case, ornullif there is none.getName()Returns the name as a camel-case Java class name, e.g.Returns the name as a camel-case Java identifier, e.g.Returns the columns outside the primary key, ordered by their position in the table.Returns the primary key columns in key sequence order.Returns the name of the primary key constraint (not a column), ornull.Returns the name prefixed with the schema and a dot when there is a schema; the catalog is not included.getQuery()Returns the SQL that selects this source's rows.getType()Returns the table type reported by the database, such asTABLEorVIEW.booleanisDependentOn(JdbcTable table) Returnstrueif this table is either directly or indirectly dependent on the supplied table.booleanisDirectlyDependentOn(JdbcTable table) Returnstrueif this table is directly dependent on the supplied table (i.e they have a direct public-foreign key relationship).setCatalogName(String catalogName) protected JdbcTablesetConnection(JdbcConnection connection) Sets the connection this table belongs to; called byJdbcConnection.addTable(JdbcTable).setPrimaryKeyName(String primaryKeyName) Sets the name of the primary key constraint (not a column).setRemarks(String remarks) setSchemaName(String schemaName) Sets the table type reported by the database, such asTABLEorVIEW.Sorts the columns by name, ignoring case.toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.Methods inherited from class com.northconcepts.datapipeline.foundations.core.Bean
addExceptionProperties, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties, exception, exception, exceptionMethods inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
fromJson, fromJson, toJson, toJson, toJsonMethods inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
fromXml, fromXml, fromXmlElement, toXml, toXml, toXml, toXml, toXml, toXmlElement
-
Constructor Details
-
JdbcTable
public JdbcTable()
-
-
Method Details
-
getConnection
Returns the connection this table was added to, ornull. -
setConnection
Sets the connection this table belongs to; called byJdbcConnection.addTable(JdbcTable). -
getQualifiedName
Returns the name prefixed with the schema and a dot when there is a schema; the catalog is not included. -
getName
- Specified by:
getNamein interfaceJdbcSink- Specified by:
getNamein interfaceJdbcSource
-
setName
-
getNameAsJavaClassName
Returns the name as a camel-case Java class name, e.g.OrderItemforORDER_ITEM. -
getNameAsJavaIdentifier
Returns the name as a camel-case Java identifier, e.g.orderItemforORDER_ITEM. -
getCatalogName
-
setCatalogName
-
getSchemaName
-
setSchemaName
-
getType
Returns the table type reported by the database, such asTABLEorVIEW. -
setType
Sets the table type reported by the database, such asTABLEorVIEW. -
getRemarks
-
setRemarks
-
getColumn
Returns the column with the given name, ignoring case, ornullif there is none. -
getColumns
-
addColumn
Adds the column and sets this as its table. -
sortColumns
Sorts the columns by name, ignoring case. -
getPrimaryKeyName
Returns the name of the primary key constraint (not a column), ornull. -
setPrimaryKeyName
Sets the name of the primary key constraint (not a column). -
getImportedKey
Returns the first entry of the named foreign key, ignoring case, ornull; a multi-column key has one entry per column. -
getImportedKeys
Returns this table's foreign keys to other tables, one entry per key column. -
addImportedKey
Adds the imported key and sets this as its table. -
getExportedKey
Returns the first exported key entry whose primary key constraint name matches, ignoring case, ornull. -
getExportedKeys
Returns the other tables' foreign keys that reference this table's primary key, one entry per key column. -
addExportedKey
Adds the exported key and sets this as its table. -
getIndexes
-
getIndex
Returns the index with the given name, ignoring case, ornullif there is none. -
addIndex
Adds the index and sets this as its table. -
getPrimaryKeyColumns
Returns the primary key columns in key sequence order. -
getNonPrimaryKeyColumns
Returns the columns outside the primary key, ordered by their position in the table. -
getImportedKeyColumns
Returns this table's columns in the named foreign key (ignoring case), in key sequence order. -
getExportedKeyColumns
Returns this table's primary key columns referenced by another table's named foreign key (ignoring case), in key sequence order. -
getColumns
Returns the columns with the given names, ignoring case, in the order given; unknown names are skipped. -
getColumns
Returns the columns with the given names, ignoring case, in the order given; unknown names are skipped. -
getQuery
Description copied from interface:JdbcSourceReturns the SQL that selects this source's rows.- Specified by:
getQueryin interfaceJdbcSink- Specified by:
getQueryin interfaceJdbcSource
-
getSourceType
- Specified by:
getSourceTypein interfaceJdbcSource
-
isDirectlyDependentOn
Returnstrueif this table is directly dependent on the supplied table (i.e they have a direct public-foreign key relationship).See
}invalid @link
{@link #isDependentOn(JdbcTable))- Parameters:
table-- Returns:
-
isDependentOn
Returnstrueif this table is either directly or indirectly dependent on the supplied table.- Parameters:
table-- Returns:
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classBean
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classBean- Parameters:
source-- Returns:
- this instance.
-