Search in sources :

Example 6 with HistoryEventHandler

use of org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler in project camunda-bpm-platform by camunda.

the class HistoryExecutionListener method notify.

public void notify(DelegateExecution execution) throws Exception {
    // get the event handler
    final HistoryEventHandler historyEventHandler = Context.getProcessEngineConfiguration().getHistoryEventHandler();
    // delegate creation of the history event to the producer
    HistoryEvent historyEvent = createHistoryEvent(execution);
    if (historyEvent != null) {
        // pass the event to the handler
        historyEventHandler.handleEvent(historyEvent);
    }
}
Also used : HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent)

Example 7 with HistoryEventHandler

use of org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler in project camunda-bpm-platform by camunda.

the class HistoryTaskListener method notify.

public void notify(DelegateTask task) {
    // get the event handler
    final HistoryEventHandler historyEventHandler = Context.getProcessEngineConfiguration().getHistoryEventHandler();
    ExecutionEntity execution = ((TaskEntity) task).getExecution();
    if (execution != null) {
        // delegate creation of the history event to the producer
        HistoryEvent historyEvent = createHistoryEvent(task, execution);
        if (historyEvent != null) {
            // pass the event to the handler
            historyEventHandler.handleEvent(historyEvent);
        }
    }
}
Also used : HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) TaskEntity(org.camunda.bpm.engine.impl.persistence.entity.TaskEntity) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent)

Example 8 with HistoryEventHandler

use of org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler in project camunda-bpm-platform by camunda.

the class CaseExecutionEntity method fireHistoricCaseActivityInstanceUpdate.

public void fireHistoricCaseActivityInstanceUpdate() {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE, this)) {
        CmmnHistoryEventProducer eventProducer = configuration.getCmmnHistoryEventProducer();
        HistoryEventHandler eventHandler = configuration.getHistoryEventHandler();
        HistoryEvent event = eventProducer.createCaseActivityInstanceUpdateEvt(this);
        eventHandler.handleEvent(event);
    }
}
Also used : HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) CmmnHistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.CmmnHistoryEventProducer) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 9 with HistoryEventHandler

use of org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler in project camunda-bpm-platform by camunda.

the class CompositeHistoryEventHandlerTest method testCompositeHistoryEventHandlerArgumentConstructorWithNotEmptyListNotNullTwoEvents.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoryLevelTest.bpmn20.xml" })
public void testCompositeHistoryEventHandlerArgumentConstructorWithNotEmptyListNotNullTwoEvents() {
    // prepare the list with two events
    List<HistoryEventHandler> historyEventHandlers = new ArrayList<HistoryEventHandler>();
    historyEventHandlers.add(new CustomDbHistoryEventHandler());
    historyEventHandlers.add(new DbHistoryEventHandler());
    CompositeHistoryEventHandler compositeHistoryEventHandler = new CompositeHistoryEventHandler(historyEventHandlers);
    processEngineConfiguration.setHistoryEventHandler(compositeHistoryEventHandler);
    startProcessAndCompleteUserTask();
    assertEquals(2, countCustomHistoryEventHandler);
    assertEquals(2, historyService.createHistoricDetailQuery().count());
}
Also used : CompositeHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler) DbHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler) HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) ArrayList(java.util.ArrayList) DbHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler) CompositeHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 10 with HistoryEventHandler

use of org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler in project camunda-bpm-platform by camunda.

the class CompositeHistoryEventHandlerTest method testCompositeHistoryEventHandlerArgumentConstructorWithEmptyList.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoryLevelTest.bpmn20.xml" })
public void testCompositeHistoryEventHandlerArgumentConstructorWithEmptyList() {
    CompositeHistoryEventHandler compositeHistoryEventHandler = new CompositeHistoryEventHandler(new ArrayList<HistoryEventHandler>());
    processEngineConfiguration.setHistoryEventHandler(compositeHistoryEventHandler);
    startProcessAndCompleteUserTask();
    assertEquals(0, countCustomHistoryEventHandler);
    assertEquals(0, historyService.createHistoricDetailQuery().count());
}
Also used : CompositeHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler) DbHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler) HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) CompositeHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler)10 Deployment (org.camunda.bpm.engine.test.Deployment)4 HistoryEvent (org.camunda.bpm.engine.impl.history.event.HistoryEvent)3 CompositeDbHistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.CompositeDbHistoryEventHandler)3 CompositeHistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler)3 DbHistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler)3 ArrayList (java.util.ArrayList)2 NullValueException (org.camunda.bpm.engine.exception.NullValueException)2 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)1 CmmnHistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.CmmnHistoryEventProducer)1 HistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)1 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)1 TaskEntity (org.camunda.bpm.engine.impl.persistence.entity.TaskEntity)1