Search in sources :

Example 1 with HistoryEventHandler

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

the class HistoryEventProcessor method processHistoryEvents.

/**
 * Process an {@link HistoryEvent} and handle them directly after creation.
 * The {@link HistoryEvent} is created with the help of the given
 * {@link HistoryEventCreator} implementation.
 *
 * @param creator the creator is used to create the {@link HistoryEvent} which should be thrown
 */
public static void processHistoryEvents(HistoryEventCreator creator) {
    HistoryEventProducer historyEventProducer = Context.getProcessEngineConfiguration().getHistoryEventProducer();
    HistoryEventHandler historyEventHandler = Context.getProcessEngineConfiguration().getHistoryEventHandler();
    HistoryEvent singleEvent = creator.createHistoryEvent(historyEventProducer);
    if (singleEvent != null) {
        historyEventHandler.handleEvent(singleEvent);
    }
    List<HistoryEvent> eventList = creator.createHistoryEvents(historyEventProducer);
    historyEventHandler.handleEvents(eventList);
}
Also used : HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) HistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)

Example 2 with HistoryEventHandler

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

the class CompositeDbHistoryEventHandlerTest method testCompositeDbHistoryEventHandlerArgumentConstructorWithEmptyList.

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

Example 3 with HistoryEventHandler

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

the class CompositeDbHistoryEventHandlerTest method testCompositeDbHistoryEventHandlerArgumentConstructorWithNotEmptyListNotNullTwoEvents.

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

Example 4 with HistoryEventHandler

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

the class CompositeDbHistoryEventHandlerTest method testCompositeDbHistoryEventHandlerArgumentConstructorWithNullVarargs.

public void testCompositeDbHistoryEventHandlerArgumentConstructorWithNullVarargs() {
    HistoryEventHandler historyEventHandler = null;
    try {
        new CompositeDbHistoryEventHandler(historyEventHandler);
        fail("NullValueException expected");
    } catch (NullValueException e) {
        assertTextPresent("History event handler is null", e.getMessage());
    }
}
Also used : HistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler) CompositeDbHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.CompositeDbHistoryEventHandler) CompositeDbHistoryEventHandler(org.camunda.bpm.engine.impl.history.handler.CompositeDbHistoryEventHandler) NullValueException(org.camunda.bpm.engine.exception.NullValueException)

Example 5 with HistoryEventHandler

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

the class CompositeHistoryEventHandlerTest method testCompositeHistoryEventHandlerArgumentConstructorWithNullVarargs.

public void testCompositeHistoryEventHandlerArgumentConstructorWithNullVarargs() {
    HistoryEventHandler historyEventHandler = null;
    try {
        new CompositeHistoryEventHandler(historyEventHandler);
        fail("NullValueException expected");
    } catch (NullValueException e) {
        assertTextPresent("History event handler is null", e.getMessage());
    }
}
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) NullValueException(org.camunda.bpm.engine.exception.NullValueException)

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