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

The following examples show how to use org.kie.api.event.rule.ObjectDeletedEvent. 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: RuleRuntimeEventTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testEventModel() throws Exception {
    final KieBase kbase = SerializationHelper.serializeObject(loadKnowledgeBase("test_EventModel.drl"));
    final KieSession wm = createKnowledgeSession(kbase);

    final RuleRuntimeEventListener wmel = mock(RuleRuntimeEventListener.class);
    wm.addEventListener(wmel);

    final Cheese stilton = new Cheese("stilton", 15);

    final FactHandle stiltonHandle = wm.insert(stilton);

    final ArgumentCaptor<ObjectInsertedEvent> oic = ArgumentCaptor.forClass(org.kie.api.event.rule.ObjectInsertedEvent.class);
    verify(wmel).objectInserted(oic.capture());
    assertSame(stiltonHandle, oic.getValue().getFactHandle());

    wm.update(stiltonHandle, stilton);
    final ArgumentCaptor<org.kie.api.event.rule.ObjectUpdatedEvent> ouc = ArgumentCaptor.forClass(org.kie.api.event.rule.ObjectUpdatedEvent.class);
    verify(wmel).objectUpdated(ouc.capture());
    assertSame(stiltonHandle, ouc.getValue().getFactHandle());

    wm.delete(stiltonHandle);
    final ArgumentCaptor<ObjectDeletedEvent> orc = ArgumentCaptor.forClass(ObjectDeletedEvent.class);
    verify(wmel).objectDeleted(orc.capture());
    assertSame(stiltonHandle, orc.getValue().getFactHandle());

}
 
Example #2
Source File: LoggingRuleRuntimeEventListener.java    From qzr with Apache License 2.0 5 votes vote down vote up
@Override
public void objectDeleted(final ObjectDeletedEvent event) {
    if ((handleFilter == null  && classFilter == null) 
            || event.getFactHandle() == handleFilter
            || event.getOldObject().getClass().equals(classFilter)) {
        log.trace("Retraction: " + DroolsUtil.objectDetails(event.getOldObject()));
    }
}
 
Example #3
Source File: TrackingRuleRuntimeEventListener.java    From qzr with Apache License 2.0 5 votes vote down vote up
@Override
public void objectDeleted(final ObjectDeletedEvent event) {
    if ((handleFilter == null  && classFilter == null) 
            || event.getFactHandle() == handleFilter
            || event.getOldObject().getClass().equals(classFilter)) {
        deletions.add(event);
        allEvents.add(event);
        log.trace("Retraction: " + DroolsUtil.objectDetails(event.getOldObject()));
    }
}
 
Example #4
Source File: WireListenerTest.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
@Override
public void objectDeleted(ObjectDeletedEvent event) {
    retractEvents.add(event);
}
 
Example #5
Source File: WorkingMemoryLogger.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
/**
 * @see org.kie.api.event.rule.RuleRuntimeEventListener
 */
public void objectDeleted(final ObjectDeletedEvent event) {
    filterLogEvent( new ObjectLogEvent( LogEvent.RETRACTED,
                                        ((InternalFactHandle) event.getFactHandle()).getId(),
                                        event.getOldObject().toString() ) );
}
 
Example #6
Source File: StatelessKieSessionMonitoringImpl.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
@Override
public void objectDeleted(ObjectDeletedEvent event) {
    this.data.objectsDeleted.incrementAndGet();
}
 
Example #7
Source File: DefaultRuleRuntimeEventListener.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void objectDeleted(final ObjectDeletedEvent event) {
    // intentionally left blank
}
 
Example #8
Source File: DebugRuleRuntimeEventListener.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void objectDeleted(ObjectDeletedEvent event) {
    logger.info( event.toString() );
}
 
Example #9
Source File: TestRuleRuntimeEventListener.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void objectDeleted(final ObjectDeletedEvent event) {
    this.deleted++;
}
 
Example #10
Source File: CepEngineImpl.java    From hawkular-alerts with Apache License 2.0 4 votes vote down vote up
@Override
public void objectDeleted(ObjectDeletedEvent event) {
    log.debug(event);
}
 
Example #11
Source File: TrackingRuleRuntimeEventListener.java    From qzr with Apache License 2.0 4 votes vote down vote up
public List<ObjectDeletedEvent> getRetractions() {
    return deletions;
}
 
Example #12
Source File: DebugRuleRuntimeEventListener.java    From servicemix with Apache License 2.0 4 votes vote down vote up
/**
 * @see RuleRuntimeEventListener#objectDeleted(org.kie.api.event.rule.ObjectDeletedEvent)
 */
@Override
public void objectDeleted(ObjectDeletedEvent event) {
    log.info("objectDeleted {}", event);
}
 
Example #13
Source File: DebugRuleRuntimeEventListener.java    From servicemix with Apache License 2.0 4 votes vote down vote up
/**
 * @see RuleRuntimeEventListener#objectDeleted(org.kie.api.event.rule.ObjectDeletedEvent)
 */
@Override
public void objectDeleted(ObjectDeletedEvent event) {
    log.info("objectDeleted {}", event);
}
 
Example #14
Source File: DebugRuleRuntimeEventListener.java    From servicemix with Apache License 2.0 4 votes vote down vote up
/**
 * @see RuleRuntimeEventListener#objectDeleted(org.kie.api.event.rule.ObjectDeletedEvent)
 */
@Override
public void objectDeleted(ObjectDeletedEvent event) {
    log.info("objectDeleted {}", event);
}