org.kie.api.event.rule.MatchCancelledEvent Java Examples

The following examples show how to use org.kie.api.event.rule.MatchCancelledEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkingMemoryLogger.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
/**
 * @see org.kie.api.event.rule.AgendaEventListener
 */
public void matchCancelled(MatchCancelledEvent event) {
    filterLogEvent( new ActivationLogEvent( LogEvent.ACTIVATION_CANCELLED,
                                            getActivationId( event.getMatch() ),
                                            event.getMatch().getRule().getName(),
                                            extractDeclarations( event.getMatch() ),
                                            ((RuleImpl)event.getMatch().getRule()).getRuleFlowGroup(),
                                            extractFactHandleIds( (Activation) event.getMatch() ) ) );
}
 
Example #2
Source File: AgendaEventSupport.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void fireActivationCancelled(final Activation activation,
                                    final WorkingMemory workingMemory,
                                    final MatchCancelledCause cause) {
    Iterator<AgendaEventListener> iter = getEventListenersIterator();
    MatchCancelledEvent event = new ActivationCancelledEventImpl(activation, getKRuntime(workingMemory), cause);

    if (iter.hasNext()) {
        
        do{
            iter.next().matchCancelled(event);
        }  while (iter.hasNext());
    }
}
 
Example #3
Source File: RuleCoverageListener.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void matchCancelled(MatchCancelledEvent event) {
}
 
Example #4
Source File: TestingEventListener.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void matchCancelled(MatchCancelledEvent event) {
}
 
Example #5
Source File: GenericKieSessionMonitoringImpl.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void matchCancelled(MatchCancelledEvent event) {
    this.consolidated.matchesCancelled.incrementAndGet();
    AgendaStatsData data = getRuleStatsInstance( event.getMatch().getRule().getName() );
    data.matchesCancelled.incrementAndGet();
}
 
Example #6
Source File: DefaultAgendaEventListener.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void matchCancelled(MatchCancelledEvent event) {
    // intentionally left blank
}
 
Example #7
Source File: DebugAgendaEventListener.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void matchCancelled(MatchCancelledEvent event) {
    logger.info( event.toString() );
}
 
Example #8
Source File: ProcessFlowControlTest.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
@Test
    public void testRuleFlowClear() throws Exception {
        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ruleflowClear.drl" ) ) );
        builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "test_ruleflowClear.rfm" ) ) );
        
        KieSession workingMemory = createKieSession(true, builder.getPackages());
        
        final List<String> list = new ArrayList<String>();
        workingMemory.setGlobal( "list",
                                 list );

        final List<Match> activations = new ArrayList<Match>();
        AgendaEventListener listener = new DefaultAgendaEventListener() {
            public void matchCancelled(MatchCancelledEvent event) { 
                activations.add( event.getMatch() );
            }
        };

        workingMemory.addEventListener( listener );
        InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();
//        assertEquals( 0,
//                      agenda.getRuleFlowGroup( "flowgroup-1" ).size() );

        // We need to call fireAllRules here to get the InitialFact into the system, to the eval(true)'s kick in
        workingMemory.fireAllRules();
        agenda.evaluateEagerList();

        // Now we have 4 in the RuleFlow, but not yet in the agenda
        assertEquals( 4,
                      agenda.sizeOfRuleFlowGroup( "flowgroup-1" ) );

        // Check they aren't in the Agenda
        assertEquals( 0,
                      agenda.getAgendaGroup( "MAIN" ).size() );

        // Check we have 0 activation cancellation events
        assertEquals( 0,
                      activations.size() );

        ((InternalAgenda) workingMemory.getAgenda()).clearAndCancelRuleFlowGroup( "flowgroup-1" );

        // Check the AgendaGroup and RuleFlowGroup  are now empty
        assertEquals( 0,
                      agenda.getAgendaGroup( "MAIN" ).size() );
        assertEquals( 0,
                      agenda.sizeOfRuleFlowGroup( "flowgroup-1" ) );

        // Check we have four activation cancellation events
        assertEquals( 4,
                      activations.size() );
    }
 
Example #9
Source File: CepEngineImpl.java    From hawkular-alerts with Apache License 2.0 4 votes vote down vote up
@Override
public void matchCancelled(MatchCancelledEvent event) {
    log.debug(event);
}
 
Example #10
Source File: DebugAgendaEventListener.java    From servicemix with Apache License 2.0 4 votes vote down vote up
/**
 * @see AgendaEventListener#matchCancelled(org.kie.api.event.rule.MatchCancelledEvent)
 */
@Override
public void matchCancelled(MatchCancelledEvent event) {
    log.info("{}", event);

}
 
Example #11
Source File: DebugAgendaEventListener.java    From servicemix with Apache License 2.0 4 votes vote down vote up
/**
 * @see AgendaEventListener#matchCancelled(org.kie.api.event.rule.MatchCancelledEvent)
 */
@Override
public void matchCancelled(MatchCancelledEvent event) {
    log.info("{}", event);

}
 
Example #12
Source File: DebugAgendaEventListener.java    From servicemix with Apache License 2.0 4 votes vote down vote up
/**
 * @see AgendaEventListener#matchCancelled(org.kie.api.event.rule.MatchCancelledEvent)
 */
@Override
public void matchCancelled(MatchCancelledEvent event) {
    log.info("{}", event);

}
 
Example #13
Source File: TriggerRulesEventListener.java    From kogito-runtimes with Apache License 2.0 2 votes vote down vote up
@Override
public void matchCancelled(MatchCancelledEvent event) {
    
}