use of org.ff4j.exception.AuditAccessException in project ff4j by ff4j.
the class EventRepositoryHBase method purgeAuditTrail.
/**
* {@inheritDoc}
*/
@Override
public void purgeAuditTrail(EventQueryDefinition query) {
try (Connection hbConn = ConnectionFactory.createConnection(conn.getConfig())) {
try (Table table = hbConn.getTable(AUDIT_TABLENAME)) {
query.getActionFilters().add(ACTION_CHECK_OK);
// Scan for ids
Scan scanQuery = buildQuery(query, Util.set(COL_EVENT_UID), null);
List<Delete> list = new ArrayList<Delete>();
try (ResultScanner scanner = table.getScanner(scanQuery)) {
for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
list.add(new Delete(rr.getValue(B_AUDIT_CF, B_EVENT_UID)));
}
}
table.delete(list);
}
} catch (IOException e) {
throw new AuditAccessException("Cannot search audit trail ", e);
}
}
Aggregations