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

import com.chenyang.druid.DbType;
import com.chenyang.druid.sql.ast.SQLExpr;
import com.chenyang.druid.sql.ast.SQLStatementImpl;
import com.chenyang.druid.sql.ast.expr.SQLIntegerExpr;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class SQLImportTableStatement extends SQLStatementImpl {
   private boolean extenal;
   private SQLExprTableSource table;
   private List<SQLAssignItem> partition = new ArrayList();
   private SQLExpr from;
   private SQLExpr location;
   private SQLIntegerExpr version;
   private boolean usingBuild = false;

   public SQLImportTableStatement() {
      this.dbType = DbType.hive;
   }

   public SQLExprTableSource getTable() {
      return this.table;
   }

   public void setTable(SQLExprTableSource x) {
      if (x != null) {
         x.setParent(this);
      }

      this.table = x;
   }

   public List<SQLAssignItem> getPartition() {
      return this.partition;
   }

   public SQLExpr getFrom() {
      return this.from;
   }

   public void setFrom(SQLExpr x) {
      if (x != null) {
         x.setParent(this);
      }

      this.from = x;
   }

   public SQLExpr getLocation() {
      return this.location;
   }

   public void setLocation(SQLExpr x) {
      if (x != null) {
         x.setParent(this);
      }

      this.location = x;
   }

   protected void accept0(SQLASTVisitor v) {
      if (v.visit(this)) {
         this.acceptChild(v, this.table);
         this.acceptChild(v, this.partition);
         this.acceptChild(v, this.from);
         this.acceptChild(v, this.location);
         this.acceptChild(v, this.version);
      }

      v.endVisit(this);
   }

   public SQLIntegerExpr getVersion() {
      return this.version;
   }

   public void setVersion(SQLIntegerExpr version) {
      this.version = version;
   }

   public boolean isUsingBuild() {
      return this.usingBuild;
   }

   public void setUsingBuild(boolean usingBuild) {
      this.usingBuild = usingBuild;
   }

   public boolean isExtenal() {
      return this.extenal;
   }

   public void setExtenal(boolean extenal) {
      this.extenal = extenal;
   }
}
