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.
  • Method Details

    • getChild

      public PgStatement getChild(String name, DbObjType type)
      Description copied from interface: IStatementContainer
      Gets a child statement by name and type.
      Specified by:
      getChild in interface IStatementContainer
      Parameters:
      name - the name of the child to find
      type - the type of the child to find
      Returns:
      the child statement, or null if not found
    • addChild

      public void addChild(IStatement st)
      Description copied from interface: IStatementContainer
      Adds a child statement to this container.
      Specified by:
      addChild in interface IStatementContainer
      Parameters:
      st - the child statement to add
    • isClustered

      public final boolean isClustered()
      Checks if this container has any clustered indexes or constraints.
    • getConstraint

      public abstract AbstractConstraint getConstraint(String name)
      Finds constraint according to specified constraint name.
      Parameters:
      name - name of the constraint to be searched
      Returns:
      found constraint or null if no such constraint has been found
    • getIndex

      public AbstractIndex getIndex(String name)
      Finds index according to specified index name.
      Parameters:
      name - name of the index to be searched
      Returns:
      found index or null if no such index has been found
    • getTrigger

      public AbstractTrigger getTrigger(String name)
      Finds trigger according to specified trigger name.
      Parameters:
      name - name of the trigger to be searched
      Returns:
      found trigger or null if no such trigger has been found
    • getRule

      public PgRule getRule(String name)
      Finds rule according to specified rule name.
      Parameters:
      name - name of the rule to be searched
      Returns:
      found rule or null if no such rule has been found
    • getPolicy

      public AbstractPolicy getPolicy(String name)
      Finds policy according to specified policy name.
      Parameters:
      name - name of the policy to be searched
      Returns:
      found policy or null if no such policy has been found
    • getConstraints

      public abstract Collection<AbstractConstraint> getConstraints()
    • getIndexes

      public Collection<AbstractIndex> getIndexes()
      Getter for indexes. The list cannot be modified.
      Returns:
      indexes
    • getTriggers

      public Collection<AbstractTrigger> getTriggers()
      Getter for triggers. The list cannot be modified.
      Returns:
      triggers
    • getRules

      public Collection<PgRule> getRules()
      Getter for rules. The list cannot be modified.
      Returns:
      rules
    • getPolicies

      public Collection<AbstractPolicy> getPolicies()
      Getter for policies. The list cannot be modified.
      Returns:
      policies
    • addConstraint

      public abstract void addConstraint(AbstractConstraint constraint)
      Adds a constraint to this container.
      Parameters:
      constraint - the constraint to add
    • addIndex

      public void addIndex(AbstractIndex index)
      Adds an index to this container.
      Parameters:
      index - the index to add
    • addTrigger

      public void addTrigger(AbstractTrigger trigger)
      Adds a trigger to this container.
      Parameters:
      trigger - the trigger to add
    • addRule

      public void addRule(PgRule rule)
      Adds a rule to this container.
      Parameters:
      rule - the rule to add
    • addPolicy

      public void addPolicy(AbstractPolicy policy)
      Adds a policy to this container.
      Parameters:
      policy - the policy to add
    • compareChildren

      public boolean compareChildren(PgStatement obj)
      Description copied from class: PgStatement
      Deep part of PgStatement.equals(Object). Compares all object's child PgStatements for equality.
      Overrides:
      compareChildren in class PgStatement
    • computeChildrenHash

      public void computeChildrenHash(Hasher hasher)
    • shallowCopy

      public PgStatementContainer shallowCopy()
      Description copied from class: PgStatement
      Copies all object properties into a new object and leaves all its children empty.
      Specified by:
      shallowCopy in class PgStatement
      Returns:
      shallow copy of a DB object.
    • getContainingSchema

      public AbstractSchema getContainingSchema()
      Description copied from interface: ISearchPath
      Gets the schema that contains this object.
      Specified by:
      getContainingSchema in interface ISearchPath
      Returns:
      the containing schema