Class AbstractPrivilege

java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractPrivilege
All Implemented Interfaces:
IPrivilege, IHashable
Direct Known Subclasses:
ChPrivilege, MsPrivilege, PgPrivilege

public abstract class AbstractPrivilege extends Object implements IPrivilege
Represents a database privilege (GRANT/REVOKE) for a database object. Handles privilege operations including creation, dropping, and SQL generation for different database types.
  • Method Details

    • isRevoke

      public boolean isRevoke()
      Description copied from interface: IPrivilege
      Checks if this privilege represents a REVOKE operation.
      Specified by:
      isRevoke in interface IPrivilege
      Returns:
      true if this is a REVOKE privilege, false if GRANT
    • getCreationSQL

      public String getCreationSQL()
      Description copied from interface: IPrivilege
      Generates the SQL statement for this privilege.
      Specified by:
      getCreationSQL in interface IPrivilege
      Returns:
      the GRANT or REVOKE SQL statement
    • getDropSQL

      public String getDropSQL()
      Description copied from interface: IPrivilege
      Generates the SQL statement to drop this privilege.
      Specified by:
      getDropSQL in interface IPrivilege
      Returns:
      the REVOKE SQL statement, or null if this is already a REVOKE
    • getPermission

      public String getPermission()
      Specified by:
      getPermission in interface IPrivilege
      Returns:
      the permission type (e.g., SELECT, INSERT, ALL)
    • getRole

      public String getRole()
      Specified by:
      getRole in interface IPrivilege
      Returns:
      role the role receiving or losing the privilege
    • getName

      public String getName()
      Specified by:
      getName in interface IPrivilege
      Returns:
      the object name the privilege applies to
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • computeHash

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Parameters:
      hasher - the hasher instance to use for hash computation
    • toString

      public String toString()
      Overrides:
      toString in class Object