use of org.wso2.carbon.registry.api.Collection 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.carbon.registry.api.Collection 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.carbon.registry.api.Collection 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;
}
use of org.wso2.carbon.registry.api.Collection in project siddhi by wso2.
the class ExhaustiveCollectionExecutor method delete.
@Override
public void delete(StateEvent deletingEvent, IndexedEventHolder indexedEventHolder) {
Collection<StreamEvent> storeEvents = indexedEventHolder.getAllEvents();
Set<StreamEvent> toDeleteEvents = new HashSet<StreamEvent>();
for (StreamEvent storeEvent : storeEvents) {
deletingEvent.setEvent(storeEventIndex, storeEvent);
if ((Boolean) expressionExecutor.execute(deletingEvent)) {
toDeleteEvents.add(storeEvent);
}
deletingEvent.setEvent(storeEventIndex, null);
}
indexedEventHolder.deleteAll(toDeleteEvents);
}
use of org.wso2.carbon.registry.api.Collection in project carbon-apimgt by wso2.
the class DynamicHtmlGenTestCase method testToApiName.
@Test
public void testToApiName() throws Exception {
DynamicHtmlGen htmlGen = new DynamicHtmlGen();
final String originalTag = "API (Collection)";
String sanitised = htmlGen.sanitizeTag(originalTag);
Assert.assertEquals(sanitised, "APICollection");
String retrievedTag = htmlGen.toApiName(sanitised);
Assert.assertEquals(retrievedTag, originalTag);
sanitised = htmlGen.toApiFilename(originalTag);
Assert.assertEquals(sanitised, "APICollection");
}
Aggregations