public abstract class GraphStatement extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
protected static AtomicBoolean |
WARNED_GRAPHSON1
Deprecated.
|
Constructor and Description |
---|
GraphStatement() |
Modifier and Type | Method and Description |
---|---|
GraphStatement |
executingAs(String userOrRole)
Allows this statement to be executed as a different user/role than the one currently
authenticated (a.k.a.
|
abstract ConsistencyLevel |
getConsistencyLevel()
Returns the consistency level to use with this statement.
|
abstract long |
getDefaultTimestamp()
The default timestamp for this query.
|
String |
getGraphInternalOption(String optionKey)
Returns the advanced option's value defined for the key in parameter.
|
String |
getGraphLanguage()
Returns the graph language to use with this statement.
|
String |
getGraphName()
Returns the graph name to use with this statement.
|
ConsistencyLevel |
getGraphReadConsistencyLevel()
Returns the read consistency level to use with this statement.
|
String |
getGraphSource()
Returns the graph traversal source name to use with this statement.
|
ConsistencyLevel |
getGraphWriteConsistencyLevel()
Returns the write consistency level to use with this statement.
|
abstract int |
getReadTimeoutMillis()
Return the per-host socket read timeout that was set for this statement.
|
Function<Row,GraphNode> |
getTransformResultFunction()
Allows users to input their own implementations of
GraphNode directly into the DSE Driver's workflow. |
Boolean |
isIdempotent()
Whether this statement is idempotent, i.e.
|
boolean |
isSystemQuery()
Returns whether this statement is marked as a system query.
|
abstract GraphStatement |
setConsistencyLevel(ConsistencyLevel consistencyLevel)
Sets the consistency level to use for this statement.
|
abstract GraphStatement |
setDefaultTimestamp(long defaultTimestamp)
Sets the default timestamp for this query (in microseconds since the epoch).
|
GraphStatement |
setGraphInternalOption(String optionKey,
String optionValue)
Sets additional graph option.
|
GraphStatement |
setGraphLanguage(String graphLanguage)
Sets the graph language to use with this statement.
|
GraphStatement |
setGraphName(String graphName)
Sets the graph name to use with this statement.
|
GraphStatement |
setGraphReadConsistencyLevel(ConsistencyLevel consistencyLevel)
Sets the read consistency level to use for this statement.
|
GraphStatement |
setGraphSource(String graphSource)
Sets the graph traversal source name to use with this statement.
|
GraphStatement |
setGraphWriteConsistencyLevel(ConsistencyLevel consistencyLevel)
Sets the write consistency level to use for this statement.
|
GraphStatement |
setIdempotent(boolean idempotent)
Sets whether this statement is idempotent.
|
abstract GraphStatement |
setReadTimeoutMillis(int readTimeoutMillis)
Overrides the default per-host read timeout (
GraphOptions.setReadTimeoutMillis(int) )
for this statement. |
GraphStatement |
setSystemQuery()
Forces this statement to use no graph name, even if a default graph name was defined with
GraphOptions.setGraphName(String) . |
GraphStatement |
setTransformResultFunction(Function<Row,GraphNode> transformResultFunction)
|
abstract Statement |
unwrap()
Deprecated.
|
Statement |
unwrap(GraphOptions graphOptions)
"Unwraps" the current graph statement, that is, returns an executable
Statement object
corresponding to this graph statement. |
abstract Statement |
unwrap(GraphProtocol graphProtocol)
Deprecated.
|
protected static final org.slf4j.Logger logger
@Deprecated protected static final AtomicBoolean WARNED_GRAPHSON1
public String getGraphLanguage()
setGraphLanguage(String)
public GraphStatement setGraphLanguage(String graphLanguage)
This property is not required; if it is not set, the default GraphOptions.getGraphLanguage()
will be used when executing the statement.
graphLanguage
- the Graph language to use with this statement.GraphStatement
instance (for method chaining).public String getGraphSource()
setGraphSource(String)
public GraphStatement setGraphSource(String graphSource)
This property is not required; if it is not set, the default GraphOptions.getGraphSource()
will be used when executing the statement.
graphSource
- the graph traversal source name to use with this statement.GraphStatement
instance (for method chaining).public String getGraphName()
getGraphName()
public GraphStatement setGraphName(String graphName)
This property is not required; if it is not set, the default GraphOptions.getGraphName()
(which may itself be unset) will be used when executing the
statement.
If a default name is set on the global options, but this statement is a system query that
you explicitly want to run without a graph name, use setSystemQuery()
.
If setSystemQuery()
was called on this statement previously, setting a graph name
forces the statement to be a non-system query again.
graphName
- the graph name to use with this statement.GraphStatement
instance (for method chaining).public GraphStatement setSystemQuery()
GraphOptions.setGraphName(String)
.
If a graph name was previously defined on this statement, it will be reset.
GraphStatement
instance (for method chaining).public boolean isSystemQuery()
public ConsistencyLevel getGraphReadConsistencyLevel()
public GraphStatement setGraphReadConsistencyLevel(ConsistencyLevel consistencyLevel)
This setting will override the consistency level set with setConsistencyLevel(ConsistencyLevel)
only for the READ part of the graph
query.
Please see setConsistencyLevel(ConsistencyLevel)
for more
information.
consistencyLevel
- the consistency level to set.GraphStatement
instance (for method chaining).public GraphStatement setIdempotent(boolean idempotent)
idempotent
- the new value.Statement
object.Statement.isIdempotent()
public Boolean isIdempotent()
null
if it uses the default QueryOptions.getDefaultIdempotence()
.Statement.setIdempotent(boolean)
public ConsistencyLevel getGraphWriteConsistencyLevel()
public GraphStatement setGraphWriteConsistencyLevel(ConsistencyLevel consistencyLevel)
This setting will override the consistency level set with setConsistencyLevel(ConsistencyLevel)
only for the write part of the graph
query.
Please see setConsistencyLevel(ConsistencyLevel)
for more
information.
consistencyLevel
- the consistency level to set.GraphStatement
instance (for method chaining).public GraphStatement setGraphInternalOption(String optionKey, String optionValue)
optionKey
- the option's name.optionValue
- the option's value. The value is always a String and will be interpreted to
the right type by the DSE server. To unset a value previously set you can put null
as the option's value.GraphStatement
instance (for method chaining).public String getGraphInternalOption(String optionKey)
optionKey
- the name of the option.null
(see setGraphInternalOption(java.lang.String, java.lang.String)
), this method returns null
.public abstract GraphStatement setConsistencyLevel(ConsistencyLevel consistencyLevel)
This setting will affect the general consistency when executing the graph query. However
executing a graph query on the server side is going to involve the execution of CQL queries to
the persistence engine that is Cassandra. Those queries can be both reads and writes and both
will have a settable consistency level. Setting only this property will indicate to the server
to use this consistency level for both reads and writes in Cassandra. Read or write consistency
level can be set separately with respectively setGraphReadConsistencyLevel(ConsistencyLevel)
and setGraphWriteConsistencyLevel(ConsistencyLevel)
and will override the
consistency set here.
consistencyLevel
- the consistency level to set.GraphStatement
instance (for method chaining).public abstract ConsistencyLevel getConsistencyLevel()
This will return the consistency level used for reads and writes in Cassandra.
Please see setConsistencyLevel(ConsistencyLevel)
for more
information.
public abstract GraphStatement setDefaultTimestamp(long defaultTimestamp)
The actual timestamp that will be used for this query is, in order of preference:
Long.MIN_VALUE
;
TimestampGenerator
currently in use, if different from Long.MIN_VALUE
.
defaultTimestamp
- the default timestamp for this query (must be strictly positive).GraphStatement
instance (for method chaining).DseCluster.Builder.withTimestampGenerator(com.datastax.driver.core.TimestampGenerator)
public abstract long getDefaultTimestamp()
public abstract int getReadTimeoutMillis()
GraphOptions.getReadTimeoutMillis()
will be used.public abstract GraphStatement setReadTimeoutMillis(int readTimeoutMillis)
GraphOptions.setReadTimeoutMillis(int)
)
for this statement.
If you don't call this method, the default GraphOptions.getReadTimeoutMillis()
will
be used.
readTimeoutMillis
- the timeout to set. 0
will disable the timeout for the query,
negative values are not allowed.GraphOptions
instance (for method chaining).public GraphStatement executingAs(String userOrRole)
This feature is only available in DSE 5.1+.
userOrRole
- The user or role name to act as when executing this statement.@Deprecated public abstract Statement unwrap()
GraphOptions
object is required to produce a valid
Statement
. Use unwrap(GraphOptions)
instead.
This method will call GraphStatement#unwrap(GraphProtocol.GRAPHSON_1_0)
.
Statement
.@Deprecated public abstract Statement unwrap(GraphProtocol graphProtocol)
GraphOptions
object is required to produce a valid
Statement
. Use unwrap(GraphOptions)
instead.
This method will call GraphStatement#unwrap(new
GraphOptions().setGraphSubProtocol(graphProtocol))
.
public Statement unwrap(GraphOptions graphOptions)
Statement
object
corresponding to this graph statement.
This method is intended for internal use only, users wishing to execute graph statements
should use DseSession.executeGraph(GraphStatement)
.
This method acts as a bridge between graph statements and regular Statement
s.
Implementations are free to cache the returned Statement
if appropriate.
graphOptions
- the graph options required to encode the statement's parameters into the
correct sub-protocol format.Statement
.public GraphStatement setTransformResultFunction(Function<Row,GraphNode> transformResultFunction)
transformResultFunction
- the function to set.GraphStatement
instance (for method chaining).public Function<Row,GraphNode> getTransformResultFunction()
GraphNode
directly into the DSE Driver's workflow. This method
must return a function that will take as a input a Row
from the underlying Apache
Cassandra driver, and return an object in the type GraphNode
.GraphNode
implementation.Copyright © 2012–2018. All rights reserved.