SDN Controller Programming Guide
101
.getTopicCondition()
.getValue())
.lessThan("~");
break;
default:
range = null;
break;
}
// Find Rows for this filter
Procedure<CassandraStorable<String, Topic>> procedure =
new Procedure<CassandraStorable<String, Topic>>() {
@Override
public CassandraStorable<String, Topic> execute()
throws Exception {
return context.getContext()
.get(AlertsByTopic.COL_FAMILY,
AlertsByTopic.ROW_KEY, range,
AlertsByTopic.TOPIC_DECODER);
}
};
// 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()) {