SDN Controller Programming Guide
90
(DateColumn) row2.getColumn(TIMESTAMP_COL_NAME);
retVal = time1.compareTo(time2);
break;
case SEVERITY:
EnumColumn<String, Severity> sev1 =
(EnumColumn) row1.getColumn(SEVERITY_COL_NAME);
EnumColumn<String, Severity> sev2 =
(EnumColumn) row2.getColumn(SEVERITY_COL_NAME);
retVal = sev1.compareTo(sev2);
break;
case STATE:
BooleanColumn<String> state1 =
(BooleanColumn) row1.getColumn(STATE_COL_NAME);
BooleanColumn<String> state2 =
(BooleanColumn) row2.getColumn(STATE_COL_NAME);
retVal = state1.compareTo(state2);
break;
case TOPIC:
StringColumn<String> topic1 =
(StringColumn) row1.getColumn(TOPIC_COL_NAME);
StringColumn<String> topic2 =
(StringColumn) row2.getColumn(TOPIC_COL_NAME);
retVal = topic1.compareTo(topic2);
break;
}
return retVal;
}
}
...
In this code, there is defined a constructor and the main column family. The Alerts in this code is
the main column family in the CassandraAlertDao and has following columns:
sysId
severity
timestamp
origin
topic
description
state
These columns are defined along with the data type for each column, a decoder to assist in the
read operation and a method to compare columns while sorting a read result.
In addition to this column family, free form queries are supported on a combination of values of
severity, timestamp, origin, topic, state and description.