Package org.pgcodekeeper.core.schema
Class PgStatementContainer
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.PgStatementContainer
- All Implemented Interfaces:
IHashable,IRelation,ISearchPath,IStatement,IStatementContainer
- Direct Known Subclasses:
AbstractTable,AbstractView
public abstract class PgStatementContainer
extends PgStatement
implements IRelation, IStatementContainer, ISearchPath
Abstract base class for database objects that can contain other statements.
Provides common functionality for containers like tables and views that can have
indexes, triggers, rules, policies, and constraints as child objects.
-
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GO -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(IStatement st) Adds a child statement to this container.abstract voidaddConstraint(AbstractConstraint constraint) Adds a constraint to this container.voidaddIndex(AbstractIndex index) Adds an index to this container.voidaddPolicy(AbstractPolicy policy) Adds a policy to this container.voidAdds a rule to this container.voidaddTrigger(AbstractTrigger trigger) Adds a trigger to this container.booleanDeep part ofPgStatement.equals(Object).voidcomputeChildrenHash(Hasher hasher) Gets a child statement by name and type.abstract AbstractConstraintgetConstraint(String name) Finds constraint according to specified constraintname.abstract Collection<AbstractConstraint>Gets the schema that contains this object.Finds index according to specified indexname.Getter forindexes.Getter forpolicies.Finds policy according to specified policyname.Finds rule according to specified rulename.getRules()Getter forrules.getTrigger(String name) Finds trigger according to specified triggername.Getter fortriggers.final booleanChecks if this container has any clustered indexes or constraints.Copies all object properties into a new object and leaves all its children empty.Methods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendAlterSQL, appendComments, appendOwnerSQL, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compare, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getCreationSQL, getDbType, getDeps, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSQL, getTwin, getTypeName, hasChildren, hashCode, isLib, isOwned, isSubElement, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, toStringMethods inherited from interface org.pgcodekeeper.core.hasher.IHashable
computeHashMethods inherited from interface org.pgcodekeeper.core.schema.IRelation
getRelationColumnsMethods inherited from interface org.pgcodekeeper.core.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getName, getParent, getQualifiedName, getStatementType
-
Method Details
-
getChild
Description copied from interface:IStatementContainerGets a child statement by name and type.- Specified by:
getChildin interfaceIStatementContainer- Parameters:
name- the name of the child to findtype- the type of the child to find- Returns:
- the child statement, or null if not found
-
addChild
Description copied from interface:IStatementContainerAdds a child statement to this container.- Specified by:
addChildin interfaceIStatementContainer- Parameters:
st- the child statement to add
-
isClustered
public final boolean isClustered()Checks if this container has any clustered indexes or constraints. -
getConstraint
Finds constraint according to specified constraintname.- Parameters:
name- name of the constraint to be searched- Returns:
- found constraint or null if no such constraint has been found
-
getIndex
Finds index according to specified indexname.- Parameters:
name- name of the index to be searched- Returns:
- found index or null if no such index has been found
-
getTrigger
Finds trigger according to specified triggername.- Parameters:
name- name of the trigger to be searched- Returns:
- found trigger or null if no such trigger has been found
-
getRule
Finds rule according to specified rulename.- Parameters:
name- name of the rule to be searched- Returns:
- found rule or null if no such rule has been found
-
getPolicy
Finds policy according to specified policyname.- Parameters:
name- name of the policy to be searched- Returns:
- found policy or null if no such policy has been found
-
getConstraints
-
getIndexes
Getter forindexes. The list cannot be modified.- Returns:
indexes
-
getTriggers
Getter fortriggers. The list cannot be modified.- Returns:
triggers
-
getRules
Getter forrules. The list cannot be modified.- Returns:
rules
-
getPolicies
Getter forpolicies. The list cannot be modified.- Returns:
policies
-
addConstraint
Adds a constraint to this container.- Parameters:
constraint- the constraint to add
-
addIndex
Adds an index to this container.- Parameters:
index- the index to add
-
addTrigger
Adds a trigger to this container.- Parameters:
trigger- the trigger to add
-
addRule
Adds a rule to this container.- Parameters:
rule- the rule to add
-
addPolicy
Adds a policy to this container.- Parameters:
policy- the policy to add
-
compareChildren
Description copied from class:PgStatementDeep part ofPgStatement.equals(Object). Compares all object's child PgStatements for equality.- Overrides:
compareChildrenin classPgStatement
-
computeChildrenHash
-
shallowCopy
Description copied from class:PgStatementCopies all object properties into a new object and leaves all its children empty.- Specified by:
shallowCopyin classPgStatement- Returns:
- shallow copy of a DB object.
-
getContainingSchema
Description copied from interface:ISearchPathGets the schema that contains this object.- Specified by:
getContainingSchemain interfaceISearchPath- Returns:
- the containing schema
-