Package org.apache.sis.metadata.sql
Class TableHierarchy
java.lang.Object
org.apache.sis.metadata.sql.TableHierarchy
Utility methods for handling the inheritance between tables.
This features is partially supported in PostgreSQL database.
This class is a work around for databases that support table inheritances, but not yet index inheritance. For example, in PostgreSQL 9.5.13, we cannot yet declare a foreigner key to the super table and find the entries in inherited tables that way.
An alternative to current workaround would be to repeat a search in all child tables.
We could use DatabaseMetaData.getSuperTables(String, String, String)
for
getting the list of child tables.
- Since:
- 1.0
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionAbbreviations for commonly-used tables.The reverse ofABBREVIATIONS
.(package private) static final char
Delimiter characters for the table name in identifier.(package private) static final char
Delimiter characters for the table name in identifier. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
TYPE_OPEN
static final char TYPE_OPENDelimiter characters for the table name in identifier. Table names are prefixed to identifiers only if the type represented by the table is a subtype. For example, sinceOrganisation
is a subtype ofParty
, identifiers for organizations need to be prefixed by{Organisation}
in order to allowMetadataSource
to know in which table to search for such party. -
TYPE_CLOSE
static final char TYPE_CLOSEDelimiter characters for the table name in identifier. Table names are prefixed to identifiers only if the type represented by the table is a subtype. For example, sinceOrganisation
is a subtype ofParty
, identifiers for organizations need to be prefixed by{Organisation}
in order to allowMetadataSource
to know in which table to search for such party. -
ABBREVIATIONS
Abbreviations for commonly-used tables. We use those abbreviations because table names like"VectorSpatialRepresentation"
consume a lot of space, which leave few spaces left for actual identifiers when we want to limit the length to a relatively small value. -
TABLES
The reverse ofABBREVIATIONS
.
-
-
Constructor Details
-
TableHierarchy
private TableHierarchy()Do not allow instantiation of this class.
-
-
Method Details
-
add
Adds an abbreviation. For class initialization only. -
encode
Encode table name in the given identifier. -
subType
If the given identifier specifies a subtype of the given type, then returns that subtype. For example if the given type isParty.class
and the given identifier is"{Organisation}EPSG"
, then this method returnsOrganisation.class
. Otherwise this method returnstype
unchanged.- Parameters:
type
- base metadata type.identifier
- primary key in the database.- Returns:
- actual type of the metadata object.
-