Class DatabaseObject
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.model.DatabaseObject
-
- All Implemented Interfaces:
IDatabaseObject
- Direct Known Subclasses:
Tablespace
public abstract class DatabaseObject extends java.lang.Object implements IDatabaseObject
Represents objects which are part of the database, but which do not belong to a particular schema (like tablespace, for example).
-
-
Constructor Summary
Constructors Constructor Description DatabaseObject(java.lang.String objectName, DatabaseObjectType objectType, int version)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTag(java.lang.String tagGroup, java.lang.String tagValue)
Add the tagGroup/tagValue pair to the tags for this objectvoid
addTags(java.util.Map<java.lang.String,java.lang.String> tags)
Add the given tags to our tag mapvoid
applyDistributionRules(ISchemaAdapter target, int pass)
Apply any distribution rules associated with the object (usually a table)void
applyTx(ISchemaAdapter target, SchemaApplyContext context, ITransactionProvider tp, IVersionHistoryService vhs)
Apply the DDL, but within its own transactionvoid
applyVersion(ISchemaAdapter target, SchemaApplyContext context, IVersionHistoryService vhs)
Apply the change, but only if it has a newer version than we already have recorded in the databaseboolean
equals(java.lang.Object other)
java.util.Collection<IDatabaseObject>
getDependencies()
Get the collection of dependencies for this objectjava.lang.String
getName()
Return the unique name for this objectjava.lang.String
getObjectName()
DatabaseObjectType
getObjectType()
The type enum of this objectjava.util.Map<java.lang.String,java.lang.String>
getTags()
Get the map of tags associated with this object.java.lang.String
getTypeNameVersion()
Get the qualified name for this object: objectType:objectName:objectVersionint
getVersion()
Getter for the schema version number this object applies toint
hashCode()
java.lang.String
toString()
void
visit(java.util.function.Consumer<IDatabaseObject> c)
Visit this object, calling the consumer for itself, or its children if any-
Methods inherited from interface org.linuxforhealth.fhir.database.utils.model.IDatabaseObject
addDependencies, apply, apply, collect, drop, fetchDependenciesTo, grant, visit, visitReverse
-
-
-
-
Constructor Detail
-
DatabaseObject
public DatabaseObject(java.lang.String objectName, DatabaseObjectType objectType, int version)
Public constructor- Parameters:
objectName
-objectType
-version
-
-
-
Method Detail
-
getDependencies
public java.util.Collection<IDatabaseObject> getDependencies()
Get the collection of dependencies for this object- Returns:
-
getVersion
public int getVersion()
Description copied from interface:IDatabaseObject
Getter for the schema version number this object applies to- Specified by:
getVersion
in interfaceIDatabaseObject
- Returns:
-
getObjectType
public DatabaseObjectType getObjectType()
Description copied from interface:IDatabaseObject
The type enum of this object- Specified by:
getObjectType
in interfaceIDatabaseObject
- Returns:
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getObjectName
public java.lang.String getObjectName()
-
getTypeNameVersion
public java.lang.String getTypeNameVersion()
Description copied from interface:IDatabaseObject
Get the qualified name for this object: objectType:objectName:objectVersion- Specified by:
getTypeNameVersion
in interfaceIDatabaseObject
- Returns:
-
addTags
public void addTags(java.util.Map<java.lang.String,java.lang.String> tags)
Add the given tags to our tag map- Parameters:
tags
-
-
addTag
public void addTag(java.lang.String tagGroup, java.lang.String tagValue)
Add the tagGroup/tagValue pair to the tags for this object- Specified by:
addTag
in interfaceIDatabaseObject
- Parameters:
tagGroup
-tagValue
-
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
getName
public java.lang.String getName()
Return the unique name for this object- Specified by:
getName
in interfaceIDatabaseObject
- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
applyTx
public void applyTx(ISchemaAdapter target, SchemaApplyContext context, ITransactionProvider tp, IVersionHistoryService vhs)
Description copied from interface:IDatabaseObject
Apply the DDL, but within its own transaction- Specified by:
applyTx
in interfaceIDatabaseObject
- Parameters:
target
- the target database we apply tocontext
- the context used to modify how the schema objects are appliedtp
- of thread-specific transactionsvhs
- the service interface for adding this object to the version history table
-
applyVersion
public void applyVersion(ISchemaAdapter target, SchemaApplyContext context, IVersionHistoryService vhs)
Apply the change, but only if it has a newer version than we already have recorded in the database- Specified by:
applyVersion
in interfaceIDatabaseObject
- Parameters:
target
-vhs
- the service used to manage the version history table
-
getTags
public java.util.Map<java.lang.String,java.lang.String> getTags()
Description copied from interface:IDatabaseObject
Get the map of tags associated with this object. Used to find things in the PhysicalDataModel- Specified by:
getTags
in interfaceIDatabaseObject
- Returns:
-
visit
public void visit(java.util.function.Consumer<IDatabaseObject> c)
Description copied from interface:IDatabaseObject
Visit this object, calling the consumer for itself, or its children if any- Specified by:
visit
in interfaceIDatabaseObject
-
applyDistributionRules
public void applyDistributionRules(ISchemaAdapter target, int pass)
Description copied from interface:IDatabaseObject
Apply any distribution rules associated with the object (usually a table)- Specified by:
applyDistributionRules
in interfaceIDatabaseObject
- Parameters:
target
- the target database we apply the operation topass
- multiple pass number
-
-