Class Table
- java.lang.Object
-
- com.ibm.fhir.database.utils.model.BaseObject
-
- com.ibm.fhir.database.utils.model.Table
-
- All Implemented Interfaces:
IDatabaseObject
public class Table extends BaseObject
An immutable definition of a table
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Table.Builder
Builder for table
-
Field Summary
-
Fields inherited from class com.ibm.fhir.database.utils.model.BaseObject
migrations, version
-
-
Constructor Summary
Constructors Constructor Description Table(String schemaName, String name, int version, String tenantColumnName, Collection<ColumnBase> columns, PrimaryKeyDef pk, IdentityDef identity, Collection<IndexDef> indexes, Collection<ForeignKeyConstraint> fkConstraints, SessionVariableDef accessControlVar, Tablespace tablespace, List<IDatabaseObject> dependencies, Map<String,String> tags, Collection<GroupPrivilege> privileges, List<Migration> migrations, List<With> withs)
Public constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(IDatabaseAdapter target)
Apply the DDL for this object to the target databasevoid
apply(Integer priorVersion, IDatabaseAdapter target)
Apply migration logic to bring the target database to the current level of this objectstatic Table.Builder
builder(String schemaName, String tableName)
Create a builder forTable
.void
drop(IDatabaseAdapter target)
DROP this object from the target databaseboolean
exists(IDatabaseAdapter target)
return true if the table already exists in the targetIdentityDef
getIdentity()
Getter for the identity definition, or null if there isn't onePrimaryKeyDef
getPrimaryKey()
Getter for the primary key definition, or null if there isn't oneString
getTenantColumnName()
Getter for the optional tenant id column namevoid
visit(DataModelVisitor v)
Visit thisIDatabaseObject
with the givenDataModelVisitor
.void
visitReverse(DataModelVisitor v)
Visit thisIDatabaseObject
with the givenDataModelVisitor
.-
Methods inherited from class com.ibm.fhir.database.utils.model.BaseObject
addDependencies, addDependency, addPrivilege, addTag, addTags, applyTx, applyVersion, collect, equals, fetchDependenciesTo, getName, getObjectName, getObjectType, getQualifiedName, getSchemaName, getTags, getTypeNameVersion, getVersion, grant, grantGroupPrivileges, hashCode, safeSleep, toString, visit
-
-
-
-
Constructor Detail
-
Table
public Table(String schemaName, String name, int version, String tenantColumnName, Collection<ColumnBase> columns, PrimaryKeyDef pk, IdentityDef identity, Collection<IndexDef> indexes, Collection<ForeignKeyConstraint> fkConstraints, SessionVariableDef accessControlVar, Tablespace tablespace, List<IDatabaseObject> dependencies, Map<String,String> tags, Collection<GroupPrivilege> privileges, List<Migration> migrations, List<With> withs)
Public constructor- Parameters:
schemaName
-name
-version
-tenantColumnName
-columns
-pk
-identity
-indexes
-fkConstraints
-accessControlVar
-tablespace
-dependencies
-tags
-privileges
-
-
-
Method Detail
-
getPrimaryKey
public PrimaryKeyDef getPrimaryKey()
Getter for the primary key definition, or null if there isn't one- Returns:
-
getIdentity
public IdentityDef getIdentity()
Getter for the identity definition, or null if there isn't one- Returns:
-
getTenantColumnName
public String getTenantColumnName()
Getter for the optional tenant id column name- Returns:
-
apply
public void apply(IDatabaseAdapter target)
Description copied from interface:IDatabaseObject
Apply the DDL for this object to the target database- Parameters:
target
- the database target
-
apply
public void apply(Integer priorVersion, IDatabaseAdapter target)
Description copied from interface:IDatabaseObject
Apply migration logic to bring the target database to the current level of this objecttarget
- the database target
-
drop
public void drop(IDatabaseAdapter target)
Description copied from interface:IDatabaseObject
DROP this object from the target database
-
builder
public static Table.Builder builder(String schemaName, String tableName)
Create a builder forTable
.- Parameters:
schemaName
-tableName
-- Returns:
-
exists
public boolean exists(IDatabaseAdapter target)
return true if the table already exists in the target- Parameters:
target
-- Returns:
-
visit
public void visit(DataModelVisitor v)
Description copied from interface:IDatabaseObject
Visit thisIDatabaseObject
with the givenDataModelVisitor
. Any sub-objects should be visited in creation order.
-
visitReverse
public void visitReverse(DataModelVisitor v)
Description copied from interface:IDatabaseObject
Visit thisIDatabaseObject
with the givenDataModelVisitor
. Any sub-objects should be visited in reverse order.
-
-