Reference Guide

Table Of Contents
}
};
// Start the transaction
context.getTransactionContext()
.prepareTransaction(AlertsByTopic.COL_FAMILY.getName(),
AlertsByTopic.ROW_KEY);
CassandraStorable<String, Topic> rows = context
.getTransactionContext()
.executeCriticalSection(procedure);
// Add the rows to the row set
Collection<String> id = new ArrayList<String>();
for (Column<Topic, ?> topic : rows.getColumns()) {
id.add(topic.getName().getValue().getId());
}
// Add row Id's to the final Id set
if(rowsSet.isEmpty()) {
rowsSet.addAll(id);
} else {
rowsSet.retainAll(id);
}
}
// State Filter
if (filter.getStateCondition() != null) {
final ByteBufferRange range;
switch(filter.getStateCondition().getMode()) {
case EQUAL:
range = AlertsByState.serializer.buildRange()
.withPrefix(filter.getStateCondition().getValue())
.greaterThan(" ").lessThan("~");
break;
case UNEQUAL:
range = AlertsByState.serializer.buildRange()
.withPrefix(!filter.getStateCondition()
.getValue()).greaterThan(" ").lessThanEquals("~");
break;
default:
range = null;
break;
}
// Find Rows for this filter
Procedure<CassandraStorable<String, StateComposite>> procedure =
new Procedure<CassandraStorable<String, StateComposite>>() {
108