OmniSciDB  2e3a973ef4
SqlCreateUserMapping.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import com.google.gson.annotations.Expose;
4 
5 import org.apache.calcite.sql.SqlCreate;
6 import org.apache.calcite.sql.SqlKind;
7 import org.apache.calcite.sql.SqlNode;
8 import org.apache.calcite.sql.SqlOperator;
9 import org.apache.calcite.sql.SqlSpecialOperator;
10 import org.apache.calcite.sql.parser.SqlParserPos;
11 
12 import java.util.List;
13 import java.util.Map;
14 
18 public class SqlCreateUserMapping extends SqlCreate implements JsonSerializableDdl {
19  private static final SqlOperator OPERATOR =
20  new SqlSpecialOperator("CREATE_USER_MAPPING", SqlKind.OTHER_DDL);
21 
22  public static class Builder extends SqlOptionsBuilder {
23  private boolean ifNotExists;
24  private String serverName;
25  private String user;
26  private SqlParserPos pos;
27 
28  public void setIfNotExists(final boolean ifNotExists) {
29  this.ifNotExists = ifNotExists;
30  }
31 
32  public void setServerName(final String serverName) {
33  this.serverName = serverName;
34  }
35 
36  public void setUser(final String user) {
37  this.user = user;
38  }
39 
40  public void setPos(final SqlParserPos pos) {
41  this.pos = pos;
42  }
43 
45  return new SqlCreateUserMapping(pos, ifNotExists, serverName, user, super.options);
46  }
47  }
48 
49  @Expose
50  private boolean ifNotExists;
51  @Expose
52  private String serverName;
53  @Expose
54  private String user;
55  @Expose
56  private String command;
57  @Expose
58  private Map<String, String> options;
59 
60  public SqlCreateUserMapping(final SqlParserPos pos,
61  final boolean ifNotExists,
62  final String serverName,
63  final String dataWrapper,
64  final Map<String, String> options) {
65  super(OPERATOR, pos, false, ifNotExists);
66  this.ifNotExists = ifNotExists;
67  this.serverName = serverName;
68  this.command = OPERATOR.getName();
69  this.user = dataWrapper;
70  this.options = options;
71  }
72 
73  @Override
74  public List<SqlNode> getOperandList() {
75  return null;
76  }
77 
78  @Override
79  public String toString() {
80  return toJsonString();
81  }
82 }
SqlCreateUserMapping(final SqlParserPos pos, final boolean ifNotExists, final String serverName, final String dataWrapper, final Map< String, String > options)