use of io.siddhi.core.util.collection.AddingStreamEventExtractor in project siddhi by wso2.
the class TestStoreContainingInMemoryTable method updateOrAdd.
@Override
protected void updateOrAdd(CompiledCondition updateCondition, List<Map<String, Object>> updateConditionParameterMaps, Map<String, CompiledExpression> updateSetExpressions, List<Map<String, Object>> updateSetParameterMaps, List<Object[]> addingRecords) throws ConnectionUnavailableException {
MetaStreamEvent tableMetaStreamEvent = new MetaStreamEvent();
tableMetaStreamEvent.setEventType(MetaStreamEvent.EventType.TABLE);
TableDefinition matchingTableDefinition = TableDefinition.id("");
for (Attribute attribute : inMemoryTable.getTableDefinition().getAttributeList()) {
tableMetaStreamEvent.addOutputData(attribute);
matchingTableDefinition.attribute(attribute.getName(), attribute.getType());
}
tableMetaStreamEvent.addInputDefinition(matchingTableDefinition);
MatchingMetaInfoHolder matchingMetaInfoHolder = MatcherParser.constructMatchingMetaStateHolder(tableMetaStreamEvent, 0, inMemoryTable.getTableDefinition(), 0);
UpdateSet updateSet = new UpdateSet();
for (Attribute attribute : matchingMetaInfoHolder.getMatchingStreamDefinition().getAttributeList()) {
updateSet.set(new Variable(attribute.getName()), new Variable(attribute.getName()));
}
CompiledUpdateSet compiledUpdateSet = inMemoryTable.compileUpdateSet(updateSet, matchingMetaInfoHolder, null, tableMap, null);
inMemoryTable.updateOrAdd(convForUpdate(updateSetParameterMaps), updateCondition, compiledUpdateSet, new AddingStreamEventExtractor(matchingMetaInfoHolder.getMatchingStreamEventIndex()));
}
Aggregations