package com.alibaba.druid.sql.ast.statement;

import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLObject;
import com.alibaba.druid.sql.ast.SQLStatementImpl;
import java.util.ArrayList;
import java.util.List;

public abstract class SQLPrivilegeStatement extends SQLStatementImpl {
   protected final List<SQLPrivilegeItem> privileges = new ArrayList();
   protected List<SQLExpr> users = new ArrayList();
   protected SQLObject resource;
   protected SQLObjectType resourceType;

   public SQLPrivilegeStatement() {
   }

   public SQLPrivilegeStatement(DbType dbType) {
      super(dbType);
   }

   public List<SQLExpr> getUsers() {
      return this.users;
   }

   public void addUser(SQLExpr user) {
      if (user != null) {
         user.setParent(this);
         this.users.add(user);
      }
   }

   public void setUsers(List<SQLExpr> users) {
      this.users = users;
   }

   public SQLObject getResource() {
      return this.resource;
   }

   public void setResource(SQLObject x) {
      if (x != null) {
         x.setParent(this);
      }

      this.resource = x;
   }

   public void setResource(SQLExpr resource) {
      if (resource != null) {
         resource.setParent(this);
      }

      this.resource = resource;
   }

   public List<SQLPrivilegeItem> getPrivileges() {
      return this.privileges;
   }

   public SQLObjectType getResourceType() {
      return this.resourceType;
   }

   public void setResourceType(SQLObjectType x) {
      this.resourceType = x;
   }
}
