DATACASS-48 : CLOSED: Added javadoc for new overload methods to specify

Query Options.
This commit is contained in:
David Webb
2013-12-02 14:59:09 -05:00
parent 43fffe5e97
commit 819804d987
2 changed files with 446 additions and 23 deletions

View File

@@ -66,9 +66,29 @@ public interface CassandraOperations {
*/
<T> T query(final String cql, ResultSetExtractor<T> rse) throws DataAccessException;
/**
* Executes the provided CQL Query, and extracts the results with the ResultSetExtractor.
*
* @param cql The Query
* @param rse The implementation for extracting the ResultSet
* @param optionsByName Query Options Map
*
* @return
* @throws DataAccessException
*/
<T> T query(final String cql, ResultSetExtractor<T> rse, final Map<String, Object> optionsByName)
throws DataAccessException;
/**
* Executes the provided CQL Query, and extracts the results with the ResultSetExtractor.
*
* @param cql The Query
* @param rse The implementation for extracting the ResultSet
* @param options Query Options Object
*
* @return
* @throws DataAccessException
*/
<T> T query(final String cql, ResultSetExtractor<T> rse, final QueryOptions options) throws DataAccessException;
/**
@@ -81,9 +101,27 @@ public interface CassandraOperations {
*/
<T> T queryAsynchronously(final String cql, ResultSetFutureExtractor<T> rse) throws DataAccessException;
/**
* Executes the provided CQL Query asynchronously, and extracts the results with the ResultSetFutureExtractor
*
* @param cql The Query
* @param rse The implementation for extracting the future results
* @param optionsByName Query Options Map
* @return
* @throws DataAccessException
*/
<T> T queryAsynchronously(final String cql, ResultSetFutureExtractor<T> rse, final Map<String, Object> optionsByName)
throws DataAccessException;
/**
* Executes the provided CQL Query asynchronously, and extracts the results with the ResultSetFutureExtractor
*
* @param cql The Query
* @param rse The implementation for extracting the future results
* @param options Query Options Object
* @return
* @throws DataAccessException
*/
<T> T queryAsynchronously(final String cql, ResultSetFutureExtractor<T> rse, final QueryOptions options)
throws DataAccessException;
@@ -96,9 +134,25 @@ public interface CassandraOperations {
*/
void query(final String cql, RowCallbackHandler rch) throws DataAccessException;
/**
* Executes the provided CQL Query, and then processes the results with the <code>RowCallbackHandler</code>.
*
* @param cql The Query
* @param rch The implementation for processing the rows returned.
* @param options Query Options Map
* @throws DataAccessException
*/
void query(final String cql, RowCallbackHandler rch, final Map<String, Object> optionsByName)
throws DataAccessException;
/**
* Executes the provided CQL Query, and then processes the results with the <code>RowCallbackHandler</code>.
*
* @param cql The Query
* @param rch The implementation for processing the rows returned.
* @param options Query Options Object
* @throws DataAccessException
*/
void query(final String cql, RowCallbackHandler rch, final QueryOptions options) throws DataAccessException;
/**
@@ -122,9 +176,27 @@ public interface CassandraOperations {
*/
<T> List<T> query(final String cql, RowMapper<T> rowMapper) throws DataAccessException;
/**
* Executes the provided CQL Query, and maps all Rows returned with the supplied RowMapper.
*
* @param cql The Query
* @param rowMapper The implementation for mapping all rows
* @param optionsByName Query Options Map
* @return List of <T> processed by the RowMapper
* @throws DataAccessException
*/
<T> List<T> query(final String cql, RowMapper<T> rowMapper, final Map<String, Object> optionsByName)
throws DataAccessException;
/**
* Executes the provided CQL Query, and maps all Rows returned with the supplied RowMapper.
*
* @param cql The Query
* @param rowMapper The implementation for mapping all rows
* @param options Query Options Object
* @return List of <T> processed by the RowMapper
* @throws DataAccessException
*/
<T> List<T> query(final String cql, RowMapper<T> rowMapper, final QueryOptions options) throws DataAccessException;
/**
@@ -309,9 +381,31 @@ public interface CassandraOperations {
*/
void query(final String cql, PreparedStatementBinder psb, RowCallbackHandler rch) throws DataAccessException;
/**
* Converts the CQL provided into a {@link SimplePreparedStatementCreator}. Then, the PreparedStatementBinder will
* bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
* processed with the RowCallbackHandler implementation provided and nothing is returned.
*
* @param cql The Query to Prepare
* @param psb The Binding implementation
* @param rch The RowCallbackHandler for processing the ResultSet
* @param optionsByName The Query Options Map
* @throws DataAccessException
*/
void query(final String cql, PreparedStatementBinder psb, RowCallbackHandler rch,
final Map<String, Object> optionsByName) throws DataAccessException;
/**
* Converts the CQL provided into a {@link SimplePreparedStatementCreator}. Then, the PreparedStatementBinder will
* bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
* processed with the RowCallbackHandler implementation provided and nothing is returned.
*
* @param cql The Query to Prepare
* @param psb The Binding implementation
* @param rch The RowCallbackHandler for processing the ResultSet
* @param options The Query Options Object
* @throws DataAccessException
*/
void query(final String cql, PreparedStatementBinder psb, RowCallbackHandler rch, final QueryOptions options)
throws DataAccessException;
@@ -329,9 +423,35 @@ public interface CassandraOperations {
*/
<T> List<T> query(final String cql, PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException;
/**
* Converts the CQL provided into a {@link SimplePreparedStatementCreator}. Then, the PreparedStatementBinder will
* bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
* processed with the RowMapper implementation provided and a List is returned with elements of Type <T> for each Row
* returned.
*
* @param cql The Query to Prepare
* @param psb The Binding implementation
* @param rowMapper The implementation for Mapping a Row to Type <T>
* @param optionsByName The Query Options Map
* @return List of <T> for each Row returned from the Query.
* @throws DataAccessException
*/
<T> List<T> query(final String cql, PreparedStatementBinder psb, RowMapper<T> rowMapper,
final Map<String, Object> optionsByName) throws DataAccessException;
/**
* Converts the CQL provided into a {@link SimplePreparedStatementCreator}. Then, the PreparedStatementBinder will
* bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
* processed with the RowMapper implementation provided and a List is returned with elements of Type <T> for each Row
* returned.
*
* @param cql The Query to Prepare
* @param psb The Binding implementation
* @param rowMapper The implementation for Mapping a Row to Type <T>
* @param options The Query Options Object
* @return List of <T> for each Row returned from the Query.
* @throws DataAccessException
*/
<T> List<T> query(final String cql, PreparedStatementBinder psb, RowMapper<T> rowMapper, final QueryOptions options)
throws DataAccessException;
@@ -347,9 +467,31 @@ public interface CassandraOperations {
*/
<T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. <b>This can only be used for CQL
* Statements that do not have data binding.</b> The results of the PreparedStatement are processed with
* ResultSetExtractor implementation provided by the Application Code.
*
* @param psc The implementation to create the PreparedStatement
* @param rse Implementation for extracting from the ResultSet
* @param optionsByName The Query Options Map
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse, final Map<String, Object> optionsByName)
throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. <b>This can only be used for CQL
* Statements that do not have data binding.</b> The results of the PreparedStatement are processed with
* ResultSetExtractor implementation provided by the Application Code.
*
* @param psc The implementation to create the PreparedStatement
* @param rse Implementation for extracting from the ResultSet
* @param options The Query Options Object
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse, final QueryOptions options)
throws DataAccessException;
@@ -364,9 +506,29 @@ public interface CassandraOperations {
*/
void query(PreparedStatementCreator psc, RowCallbackHandler rch) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. <b>This can only be used for CQL
* Statements that do not have data binding.</b> The results of the PreparedStatement are processed with
* RowCallbackHandler and nothing is returned.
*
* @param psc The implementation to create the PreparedStatement
* @param rch The implementation to process Results
* @param optionsByName The Query Options Map
* @throws DataAccessException
*/
void query(PreparedStatementCreator psc, RowCallbackHandler rch, final Map<String, Object> optionsByName)
throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. <b>This can only be used for CQL
* Statements that do not have data binding.</b> The results of the PreparedStatement are processed with
* RowCallbackHandler and nothing is returned.
*
* @param psc The implementation to create the PreparedStatement
* @param rch The implementation to process Results
* @param options The Query Options Object
* @throws DataAccessException
*/
void query(PreparedStatementCreator psc, RowCallbackHandler rch, final QueryOptions options)
throws DataAccessException;
@@ -382,12 +544,64 @@ public interface CassandraOperations {
*/
<T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. <b>This can only be used for CQL
* Statements that do not have data binding.</b> The results of the PreparedStatement are processed with RowMapper
* implementation provided and a List is returned with elements of Type <T> for each Row returned.
*
* @param psc The implementation to create the PreparedStatement
* @param rowMapper The implementation for mapping each Row returned.
* @param optionsByName The Query Options Map
* @return List of Type <T> mapped from each Row in the Results
* @throws DataAccessException
*/
<T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper, final Map<String, Object> optionsByName)
throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. <b>This can only be used for CQL
* Statements that do not have data binding.</b> The results of the PreparedStatement are processed with RowMapper
* implementation provided and a List is returned with elements of Type <T> for each Row returned.
*
* @param psc The implementation to create the PreparedStatement
* @param rowMapper The implementation for mapping each Row returned.
* @param options The Query Options Object
* @return List of Type <T> mapped from each Row in the Results
* @throws DataAccessException
*/
<T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper, final QueryOptions options)
throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
* ResultSetExtractor implementation provided by the Application Code.
*
* @param psc The implementation to create the PreparedStatement
* @param psb The implementation to bind variables to values
* @param rse Implementation for extracting from the ResultSet
* @param optionsByName The Query Options Map
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor<T> rse,
final Map<String, Object> optionsByName) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
* ResultSetExtractor implementation provided by the Application Code.
*
* @param psc The implementation to create the PreparedStatement
* @param psb The implementation to bind variables to values
* @param rse Implementation for extracting from the ResultSet
* @param options The Query Options Object
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor<T> rse,
final QueryOptions options) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
@@ -399,15 +613,39 @@ public interface CassandraOperations {
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor<T> rse,
final Map<String, Object> optionsByName) throws DataAccessException;
<T> T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor<T> rse,
final QueryOptions options) throws DataAccessException;
<T> T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor<T> rse)
throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
* RowCallbackHandler and nothing is returned.
*
* @param psc The implementation to create the PreparedStatement
* @param psb The implementation to bind variables to values
* @param rch The implementation to process Results
* @param optionsByName The Query Options Map
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
void query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowCallbackHandler rch,
final Map<String, Object> optionsByName) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
* RowCallbackHandler and nothing is returned.
*
* @param psc The implementation to create the PreparedStatement
* @param psb The implementation to bind variables to values
* @param rch The implementation to process Results
* @param options The Query Options Object
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
void query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowCallbackHandler rch,
final QueryOptions options) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
@@ -419,15 +657,39 @@ public interface CassandraOperations {
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
void query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowCallbackHandler rch,
final Map<String, Object> optionsByName) throws DataAccessException;
void query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowCallbackHandler rch,
final QueryOptions options) throws DataAccessException;
void query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowCallbackHandler rch)
throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
* RowMapper implementation provided and a List is returned with elements of Type <T> for each Row returned.
*
* @param psc The implementation to create the PreparedStatement
* @param psb The implementation to bind variables to values
* @param rowMapper The implementation for mapping each Row returned.
* @param optionsByName The Query Options Map
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> List<T> query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper<T> rowMapper,
final Map<String, Object> optionsByName) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
* RowMapper implementation provided and a List is returned with elements of Type <T> for each Row returned.
*
* @param psc The implementation to create the PreparedStatement
* @param psb The implementation to bind variables to values
* @param rowMapper The implementation for mapping each Row returned.
* @param options The Query Options Object
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> List<T> query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper<T> rowMapper,
final QueryOptions options) throws DataAccessException;
/**
* Uses the provided PreparedStatementCreator to prepare a new Session call. Binds the values from the
* PreparedStatementBinder to the available bind variables. The results of the PreparedStatement are processed with
@@ -439,12 +701,6 @@ public interface CassandraOperations {
* @return Type <T> which is the output of the ResultSetExtractor
* @throws DataAccessException
*/
<T> List<T> query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper<T> rowMapper,
final Map<String, Object> optionsByName) throws DataAccessException;
<T> List<T> query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper<T> rowMapper,
final QueryOptions options) throws DataAccessException;
<T> List<T> query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper<T> rowMapper)
throws DataAccessException;
@@ -473,6 +729,36 @@ public interface CassandraOperations {
*/
Session getSession();
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
*
* <p>
* This is used internally by the other ingest() methods, but can be used if you want to write your own RowIterator.
* The Object[] length returned by the next() implementation must match the number of bind variables in the CQL.
* </p>
*
* @param cql The CQL
* @param rowIterator Implementation to provide the Object[] to be bound to the CQL.
* @param optionsByName The Query Options Map
*/
void ingest(String cql, RowIterator rowIterator, Map<String, Object> optionsByName);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
*
* <p>
* This is used internally by the other ingest() methods, but can be used if you want to write your own RowIterator.
* The Object[] length returned by the next() implementation must match the number of bind variables in the CQL.
* </p>
*
* @param cql The CQL
* @param rowIterator Implementation to provide the Object[] to be bound to the CQL.
* @param options The Query Options Object
*/
void ingest(String cql, RowIterator rowIterator, QueryOptions options);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
@@ -487,6 +773,34 @@ public interface CassandraOperations {
*/
void ingest(String cql, RowIterator rowIterator);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
*
* <p>
* The List<?> length must match the number of bind variables in the CQL.
* </p>
*
* @param cql The CQL
* @param rows List of List<?> with data to bind to the CQL.
* @param optionsByName The Query Options Map
*/
void ingest(String cql, List<List<?>> rows, Map<String, Object> optionsByName);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
*
* <p>
* The List<?> length must match the number of bind variables in the CQL.
* </p>
*
* @param cql The CQL
* @param rows List of List<?> with data to bind to the CQL.
* @param options The Query Options Object
*/
void ingest(String cql, List<List<?>> rows, QueryOptions options);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
@@ -500,6 +814,34 @@ public interface CassandraOperations {
*/
void ingest(String cql, List<List<?>> rows);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
*
* <p>
* The Object[] length of the nested array must match the number of bind variables in the CQL.
* </p>
*
* @param cql The CQL
* @param rows Object array of Object array of values to bind to the CQL.
* @param optionsByName The Query Options Map
*/
void ingest(String cql, Object[][] rows, Map<String, Object> optionsByName);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.
*
* <p>
* The Object[] length of the nested array must match the number of bind variables in the CQL.
* </p>
*
* @param cql The CQL
* @param rows Object array of Object array of values to bind to the CQL.
* @param options The Query Options Object
*/
void ingest(String cql, Object[][] rows, QueryOptions options);
/**
* This is an operation designed for high performance writes. The cql is used to create a PreparedStatement once, then
* all row values are bound to the single PreparedStatement and executed against the Session.

View File

@@ -772,9 +772,10 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
* @see org.springframework.cassandra.core.CassandraOperations#execute(java.lang.String, org.springframework.cassandra.core.RowProvider, int)
*/
@Override
public void ingest(String cql, RowIterator rowIterator) {
public void ingest(String cql, RowIterator rowIterator, Map<String, Object> optionsByName) {
PreparedStatement preparedStatement = getSession().prepare(cql);
addPreparedStatementOptions(preparedStatement, optionsByName);
while (rowIterator.hasNext()) {
getSession().execute(preparedStatement.bind(rowIterator.next()));
@@ -782,12 +783,30 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#ingest(java.lang.String, org.springframework.cassandra.core.RowIterator, org.springframework.cassandra.core.QueryOptions)
*/
@Override
public void ingest(String cql, RowIterator rowIterator, QueryOptions options) {
Assert.notNull(options);
ingest(cql, rowIterator, options.toMap());
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#ingest(java.lang.String, org.springframework.cassandra.core.RowIterator)
*/
@Override
public void ingest(String cql, RowIterator rowIterator) {
ingest(cql, rowIterator, new HashMap<String, Object>());
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#execute(java.lang.String, java.util.List)
*/
@Override
public void ingest(String cql, List<List<?>> rows) {
public void ingest(String cql, List<List<?>> rows, Map<String, Object> optionsByName) {
Assert.notNull(optionsByName);
Assert.notNull(rows);
Assert.notEmpty(rows);
@@ -797,15 +816,34 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
values[i++] = row.toArray();
}
ingest(cql, values);
ingest(cql, values, optionsByName);
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#ingest(java.lang.String, java.util.List, org.springframework.cassandra.core.QueryOptions)
*/
@Override
public void ingest(String cql, List<List<?>> rows, QueryOptions options) {
Assert.notNull(options);
ingest(cql, rows, options.toMap());
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#ingest(java.lang.String, java.util.List)
*/
@Override
public void ingest(String cql, List<List<?>> rows) {
ingest(cql, rows, new HashMap<String, Object>());
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#execute(java.lang.String, java.lang.Object[][])
*/
@Override
public void ingest(String cql, final Object[][] rows) {
public void ingest(String cql, final Object[][] rows, final Map<String, Object> optionsByName) {
Assert.notNull(optionsByName);
ingest(cql, new RowIterator() {
@@ -821,7 +859,24 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
return index < rows.length;
}
});
}, optionsByName);
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#ingest(java.lang.String, java.lang.Object[][], org.springframework.cassandra.core.QueryOptions)
*/
@Override
public void ingest(String cql, final Object[][] rows, QueryOptions options) {
Assert.notNull(options);
ingest(cql, rows, options.toMap());
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#ingest(java.lang.String, java.lang.Object[][])
*/
@Override
public void ingest(String cql, final Object[][] rows) {
ingest(cql, rows, new HashMap<String, Object>());
}
/* (non-Javadoc)
@@ -859,6 +914,32 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
}
/**
* Add common Query options for all types of queries.
*
* @param q
* @param optionsByName
*/
public static void addPreparedStatementOptions(PreparedStatement s, Map<String, Object> optionsByName) {
if (optionsByName == null) {
return;
}
/*
* Add Query Options
*/
if (optionsByName.get(QueryOptions.QueryOptionMapKeys.CONSISTENCY_LEVEL) != null) {
s.setConsistencyLevel(ConsistencyLevelResolver.resolve((ConsistencyLevel) optionsByName
.get(QueryOptions.QueryOptionMapKeys.CONSISTENCY_LEVEL)));
}
if (optionsByName.get(QueryOptions.QueryOptionMapKeys.RETRY_POLICY) != null) {
s.setRetryPolicy(RetryPolicyResolver.resolve((RetryPolicy) optionsByName
.get(QueryOptions.QueryOptionMapKeys.RETRY_POLICY)));
}
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CassandraOperations#query(org.springframework.cassandra.core.PreparedStatementCreator, org.springframework.cassandra.core.PreparedStatementBinder, org.springframework.cassandra.core.ResultSetExtractor, org.springframework.cassandra.core.QueryOptions)
*/