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 classTable.BuilderBuilder 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)Public constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(IDatabaseAdapter target)Apply the DDL for this object to the target databasevoidapply(Integer priorVersion, IDatabaseAdapter target)Apply migration logic to bring the target database to the current level of this objectstatic Table.Builderbuilder(String schemaName, String tableName)Create a builder forTable.voiddrop(IDatabaseAdapter target)DROP this object from the target databasebooleanexists(IDatabaseAdapter target)return true if the table already exists in the targetIdentityDefgetIdentity()Getter for the identity definition, or null if there isn't onePrimaryKeyDefgetPrimaryKey()Getter for the primary key definition, or null if there isn't oneStringgetTenantColumnName()Getter for the optional tenant id column namevoidvisit(DataModelVisitor v)Visit thisIDatabaseObjectwith the givenDataModelVisitor.voidvisitReverse(DataModelVisitor v)Visit thisIDatabaseObjectwith 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)
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:IDatabaseObjectApply 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:IDatabaseObjectApply 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:IDatabaseObjectDROP 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:IDatabaseObjectVisit thisIDatabaseObjectwith the givenDataModelVisitor. Any sub-objects should be visited in creation order.
-
visitReverse
public void visitReverse(DataModelVisitor v)
Description copied from interface:IDatabaseObjectVisit thisIDatabaseObjectwith the givenDataModelVisitor. Any sub-objects should be visited in reverse order.
-
-