All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scalar.db.sql.exception.AuthorizationException Maven / Gradle / Ivy

There is a newer version: 3.14.0
Show newest version
package com.scalar.db.sql.exception;

import com.scalar.db.sql.Privilege;
import java.util.Optional;
import javax.annotation.Nullable;

public class AuthorizationException extends SqlException {

  private final boolean superuserRequired;
  @Nullable private final Privilege requiredPrivilege;

  public AuthorizationException(
      String message,
      @Nullable String transactionId,
      boolean superuserRequired,
      @Nullable Privilege requiredPrivilege) {
    super(message, transactionId);
    this.superuserRequired = superuserRequired;
    this.requiredPrivilege = requiredPrivilege;
  }

  public AuthorizationException(
      String message,
      Throwable cause,
      @Nullable String transactionId,
      boolean superuserRequired,
      @Nullable Privilege requiredPrivilege) {
    super(message, cause, transactionId);
    this.superuserRequired = superuserRequired;
    this.requiredPrivilege = requiredPrivilege;
  }

  public boolean isSuperuserRequired() {
    return superuserRequired;
  }

  public Optional getRequiredPrivilege() {
    return Optional.ofNullable(requiredPrivilege);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy