* Get the ids of all currently scheduled tasks
* @return tasksIds
*/
@Override
public Set<String> getTasks() {
ObjectDatastore datastore = new AnnotationObjectDatastore();
QueryResultIterator<GaeTask> query = datastore.find()
.type(GaeTask.class)
.addFilter("agentId", FilterOperator.EQUAL, agentId).now();
Set<String> taskIds = new HashSet<String>();
while (query.hasNext()) {
GaeTask task = query.next();
if (new DateTime(task.getTimestamp()).isAfterNow()) {
taskIds.add(task.getTaskId());
}
else {
// clean up expired entry
datastore.delete(task);
}
}
return taskIds;
}