use of org.apache.storm.cassandra.query.Column in project storm by apache.
the class BoundCQLStatementTupleMapper method map.
/**
* {@inheritDoc}
*/
@Override
public List<Statement> map(Map config, Session session, ITuple tuple) {
final List<Column> columns = mapper.map(tuple);
final String query = contextQuery.resolves(config, tuple);
PreparedStatement statement = getPreparedStatement(session, query);
if (hasRoutingKeys()) {
List<ByteBuffer> keys = rkGenerator.getRoutingKeys(tuple);
if (keys.size() == 1)
statement.setRoutingKey(keys.get(0));
else
statement.setRoutingKey(keys.toArray(new ByteBuffer[keys.size()]));
}
return Arrays.asList((Statement) this.binder.apply(statement, columns));
}
use of org.apache.storm.cassandra.query.Column in project storm by apache.
the class BoundCQLStatementTupleMapper method map.
/**
* {@inheritDoc}
*/
@Override
public List<Statement> map(Map<String, Object> config, Session session, ITuple tuple) {
final List<Column> columns = mapper.map(tuple);
final String query = contextQuery.resolves(config, tuple);
PreparedStatement statement = getPreparedStatement(session, query);
if (hasRoutingKeys()) {
List<ByteBuffer> keys = rkGenerator.getRoutingKeys(tuple);
if (keys.size() == 1) {
statement.setRoutingKey(keys.get(0));
} else {
statement.setRoutingKey(keys.toArray(new ByteBuffer[keys.size()]));
}
}
return Arrays.asList((Statement) this.binder.apply(statement, columns));
}
use of org.apache.storm.cassandra.query.Column in project storm by apache.
the class SimpleCQLStatementMapper method map.
/**
* {@inheritDoc}.
*/
@Override
public List<Statement> map(Map<String, Object> conf, Session session, ITuple tuple) {
List<Column> columns = mapper.map(tuple);
SimpleStatement statement = new SimpleStatement(queryString, Column.getVals(columns));
if (hasRoutingKeys()) {
List<ByteBuffer> keys = rkGenerator.getRoutingKeys(tuple);
if (keys.size() == 1) {
statement.setRoutingKey(keys.get(0));
} else {
statement.setRoutingKey(keys.toArray(new ByteBuffer[keys.size()]));
}
}
return Arrays.asList((Statement) statement);
}
use of org.apache.storm.cassandra.query.Column in project storm by apache.
the class SimpleCQLStatementMapper method map.
/**
* {@inheritDoc}.
*/
@Override
public List<Statement> map(Map conf, Session session, ITuple tuple) {
List<Column> columns = mapper.map(tuple);
SimpleStatement statement = new SimpleStatement(queryString, Column.getVals(columns));
if (hasRoutingKeys()) {
List<ByteBuffer> keys = rkGenerator.getRoutingKeys(tuple);
if (keys.size() == 1)
statement.setRoutingKey(keys.get(0));
else
statement.setRoutingKey(keys.toArray(new ByteBuffer[keys.size()]));
}
return Arrays.asList((Statement) statement);
}
Aggregations