use of org.wso2.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class IndexOperator method update.
@Override
public void update(ComplexEventChunk<StateEvent> updatingEventChunk, Object storeEvents, InMemoryCompiledUpdateSet compiledUpdateSet) {
updatingEventChunk.reset();
while (updatingEventChunk.hasNext()) {
StateEvent updatingEvent = updatingEventChunk.next();
StreamEvent streamEvents = collectionExecutor.find(updatingEvent, (IndexedEventHolder) storeEvents, null);
if (streamEvents != null) {
ComplexEventChunk<StreamEvent> foundEventChunk = new ComplexEventChunk<>(false);
foundEventChunk.add(streamEvents);
update((IndexedEventHolder) storeEvents, compiledUpdateSet, updatingEvent, foundEventChunk);
}
}
}
use of org.wso2.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class IndexOperator method delete.
@Override
public void delete(ComplexEventChunk<StateEvent> deletingEventChunk, Object storeEvents) {
deletingEventChunk.reset();
while (deletingEventChunk.hasNext()) {
StateEvent deletingEvent = deletingEventChunk.next();
collectionExecutor.delete(deletingEvent, (IndexedEventHolder) storeEvents);
}
}
use of org.wso2.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class AnyAndCollectionExecutor method find.
public StreamEvent find(StateEvent matchingEvent, IndexedEventHolder indexedEventHolder, StreamEventCloner storeEventCloner) {
Collection<StreamEvent> resultEventSet = findEvents(matchingEvent, indexedEventHolder);
ComplexEventChunk<StreamEvent> returnEventChunk = new ComplexEventChunk<StreamEvent>(false);
if (resultEventSet != null) {
for (StreamEvent resultEvent : resultEventSet) {
if (storeEventCloner != null) {
returnEventChunk.add(storeEventCloner.copyStreamEvent(resultEvent));
} else {
returnEventChunk.add(resultEvent);
}
}
return returnEventChunk.getFirst();
} else {
return exhaustiveCollectionExecutor.find(matchingEvent, indexedEventHolder, storeEventCloner);
}
}
use of org.wso2.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class ExhaustiveCollectionExecutor method find.
public StreamEvent find(StateEvent matchingEvent, IndexedEventHolder indexedEventHolder, StreamEventCloner storeEventCloner) {
ComplexEventChunk<StreamEvent> returnEventChunk = new ComplexEventChunk<StreamEvent>(false);
Collection<StreamEvent> storeEvents = indexedEventHolder.getAllEvents();
for (StreamEvent storeEvent : storeEvents) {
matchingEvent.setEvent(storeEventIndex, storeEvent);
if ((Boolean) expressionExecutor.execute(matchingEvent)) {
if (storeEventCloner != null) {
returnEventChunk.add(storeEventCloner.copyStreamEvent(storeEvent));
} else {
returnEventChunk.add(storeEvent);
}
}
matchingEvent.setEvent(storeEventIndex, null);
}
return returnEventChunk.getFirst();
}
use of org.wso2.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class ExhaustiveCollectionExecutor method findEvents.
public Collection<StreamEvent> findEvents(StateEvent matchingEvent, Collection<StreamEvent> preProcessedstoreEvents) {
HashSet<StreamEvent> streamEvents = new HashSet<StreamEvent>();
for (StreamEvent storeEvent : preProcessedstoreEvents) {
matchingEvent.setEvent(storeEventIndex, storeEvent);
if ((Boolean) expressionExecutor.execute(matchingEvent)) {
streamEvents.add(storeEvent);
}
matchingEvent.setEvent(storeEventIndex, null);
}
return streamEvents;
}
Aggregations