예제 #1
0
        public override void HandleMatching(
            EventBean[] triggerEvents,
            EventBean[] matchingEvents)
        {
            agentInstanceContext.InstrumentationProvider.QInfraOnAction(
                OnTriggerType.ON_SELECT,
                triggerEvents,
                matchingEvents);

            // clear state from prior results
            resultSetProcessor.Clear();

            // build join result
            // use linked hash set to retain order of join results for last/first/window to work most intuitively
            ISet<MultiKeyArrayOfKeys<EventBean>> newEvents =
                OnExprViewNamedWindowSelect.BuildJoinResult(triggerEvents, matchingEvents);

            // process matches
            UniformPair<EventBean[]> pair = resultSetProcessor.ProcessJoinResult(
                newEvents,
                Collections.GetEmptySet<MultiKeyArrayOfKeys<EventBean>>(),
                false);
            EventBean[] newData = pair?.First;

            // handle distinct and insert
            newData = InfraOnSelectUtil.HandleDistintAndInsert(
                newData,
                parent,
                agentInstanceContext,
                tableInstanceInsertInto,
                audit);

            // The on-select listeners receive the events selected
            if ((newData != null) && (newData.Length > 0)) {
                // And post only if we have listeners/subscribers that need the data
                StatementResultService statementResultService = agentInstanceContext.StatementResultService;
                if (statementResultService.IsMakeNatural || statementResultService.IsMakeSynthetic) {
                    Child.Update(newData, null);
                }
            }

            // clear state from prior results
            resultSetProcessor.Clear();

            // Events to delete are indicated via old data
            if (deleteAndSelect) {
                foreach (EventBean @event in matchingEvents) {
                    tableInstance.DeleteEvent(@event);
                }
            }

            agentInstanceContext.InstrumentationProvider.AInfraOnAction();
        }
예제 #2
0
        public override void HandleMatching(
            EventBean[] triggerEvents,
            EventBean[] matchingEvents)
        {
            agentInstanceContext.InstrumentationProvider.QInfraOnAction(
                OnTriggerType.ON_SELECT,
                triggerEvents,
                matchingEvents);

            // clear state from prior results
            resultSetProcessor.Clear();

            // build join result
            // use linked hash set to retain order of join results for last/first/window to work most intuitively
            var newEvents = BuildJoinResult(triggerEvents, matchingEvents);

            // process matches
            var pair = resultSetProcessor.ProcessJoinResult(newEvents, oldEvents, false);
            var newData = pair != null ? pair.First : null;

            // handle distinct and insert
            newData = InfraOnSelectUtil.HandleDistintAndInsert(
                newData,
                parent,
                agentInstanceContext,
                tableInstanceInsertInto,
                audit);

            // The on-select listeners receive the events selected
            if (newData != null && newData.Length > 0) {
                if (Child != null) {
                    // And post only if we have listeners/subscribers that need the data
                    var statementResultService = agentInstanceContext.StatementResultService;
                    if (statementResultService.IsMakeNatural || statementResultService.IsMakeSynthetic) {
                        Child.Update(newData, null);
                    }
                }
            }

            // clear state from prior results
            resultSetProcessor.Clear();

            // Events to delete are indicated via old data
            if (isDelete) {
                rootView.Update(null, matchingEvents);
            }

            agentInstanceContext.InstrumentationProvider.AInfraOnAction();
        }
예제 #3
0
        public override void HandleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QInfraOnAction(OnTriggerType.ON_SELECT, triggerEvents, matchingEvents);
            }

            EventBean[] newData;

            // clear state from prior results
            _resultSetProcessor.Clear();

            // build join result
            // use linked hash set to retain order of join results for last/first/window to work most intuitively
            ISet <MultiKey <EventBean> > newEvents = NamedWindowOnSelectView.BuildJoinResult(triggerEvents, matchingEvents);

            // process matches
            UniformPair <EventBean[]> pair = _resultSetProcessor.ProcessJoinResult(newEvents, Collections.GetEmptySet <MultiKey <EventBean> >(), false);

            newData = (pair != null ? pair.First : null);

            if (_parent.IsDistinct)
            {
                newData = EventBeanUtility.GetDistinctByProp(newData, _parent.EventBeanReader);
            }

            if (_parent.InternalEventRouter != null)
            {
                if (newData != null)
                {
                    for (int i = 0; i < newData.Length; i++)
                    {
                        if (_audit)
                        {
                            AuditPath.AuditInsertInto(ExprEvaluatorContext.EngineURI, ExprEvaluatorContext.StatementName, newData[i]);
                        }
                        _parent.InternalEventRouter.Route(newData[i], _parent.StatementHandle, _parent.InternalEventRouteDest, ExprEvaluatorContext, false);
                    }
                }
            }

            // The on-select listeners receive the events selected
            if ((newData != null) && (newData.Length > 0))
            {
                // And post only if we have listeners/subscribers that need the data
                if (_parent.StatementResultService.IsMakeNatural || _parent.StatementResultService.IsMakeSynthetic)
                {
                    UpdateChildren(newData, null);
                }
            }

            // clear state from prior results
            _resultSetProcessor.Clear();

            // Events to delete are indicated via old data
            if (_deleteAndSelect)
            {
                foreach (EventBean @event in matchingEvents)
                {
                    TableStateInstance.DeleteEvent(@event);
                }
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AInfraOnAction();
            }
        }
예제 #4
0
        public override void HandleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QInfraOnAction(OnTriggerType.ON_SELECT, triggerEvents, matchingEvents);
            }

            EventBean[] newData;

            // clear state from prior results
            _resultSetProcessor.Clear();

            // build join result
            // use linked hash set to retain order of join results for last/first/window to work most intuitively
            var newEvents = BuildJoinResult(triggerEvents, matchingEvents);

            // process matches
            var pair = _resultSetProcessor.ProcessJoinResult(newEvents, _oldEvents, false);

            newData = (pair != null ? pair.First : null);

            if (_parent.IsDistinct)
            {
                newData = EventBeanUtility.GetDistinctByProp(newData, _parent.EventBeanReader);
            }

            if (_tableStateInstanceInsertInto != null)
            {
                if (newData != null)
                {
                    foreach (var aNewData in newData)
                    {
                        if (_audit)
                        {
                            AuditPath.AuditInsertInto(ExprEvaluatorContext.EngineURI, ExprEvaluatorContext.StatementName, aNewData);
                        }
                        _tableStateInstanceInsertInto.AddEventUnadorned(aNewData);
                    }
                }
            }
            else if (_parent.InternalEventRouter != null)
            {
                if (newData != null)
                {
                    foreach (var aNewData in newData)
                    {
                        if (_audit)
                        {
                            AuditPath.AuditInsertInto(ExprEvaluatorContext.EngineURI, ExprEvaluatorContext.StatementName, aNewData);
                        }
                        _parent.InternalEventRouter.Route(aNewData, _parent.StatementHandle, _parent.InternalEventRouteDest, ExprEvaluatorContext, _parent.IsAddToFront);
                    }
                }
            }

            // The on-select listeners receive the events selected
            if ((newData != null) && (newData.Length > 0))
            {
                // And post only if we have listeners/subscribers that need the data
                if (_parent.StatementResultService.IsMakeNatural || _parent.StatementResultService.IsMakeSynthetic)
                {
                    UpdateChildren(newData, null);
                }
            }
            _lastResult = newData;

            // clear state from prior results
            _resultSetProcessor.Clear();

            // Events to delete are indicated via old data
            if (_isDelete)
            {
                RootView.Update(null, matchingEvents);
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AInfraOnAction();
            }
        }