Search in sources :

Example 11 with HistoryEvent

use of org.camunda.bpm.engine.impl.history.event.HistoryEvent in project camunda-bpm-platform by camunda.

the class DefaultFormHandler method fireFormPropertyHistoryEvents.

protected void fireFormPropertyHistoryEvents(VariableMap properties, VariableScope variableScope) {
    final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = processEngineConfiguration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.FORM_PROPERTY_UPDATE, variableScope)) {
        // fire history events
        final ExecutionEntity executionEntity;
        final String taskId;
        if (variableScope instanceof ExecutionEntity) {
            executionEntity = (ExecutionEntity) variableScope;
            taskId = null;
        } else if (variableScope instanceof TaskEntity) {
            TaskEntity task = (TaskEntity) variableScope;
            executionEntity = task.getExecution();
            taskId = task.getId();
        } else {
            executionEntity = null;
            taskId = null;
        }
        if (executionEntity != null) {
            for (final String variableName : properties.keySet()) {
                final TypedValue value = properties.getValueTyped(variableName);
                // NOTE: SerializableValues are never stored as form properties
                if (!(value instanceof SerializableValue) && value.getValue() != null && value.getValue() instanceof String) {
                    final String stringValue = (String) value.getValue();
                    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

                        @Override
                        public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                            return producer.createFormPropertyUpdateEvt(executionEntity, variableName, stringValue, taskId);
                        }
                    });
                }
            }
        }
    }
}
Also used : TaskEntity(org.camunda.bpm.engine.impl.persistence.entity.TaskEntity) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) SerializableValue(org.camunda.bpm.engine.variable.value.SerializableValue) HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) HistoryEventProcessor(org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor) HistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Example 12 with HistoryEvent

use of org.camunda.bpm.engine.impl.history.event.HistoryEvent 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 13 with HistoryEvent

use of org.camunda.bpm.engine.impl.history.event.HistoryEvent 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 14 with HistoryEvent

use of org.camunda.bpm.engine.impl.history.event.HistoryEvent 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 15 with HistoryEvent

use of org.camunda.bpm.engine.impl.history.event.HistoryEvent in project camunda-bpm-platform by camunda.

the class ExecutionEntity method fireHistoricProcessStartEvent.

@Override
public void fireHistoricProcessStartEvent() {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    // ParseListener
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_START, processInstance)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

            @Override
            public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                return producer.createProcessInstanceStartEvt(processInstance);
            }
        });
    }
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) HistoryEventProcessor(org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor) HistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Aggregations

HistoryEvent (org.camunda.bpm.engine.impl.history.event.HistoryEvent)18 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)16 HistoryEventProcessor (org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor)15 HistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)15 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)13 HistoryEventHandler (org.camunda.bpm.engine.impl.history.handler.HistoryEventHandler)3 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)3 TaskEntity (org.camunda.bpm.engine.impl.persistence.entity.TaskEntity)2 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)1 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 HistoricProcessInstanceEventEntity (org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity)1 CmmnHistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.CmmnHistoryEventProducer)1 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)1 ExecutionManager (org.camunda.bpm.engine.impl.persistence.entity.ExecutionManager)1 IncidentEntity (org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity)1 JobDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionEntity)1 JobEntity (org.camunda.bpm.engine.impl.persistence.entity.JobEntity)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1