List<MultiKeyUntyped> orderKeys = new ArrayList<MultiKeyUntyped>();
for (EventBean candidate : parent) {
eventsPerStream[0] = candidate;
MultiKeyUntyped groupKey = generateGroupKey(eventsPerStream, true);
aggregationService.setCurrentAccess(groupKey, agentInstanceContext.getAgentInstanceIds());
Boolean pass = true;
if (prototype.getOptionalHavingNode() != null) {
pass = (Boolean) prototype.getOptionalHavingNode().evaluate(eventsPerStream, true, agentInstanceContext);
}
if ((pass == null) || (!pass))
{
continue;
}
outgoingEvents.add(selectExprProcessor.process(eventsPerStream, true, true, agentInstanceContext));
MultiKeyUntyped orderKey = orderByProcessor.getSortKey(eventsPerStream, true, agentInstanceContext);
orderKeys.add(orderKey);
}
// sort
EventBean[] outgoingEventsArr = outgoingEvents.toArray(new EventBean[outgoingEvents.size()]);