DATACASS-286 - Polishing.
Update years in license headers where needed. Apply Spring Data formatting to method blocks. Add issue reference to tests. Remove trailing whitespaces. Remove throws declarations in CqlTemplate for runtime exceptions. Add author tags. Adjust JavaDoc about not null parameters. Align not null assertion messages with Spring Data wording. Original pull request: #61.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,6 +50,7 @@ import com.datastax.driver.core.querybuilder.Update;
|
||||
*
|
||||
* @author David Webb
|
||||
* @author Matthew Adams
|
||||
* @author John Blum
|
||||
*/
|
||||
public interface CqlOperations {
|
||||
|
||||
@@ -322,7 +323,8 @@ public interface CqlOperations {
|
||||
* @param options Query Options
|
||||
* @return
|
||||
*/
|
||||
<T> T queryAsynchronously(String cql, ResultSetExtractor<T> rse, Long timeout, TimeUnit timeUnit, QueryOptions options);
|
||||
<T> T queryAsynchronously(String cql, ResultSetExtractor<T> rse, Long timeout, TimeUnit timeUnit,
|
||||
QueryOptions options);
|
||||
|
||||
/**
|
||||
* Executes the provided CQL Query and returns the ResultSetFuture for user processing.
|
||||
@@ -664,8 +666,8 @@ public interface CqlOperations {
|
||||
* @return A {@link Cancellable} that can be used to cancel the query.
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
<T> Cancellable queryForObjectAsynchronously(Select select, RowMapper<T> rowMapper, QueryForObjectListener<T> listener)
|
||||
throws DataAccessException;
|
||||
<T> Cancellable queryForObjectAsynchronously(Select select, RowMapper<T> rowMapper,
|
||||
QueryForObjectListener<T> listener) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Executes the provided CQL Query, and maps <b>ONE</b> Row returned with the supplied RowMapper.
|
||||
@@ -694,17 +696,14 @@ public interface CqlOperations {
|
||||
<T> T queryForObject(Select select, RowMapper<T> rowMapper) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Process {@link ResultSet} with {@link RowMapper}. This method is used internally to the template
|
||||
* for core operations, but is made available through this interface in the event you have a {@link ResultSet}
|
||||
* to process. The {@link ResultSet} could come from a {@link ResultSetFuture} after an asynchronous query.
|
||||
* Process {@link ResultSet} with {@link RowMapper}. This method is used internally to the template for core
|
||||
* operations, but is made available through this interface in the event you have a {@link ResultSet} to process. The
|
||||
* {@link ResultSet} could come from a {@link ResultSetFuture} after an asynchronous query.
|
||||
*
|
||||
* @param resultSet {@link ResultSet} to process.
|
||||
* @param rowMapper {@link RowMapper} used to process the single row of the result set.
|
||||
* @throws IllegalArgumentException if {@link ResultSet} is null.
|
||||
* @param resultSet {@link ResultSet} to process, must not be {@literal null}.
|
||||
* @param rowMapper {@link RowMapper} used to process the single row of the result set, must not be {@literal null}.
|
||||
* @throws IncorrectResultSizeDataAccessException if no rows are found, or more than 1 row is found.
|
||||
* @throws DataAccessException if a Cassandra driver error occurs.
|
||||
* @see org.springframework.cassandra.core.RowMapper
|
||||
* @see com.datastax.driver.core.ResultSet
|
||||
*/
|
||||
<T> T processOne(ResultSet resultSet, RowMapper<T> rowMapper) throws DataAccessException;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2016 the original author or authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cassandra.core;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
@@ -41,11 +40,10 @@ import com.datastax.driver.core.Session;
|
||||
* {@link CqlTemplate} class.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.cassandra.core.CqlTemplate
|
||||
* @since 1.5.0
|
||||
*/
|
||||
// TODO: add many more unit tests until SUT test coverage is 100%!
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@SuppressWarnings("unchecked")
|
||||
public class CqlTemplateUnitTests {
|
||||
|
||||
@Rule public ExpectedException exception = ExpectedException.none();
|
||||
@@ -59,9 +57,12 @@ public class CqlTemplateUnitTests {
|
||||
template = new CqlTemplate(mockSession);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void firstColumnToObjectReturnsColumnValue() {
|
||||
|
||||
final Row mockRow = mock(Row.class);
|
||||
ColumnDefinitions mockColumnDefinitions = mock(ColumnDefinitions.class);
|
||||
Iterator<ColumnDefinitions.Definition> mockIterator = mock(Iterator.class);
|
||||
@@ -73,8 +74,10 @@ public class CqlTemplateUnitTests {
|
||||
when(mockIterator.next()).thenReturn(mockColumnDefinition);
|
||||
|
||||
template = new CqlTemplate() {
|
||||
|
||||
@Override
|
||||
<T> T columnToObject(Row row, ColumnDefinitions.Definition columnDefinition) {
|
||||
|
||||
assertThat(row, is(sameInstance(mockRow)));
|
||||
assertThat(columnDefinition, is(sameInstance(mockColumnDefinition)));
|
||||
return (T) "test";
|
||||
@@ -90,9 +93,12 @@ public class CqlTemplateUnitTests {
|
||||
verifyZeroInteractions(mockColumnDefinition);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void firstColumnToObjectReturnsNull() {
|
||||
|
||||
Row mockRow = mock(Row.class);
|
||||
ColumnDefinitions mockColumnDefinitions = mock(ColumnDefinitions.class);
|
||||
Iterator<ColumnDefinitions.Definition> mockIterator = mock(Iterator.class);
|
||||
@@ -109,9 +115,12 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockIterator, never()).next();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void processOneIsSuccessful() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
Row mockRow = mock(Row.class);
|
||||
RowMapper<String> mockRowMapper = mock(RowMapper.class);
|
||||
@@ -128,14 +137,19 @@ public class CqlTemplateUnitTests {
|
||||
verifyZeroInteractions(mockRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void processOneThrowsIncorrectResultSetSizeDataAccessExceptionWhenNoRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
RowMapper mockRowMapper = mock(RowMapper.class);
|
||||
|
||||
when(mockResultSet.one()).thenReturn(null);
|
||||
|
||||
try {
|
||||
|
||||
exception.expect(IncorrectResultSizeDataAccessException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage(containsString("expected 1, actual 0"));
|
||||
@@ -149,8 +163,12 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void processOneThrowsIncorrectResultSetSizeDataAccessExceptionWhenTooManyRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
Row mockRow = mock(Row.class);
|
||||
RowMapper mockRowMapper = mock(RowMapper.class);
|
||||
@@ -159,6 +177,7 @@ public class CqlTemplateUnitTests {
|
||||
when(mockResultSet.isExhausted()).thenReturn(false);
|
||||
|
||||
try {
|
||||
|
||||
exception.expect(IncorrectResultSizeDataAccessException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage("ResultSet size exceeds 1");
|
||||
@@ -173,14 +192,18 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void processOnePassingNullResultSetThrowsIllegalArgumentException() {
|
||||
|
||||
RowMapper mockRowMapper = mock(RowMapper.class);
|
||||
|
||||
try {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage("ResultSet cannot be null");
|
||||
|
||||
template.processOne(null, mockRowMapper);
|
||||
} finally {
|
||||
@@ -188,9 +211,12 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void processOneWithRequiredTypeIsSuccessful() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
final Row mockRow = mock(Row.class);
|
||||
|
||||
@@ -201,27 +227,32 @@ public class CqlTemplateUnitTests {
|
||||
@Override
|
||||
protected Object firstColumnToObject(Row row) {
|
||||
assertThat(row, is(equalTo(mockRow)));
|
||||
return 1l;
|
||||
return 1L;
|
||||
}
|
||||
};
|
||||
|
||||
Number value = template.processOne(mockResultSet, Long.class);
|
||||
|
||||
assertThat(value, is(instanceOf(Long.class)));
|
||||
assertThat(value.longValue(), is(equalTo(1l)));
|
||||
assertThat(value.longValue(), is(equalTo(1L)));
|
||||
|
||||
verify(mockResultSet, times(1)).one();
|
||||
verify(mockResultSet, times(1)).isExhausted();
|
||||
verifyZeroInteractions(mockRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void processOneWithRequiredTypeThrowsIncorrectResultSetSizeDataAccessExceptionWhenNoRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
|
||||
when(mockResultSet.one()).thenReturn(null);
|
||||
|
||||
try {
|
||||
|
||||
exception.expect(IncorrectResultSizeDataAccessException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage(containsString("expected 1, actual 0"));
|
||||
@@ -234,8 +265,12 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void processOneWithRequiredTypeThrowsIncorrectResultSetSizeDataAccessExceptionWhenTooManyRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
Row mockRow = mock(Row.class);
|
||||
|
||||
@@ -243,6 +278,7 @@ public class CqlTemplateUnitTests {
|
||||
when(mockResultSet.isExhausted()).thenReturn(false);
|
||||
|
||||
try {
|
||||
|
||||
exception.expect(IncorrectResultSizeDataAccessException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage(containsString("ResultSet size exceeds 1"));
|
||||
@@ -256,11 +292,14 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void processOneWithRequiredTypePassingNullResultSetThrowsIllegalArgumentException() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage(is(equalTo("ResultSet cannot be null")));
|
||||
|
||||
template.processOne(null, String.class);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2016 the original author or authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cassandra.support;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
@@ -34,8 +33,6 @@ import com.datastax.driver.core.Session;
|
||||
* {@link CassandraAccessor} class.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.cassandra.support.CassandraAccessor
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class CassandraAccessorUnitTests {
|
||||
@@ -53,8 +50,12 @@ public class CassandraAccessorUnitTests {
|
||||
cassandraAccessor = new CassandraAccessor();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void afterPropertiesSetWithUnitializedSessionThrowsIllegalStateException() {
|
||||
|
||||
exception.expect(IllegalStateException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage("Session must not be null");
|
||||
@@ -62,14 +63,22 @@ public class CassandraAccessorUnitTests {
|
||||
cassandraAccessor.afterPropertiesSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void setAndGetExceptionTranslator() {
|
||||
|
||||
cassandraAccessor.setExceptionTranslator(mockExceptionTranslator);
|
||||
assertThat(cassandraAccessor.getExceptionTranslator(), is(sameInstance(mockExceptionTranslator)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void setExceptionTranslatorToNullThrowsIllegalArgumentException() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage(is(equalTo("CassandraExceptionTranslator must not be null")));
|
||||
@@ -77,19 +86,30 @@ public class CassandraAccessorUnitTests {
|
||||
cassandraAccessor.setExceptionTranslator(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void getUninitializedExceptionTranslatorReturnsDefault() {
|
||||
assertThat(cassandraAccessor.getExceptionTranslator(), is(equalTo(cassandraAccessor.exceptionTranslator)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void setAndGetSession() {
|
||||
|
||||
cassandraAccessor.setSession(mockSession);
|
||||
assertThat(cassandraAccessor.getSession(), is(sameInstance(mockSession)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void setSessionToNullThrowsIllegalArgumentException() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage(is(equalTo("Session must not be null")));
|
||||
@@ -97,8 +117,12 @@ public class CassandraAccessorUnitTests {
|
||||
cassandraAccessor.setSession(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
public void getUninitializedSessionThrowsIllegalStateException() {
|
||||
|
||||
exception.expect(IllegalStateException.class);
|
||||
exception.expectCause(is(nullValue(Throwable.class)));
|
||||
exception.expectMessage(is(equalTo("Session was not properly initialized")));
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors
|
||||
*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -30,7 +30,7 @@ import com.datastax.driver.core.querybuilder.Select;
|
||||
/**
|
||||
* Operations for interacting with Cassandra. These operations are used by the Repository implementation, but can also
|
||||
* be used directly when that is desired by the developer.
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author David Webb
|
||||
* @author Matthew Adams
|
||||
@@ -39,7 +39,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* The table name used for the specified class by this template.
|
||||
*
|
||||
*
|
||||
* @param entityClass must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Execute query and convert ResultSet to the list of entities
|
||||
*
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @param type must not be {@literal null}, mapped entity type.
|
||||
* @return
|
||||
@@ -56,7 +56,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Execute the Select Query and convert to the list of entities
|
||||
*
|
||||
*
|
||||
* @param select must not be {@literal null}.
|
||||
* @param type must not be {@literal null}, mapped entity type.
|
||||
* @return
|
||||
@@ -67,7 +67,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Execute CQL and convert ResultSet to the entity
|
||||
*
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @param type must not be {@literal null}, mapped entity type.
|
||||
* @return
|
||||
@@ -76,7 +76,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Executes the {@link Select} query asynchronously.
|
||||
*
|
||||
*
|
||||
* @param select The {@link Select} query to execute.
|
||||
* @param type The type of entity to retrieve.
|
||||
* @return A {@link Cancellable} that can be used to cancel the query.
|
||||
@@ -85,7 +85,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Executes the string CQL query asynchronously.
|
||||
*
|
||||
*
|
||||
* @param select The string query CQL to execute.
|
||||
* @param type The type of entity to retrieve.
|
||||
* @return A {@link Cancellable} that can be used to cancel the query.
|
||||
@@ -94,7 +94,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Executes the {@link Select} query asynchronously.
|
||||
*
|
||||
*
|
||||
* @param select The {@link Select} query to execute.
|
||||
* @param type The type of entity to retrieve.
|
||||
* @param options The {@link QueryOptions} to use.
|
||||
@@ -105,7 +105,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Executes the string CQL query asynchronously.
|
||||
*
|
||||
*
|
||||
* @param select The string query CQL to execute.
|
||||
* @param type The type of entity to retrieve.
|
||||
* @param options The {@link QueryOptions} to use.
|
||||
@@ -116,7 +116,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Execute Select query and convert ResultSet to the entity
|
||||
*
|
||||
*
|
||||
* @param query must not be {@literal null}.
|
||||
* @param type must not be {@literal null}, mapped entity type.
|
||||
* @return
|
||||
@@ -129,7 +129,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Insert the given entity.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to insert
|
||||
* @return The entity given
|
||||
*/
|
||||
@@ -137,7 +137,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Insert the given entity.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to insert
|
||||
* @param options The {@link WriteOptions} to use.
|
||||
* @return The entity given
|
||||
@@ -146,7 +146,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Insert the given list of entities.
|
||||
*
|
||||
*
|
||||
* @param entities The entities to insert.
|
||||
* @return The entities given.
|
||||
*/
|
||||
@@ -154,7 +154,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Insert the given list of entities.
|
||||
*
|
||||
*
|
||||
* @param entities The entities to insert.
|
||||
* @param options The {@link WriteOptions} to use.
|
||||
* @return The entities given.
|
||||
@@ -163,7 +163,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to insert
|
||||
* @return The entity given
|
||||
* @see #insertAsynchronously(Object, WriteListener)
|
||||
@@ -175,7 +175,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to insert
|
||||
* @return The entity given
|
||||
* @see #insertAsynchronously(Object, WriteOptions)
|
||||
@@ -187,7 +187,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to insert
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @return A {@link Cancellable} enabling the cancellation of the operation
|
||||
@@ -196,7 +196,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to insert
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @param options The {@link WriteOptions} to use
|
||||
@@ -206,7 +206,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to insert
|
||||
* @return The entities given
|
||||
* @see #insertAsynchronously(List, WriteListener)
|
||||
@@ -218,7 +218,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to insert
|
||||
* @return The entities given
|
||||
* @see #insertAsynchronously(List, WriteListener, WriteOptions)
|
||||
@@ -230,7 +230,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to insert
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @return A {@link Cancellable} enabling the cancellation of the operation
|
||||
@@ -239,7 +239,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Inserts the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to insert
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @param options The {@link WriteOptions} to use
|
||||
@@ -249,7 +249,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Update the given entity.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to update
|
||||
* @return The entity given
|
||||
*/
|
||||
@@ -257,7 +257,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Update the given entity.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to update
|
||||
* @param options The {@link WriteOptions} to use.
|
||||
* @return The entity given
|
||||
@@ -266,7 +266,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Update the given list of entities.
|
||||
*
|
||||
*
|
||||
* @param entities The entities to update.
|
||||
* @return The entities given.
|
||||
*/
|
||||
@@ -274,7 +274,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Update the given list of entities.
|
||||
*
|
||||
*
|
||||
* @param entities The entities to update.
|
||||
* @param options The {@link WriteOptions} to use.
|
||||
* @return The entities given.
|
||||
@@ -283,7 +283,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to update
|
||||
* @return The entity given
|
||||
* @see #updateAsynchronously(Object, WriteListener)
|
||||
@@ -295,7 +295,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to update
|
||||
* @return The entity given
|
||||
* @see #updateAsynchronously(Object, WriteOptions)
|
||||
@@ -307,7 +307,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to update
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @return A {@link Cancellable} enabling the cancellation of the operation
|
||||
@@ -316,7 +316,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entity asynchronously.
|
||||
*
|
||||
*
|
||||
* @param entity The entity to update
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @param options The {@link WriteOptions} to use
|
||||
@@ -326,7 +326,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to update
|
||||
* @return The entities given
|
||||
* @see #updateAsynchronously(List, WriteListener)
|
||||
@@ -338,7 +338,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to update
|
||||
* @return The entities given
|
||||
* @see #updateAsynchronously(List, WriteListener, WriteOptions)
|
||||
@@ -350,7 +350,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to update
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @return A {@link Cancellable} enabling the cancellation of the operation
|
||||
@@ -359,7 +359,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Updates the given entities asynchronously in a batch.
|
||||
*
|
||||
*
|
||||
* @param entity The entities to update
|
||||
* @param listener The listener to receive notification of completion
|
||||
* @param options The {@link WriteOptions} to use
|
||||
@@ -369,7 +369,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given object from the table by id.
|
||||
*
|
||||
*
|
||||
* @param object
|
||||
*/
|
||||
<T> void delete(T entity);
|
||||
@@ -383,7 +383,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given object from the table by id.
|
||||
*
|
||||
*
|
||||
* @param object
|
||||
*/
|
||||
<T> void delete(List<T> entities);
|
||||
@@ -397,14 +397,14 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given object from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entity The object to delete
|
||||
*/
|
||||
<T> Cancellable deleteAsynchronously(T entity);
|
||||
|
||||
/**
|
||||
* Remove the given object from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entity The object to delete
|
||||
* @param options The {@link QueryOptions} to use
|
||||
*/
|
||||
@@ -412,7 +412,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given object from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entity The object to delete
|
||||
* @param listener The {@link DeletionListener} to receive notification upon completion
|
||||
*/
|
||||
@@ -420,7 +420,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given object from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entity The object to delete
|
||||
* @param listener The {@link DeletionListener} to receive notification upon completion
|
||||
* @param options The {@link QueryOptions} to use
|
||||
@@ -429,14 +429,14 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given objects from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entities The objects to delete
|
||||
*/
|
||||
<T> Cancellable deleteAsynchronously(List<T> entities);
|
||||
|
||||
/**
|
||||
* Remove the given objects from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entities The objects to delete
|
||||
* @param listener The {@link DeletionListener} to receive notification upon completion
|
||||
*/
|
||||
@@ -444,7 +444,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given objects from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entities The objects to delete
|
||||
* @param options The {@link QueryOptions} to use
|
||||
*/
|
||||
@@ -452,7 +452,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Remove the given objects from the table by id.
|
||||
*
|
||||
*
|
||||
* @param entities The objects to delete
|
||||
* @param listener The {@link DeletionListener} to receive notification upon completion
|
||||
* @param options The {@link QueryOptions} to use
|
||||
@@ -461,7 +461,7 @@ public interface CassandraOperations extends CqlOperations {
|
||||
|
||||
/**
|
||||
* Returns the underlying {@link CassandraConverter}.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
CassandraConverter getConverter();
|
||||
|
||||
@@ -67,6 +67,7 @@ import com.datastax.driver.core.querybuilder.Update;
|
||||
* @author Matthew T. Adams
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author John Blum
|
||||
* @see CqlTemplate
|
||||
* @see CassandraOperations
|
||||
*/
|
||||
@@ -100,13 +101,12 @@ public class CassandraTemplate extends CqlTemplate implements CassandraOperation
|
||||
setConverter(resolveConverter(converter));
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private static CassandraConverter resolveConverter(CassandraConverter cassandraConverter) {
|
||||
return (cassandraConverter != null ? cassandraConverter : getDefaultCassandraConverter());
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
private static CassandraConverter getDefaultCassandraConverter() {
|
||||
|
||||
MappingCassandraConverter mappingCassandraConverter = new MappingCassandraConverter();
|
||||
mappingCassandraConverter.afterPropertiesSet();
|
||||
return mappingCassandraConverter;
|
||||
|
||||
Reference in New Issue
Block a user