SDN Controller Programming Guide

104
result = context
.getTransactionContext()
.executeCriticalSection(procedure);
} catch (Exception e) {
throw new PersistenceException(e);
}
// Get the list of Ids from the page
List<String> id = new ArrayList<String>();
for (Column<String, ?> c : result.getData()) {
id.add(c.getName().getValue());
}
MarkPageRequest<String> pageRequest1 =
result.getRequest().convert(result
.getRequest()
.getMark()
.getName()
.getValue());
return new MarkPage<String>(pageRequest1, id);
}
return null;
}
compareRows()
Compares two rows. This method is used for sorting the result set.
CassandraAlertDao.java:
@Override
protected int compareRows(CassandraStorable<String, String> row1,
CassandraStorable<String, String> row2,
SortSpecification
.SortComponent<CassandraAlertSortAttribute> s) {
if (s.getSortOrder() == SortOrder.ASCENDING) {
return AlertColumnFamily.compareColumns(row1, row2, s.getSortBy());
} else {
return AlertColumnFamily.compareColumns(row2, row1, s.getSortBy());
}
}
Storable
A storable is a format of data that the south bound side of the persistence layer operates on.
Every DTO is converted to a storable on its journey to the database and gets converted back to
DTO on its way back to the application. We define a generic storable called CassandraStorable
and is used by all DAOs for all DTOs.