Code review cleanup. Commit test for new repo.

This commit is contained in:
David Webb
2013-12-06 16:27:19 -05:00
parent 46a7b9c131
commit 25ec3f59c8
4 changed files with 20 additions and 45 deletions

View File

@@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -805,19 +806,27 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
* @see org.springframework.cassandra.core.CassandraOperations#execute(java.lang.String, java.util.List)
*/
@Override
public void ingest(String cql, List<List<?>> rows, Map<String, Object> optionsByName) {
public void ingest(String cql, final List<List<?>> rows, Map<String, Object> optionsByName) {
Assert.notNull(optionsByName);
Assert.notNull(rows);
Assert.notEmpty(rows);
Object[][] values = new Object[rows.size()][];
int i = 0;
for (List<?> row : rows) {
values[i++] = row.toArray();
}
ingest(cql, new RowIterator() {
ingest(cql, values, optionsByName);
Iterator<List<?>> i = rows.iterator();
@Override
public Object[] next() {
return i.next().toArray();
}
@Override
public boolean hasNext() {
return i.hasNext();
}
}, optionsByName);
}
@@ -895,7 +904,7 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
* @param q
* @param optionsByName
*/
public static void addQueryOptions(Query q, Map<String, Object> optionsByName) {
protected static void addQueryOptions(Query q, Map<String, Object> optionsByName) {
if (optionsByName == null) {
return;
@@ -921,7 +930,7 @@ public class CassandraTemplate extends CassandraAccessor implements CassandraOpe
* @param q
* @param optionsByName
*/
public static void addPreparedStatementOptions(PreparedStatement s, Map<String, Object> optionsByName) {
protected static void addPreparedStatementOptions(PreparedStatement s, Map<String, Object> optionsByName) {
if (optionsByName == null) {
return;

View File

@@ -1,26 +0,0 @@
/*
* Copyright 2011-2013 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cassandra.core;
/**
* @author David Webb
*
*/
public interface CqlProvider {
String getCql();
}

View File

@@ -26,7 +26,7 @@ import com.datastax.driver.core.exceptions.DriverException;
* @author David Webb
*
*/
public class PreparedStatementCreatorImpl implements PreparedStatementCreator, CqlProvider, PreparedStatementBinder {
public class PreparedStatementCreatorImpl implements PreparedStatementCreator, PreparedStatementBinder {
private final String cql;
private List<Object> values;
@@ -54,10 +54,6 @@ public class PreparedStatementCreatorImpl implements PreparedStatementCreator, C
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CqlProvider#getCql()
*/
@Override
public String getCql() {
return this.cql;
}

View File

@@ -25,7 +25,7 @@ import com.datastax.driver.core.exceptions.DriverException;
* @author David Webb
*
*/
public class SimplePreparedStatementCreator implements PreparedStatementCreator, CqlProvider {
public class SimplePreparedStatementCreator implements PreparedStatementCreator {
private final String cql;
@@ -39,10 +39,6 @@ public class SimplePreparedStatementCreator implements PreparedStatementCreator,
this.cql = cql;
}
/* (non-Javadoc)
* @see org.springframework.cassandra.core.CqlProvider#getCql()
*/
@Override
public String getCql() {
return this.cql;
}