Reference Guide

Table Of Contents
@Override
public CassandraStorable<String, StateComposite>
execute()
throws Exception {
return context.getContext()
.get(AlertsByState.COL_FAMILY,
AlertsByState.ROW_KEY, range,
AlertsByState.STATE_DECODER);
}
};
// Start the transaction
context.getTransactionContext()
.prepareTransaction(AlertsByState.COL_FAMILY.getName(),
AlertsByState.ROW_KEY);
CassandraStorable<String, StateComposite> rows = context
.getTransactionContext().executeCriticalSection(procedure);
// Add the rows to the row set
Collection<String> id = new ArrayList<String>();
for (Column<StateComposite, ?> state : rows.getColumns()) {
id.add(state.getName().getValue().getId());
}
// Add row Id's to the final Id set
if (rowsSet.isEmpty()) {
rowsSet.addAll(id);
} else {
rowsSet.retainAll(id);
}
}
return rowsSet;
}
findPagedRows()
Same as the previous one but takes paging into account.
CassandraAlertDao.java:
@Override
protected <M> MarkPage<String> findPagedRows(CassandraAlertFilter filter,
SortSpecification<CassandraAlertSortAttribute> sort,
final MarkPageRequest<M> pageRequest,
final DataStoreContext context) {
if (filter == null) {
if (pageRequest == null) {
throw new RuntimeException("Page request cannot be null");
109