From 819804d98792e8461007bb539758217f5498e8d1 Mon Sep 17 00:00:00 2001 From: David Webb Date: Mon, 2 Dec 2013 14:59:09 -0500 Subject: [PATCH] DATACASS-48 : CLOSED: Added javadoc for new overload methods to specify Query Options. --- .../cassandra/core/CassandraOperations.java | 378 +++++++++++++++++- .../cassandra/core/CassandraTemplate.java | 91 ++++- 2 files changed, 446 insertions(+), 23 deletions(-) diff --git a/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraOperations.java b/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraOperations.java index b53d0fb25..02d8d9ec6 100644 --- a/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraOperations.java +++ b/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraOperations.java @@ -66,9 +66,29 @@ public interface CassandraOperations { */ T query(final String cql, ResultSetExtractor 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 query(final String cql, ResultSetExtractor rse, final Map 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 query(final String cql, ResultSetExtractor rse, final QueryOptions options) throws DataAccessException; /** @@ -81,9 +101,27 @@ public interface CassandraOperations { */ T queryAsynchronously(final String cql, ResultSetFutureExtractor 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 queryAsynchronously(final String cql, ResultSetFutureExtractor rse, final Map 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 queryAsynchronously(final String cql, ResultSetFutureExtractor 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 RowCallbackHandler. + * + * @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 optionsByName) throws DataAccessException; + /** + * Executes the provided CQL Query, and then processes the results with the RowCallbackHandler. + * + * @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 { */ List query(final String cql, RowMapper 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 processed by the RowMapper + * @throws DataAccessException + */ List query(final String cql, RowMapper rowMapper, final Map 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 processed by the RowMapper + * @throws DataAccessException + */ List query(final String cql, RowMapper 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 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 { */ List query(final String cql, PreparedStatementBinder psb, RowMapper 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 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 + * @param optionsByName The Query Options Map + * @return List of for each Row returned from the Query. + * @throws DataAccessException + */ List query(final String cql, PreparedStatementBinder psb, RowMapper rowMapper, final Map 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 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 + * @param options The Query Options Object + * @return List of for each Row returned from the Query. + * @throws DataAccessException + */ List query(final String cql, PreparedStatementBinder psb, RowMapper rowMapper, final QueryOptions options) throws DataAccessException; @@ -347,9 +467,31 @@ public interface CassandraOperations { */ T query(PreparedStatementCreator psc, ResultSetExtractor rse) throws DataAccessException; + /** + * Uses the provided PreparedStatementCreator to prepare a new Session call. This can only be used for CQL + * Statements that do not have data binding. 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 which is the output of the ResultSetExtractor + * @throws DataAccessException + */ T query(PreparedStatementCreator psc, ResultSetExtractor rse, final Map optionsByName) throws DataAccessException; + /** + * Uses the provided PreparedStatementCreator to prepare a new Session call. This can only be used for CQL + * Statements that do not have data binding. 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 which is the output of the ResultSetExtractor + * @throws DataAccessException + */ T query(PreparedStatementCreator psc, ResultSetExtractor 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. This can only be used for CQL + * Statements that do not have data binding. 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 optionsByName) throws DataAccessException; + /** + * Uses the provided PreparedStatementCreator to prepare a new Session call. This can only be used for CQL + * Statements that do not have data binding. 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 { */ List query(PreparedStatementCreator psc, RowMapper rowMapper) throws DataAccessException; + /** + * Uses the provided PreparedStatementCreator to prepare a new Session call. This can only be used for CQL + * Statements that do not have data binding. The results of the PreparedStatement are processed with RowMapper + * implementation provided and a List is returned with elements of Type 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 mapped from each Row in the Results + * @throws DataAccessException + */ List query(PreparedStatementCreator psc, RowMapper rowMapper, final Map optionsByName) throws DataAccessException; + /** + * Uses the provided PreparedStatementCreator to prepare a new Session call. This can only be used for CQL + * Statements that do not have data binding. The results of the PreparedStatement are processed with RowMapper + * implementation provided and a List is returned with elements of Type 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 mapped from each Row in the Results + * @throws DataAccessException + */ List query(PreparedStatementCreator psc, RowMapper 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 which is the output of the ResultSetExtractor + * @throws DataAccessException + */ + T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor rse, + final Map 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 which is the output of the ResultSetExtractor + * @throws DataAccessException + */ + T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor 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 which is the output of the ResultSetExtractor * @throws DataAccessException */ - T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor rse, - final Map optionsByName) throws DataAccessException; - - T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor rse, - final QueryOptions options) throws DataAccessException; - T query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final ResultSetExtractor 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 which is the output of the ResultSetExtractor + * @throws DataAccessException + */ + void query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowCallbackHandler rch, + final Map 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 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 which is the output of the ResultSetExtractor * @throws DataAccessException */ - void query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowCallbackHandler rch, - final Map 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 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 which is the output of the ResultSetExtractor + * @throws DataAccessException + */ + List query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper rowMapper, + final Map 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 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 which is the output of the ResultSetExtractor + * @throws DataAccessException + */ + List query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper 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 which is the output of the ResultSetExtractor * @throws DataAccessException */ - List query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper rowMapper, - final Map optionsByName) throws DataAccessException; - - List query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper rowMapper, - final QueryOptions options) throws DataAccessException; - List query(PreparedStatementCreator psc, final PreparedStatementBinder psb, final RowMapper 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. + * + *

+ * 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. + *

+ * + * @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 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. + * + *

+ * 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. + *

+ * + * @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. + * + *

+ * The List length must match the number of bind variables in the CQL. + *

+ * + * @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> rows, Map 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. + * + *

+ * The List length must match the number of bind variables in the CQL. + *

+ * + * @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> 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> 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. + * + *

+ * The Object[] length of the nested array must match the number of bind variables in the CQL. + *

+ * + * @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 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. + * + *

+ * The Object[] length of the nested array must match the number of bind variables in the CQL. + *

+ * + * @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. diff --git a/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraTemplate.java b/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraTemplate.java index 896938bd6..88d45da7c 100644 --- a/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraTemplate.java +++ b/spring-cassandra/src/main/java/org/springframework/cassandra/core/CassandraTemplate.java @@ -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 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()); + } + /* (non-Javadoc) * @see org.springframework.cassandra.core.CassandraOperations#execute(java.lang.String, java.util.List) */ @Override - public void ingest(String cql, List> rows) { + public void ingest(String cql, List> rows, Map 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> 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> rows) { + ingest(cql, rows, new HashMap()); + } + /* (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 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()); } /* (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 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) */