@Override
public List<TriggeredAlert> getTriggeredAlerts(String alertname, String accountName, Long fromTimeperiod, Long toTimeperiod) {
List<TriggeredAlert> triggeredAlertList = new ArrayList<TriggeredAlert>();
try {
MapReduceResult result = riakClient.mapReduce("Triggered_Alert;" + accountName)
.addKeyFilter(new TokenizeFilter(";",2))
.addKeyFilter(new StringToIntFilter())
.addKeyFilter(new BetweenFilter(fromTimeperiod, toTimeperiod))
.addMapPhase(new NamedJSFunction("Riak.mapValuesJson"), true)
.execute();
logger.info("Key Filter: " + result.getResultRaw().toString());
Collection<BasicTriggeredAlert> rtaList = result.getResult(BasicTriggeredAlert.class);
//TODO: Fix Key Filter so this is not neccessary!
for (BasicTriggeredAlert rta : rtaList) {
if (rta.getAlertName().equals(alertname)) {
triggeredAlertList.add(rta);