Search in sources :

Example 6 with Collection

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);
    }
}
Also used : ComplexEventChunk(org.wso2.siddhi.core.event.ComplexEventChunk) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent)

Example 7 with Collection

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();
}
Also used : ComplexEventChunk(org.wso2.siddhi.core.event.ComplexEventChunk) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent)

Example 8 with Collection

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;
}
Also used : StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent) HashSet(java.util.HashSet)

Example 9 with Collection

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);
}
Also used : StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent) HashSet(java.util.HashSet)

Example 10 with Collection

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");
}
Also used : DynamicHtmlGen(org.wso2.carbon.apimgt.rest.api.common.codegen.DynamicHtmlGen) Test(org.testng.annotations.Test)

Aggregations

StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)13 Collection (java.util.Collection)9 ArrayList (java.util.ArrayList)8 ComplexEventChunk (org.wso2.siddhi.core.event.ComplexEventChunk)8 IOException (java.io.IOException)7 Collection (org.wso2.carbon.registry.core.Collection)7 Map (java.util.Map)6 HashSet (java.util.HashSet)5 File (java.io.File)4 InstanceFilter (org.apache.ode.bpel.common.InstanceFilter)4 BpelDAOConnection (org.apache.ode.bpel.dao.BpelDAOConnection)4 ProcessInstanceDAO (org.apache.ode.bpel.dao.ProcessInstanceDAO)4 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)4 Test (org.testng.annotations.Test)4 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)4 InstanceManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 HashMap (java.util.HashMap)3 Response (javax.ws.rs.core.Response)3 JAXBContext (javax.xml.bind.JAXBContext)3