SDN Controller Programming Guide

99
default:
range = null;
break;
}
// Find Rows for this filter
Procedure<CassandraStorable<String, Origin>> procedure =
new Procedure<CassandraStorable<String, Origin>>() {
@Override
public CassandraStorable<String, Origin> execute()
throws Exception {
return context.getContext()
.get(AlertsByOrigin.COL_FAMILY,
AlertsByOrigin.ROW_KEY, range,
AlertsByOrigin.ORIGIN_DECODER);
}
};
context.getTransactionContext()
.prepareTransaction(AlertsByOrigin.COL_FAMILY.getName(),
AlertsByOrigin.ROW_KEY);
CassandraStorable<String, Origin> rows = context
.getTransactionContext().
executeCriticalSection(procedure);
Collection<String> id = new ArrayList<String>();
for (Column<Origin, ?> orig : rows.getColumns()) {
id.add(orig.getName().getValue().getId());
}
// Add row Id's to the final Id set
rowsSet.retainAll(id);
}
// Severity Condition. Only IN is supported for now.
if (filter.getSeverityCondition() != null) {
switch(filter.getSeverityCondition().getMode()) {
case IN:
for (Severity sev : filter.getSeverityCondition().
getValues()) {
final ByteBufferRange range = AlertsBySeverity.serializer
.buildRange().withPrefix(sev.name()).
greaterThan(" ").lessThanEquals("~");
Procedure<CassandraStorable<String, SeverityComposite>>
procedure = new Procedure<CassandraStorable<String,
SeverityComposite>>() {