Search in sources :

Example 6 with HistoryEvent

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

the class MigratingActivityInstance method migrateActivityInstanceHistory.

protected void migrateActivityInstanceHistory(final DelegateExecution execution) {
    HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
    if (!historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_MIGRATE, this)) {
        return;
    }
    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

        @Override
        public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
            return producer.createActivityInstanceMigrateEvt(MigratingActivityInstance.this);
        }
    });
}
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)

Example 7 with HistoryEvent

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

the class MigratingActivityInstance method migrateProcessInstanceHistory.

protected void migrateProcessInstanceHistory(final DelegateExecution execution) {
    HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
    if (!historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_MIGRATE, this)) {
        return;
    }
    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

        @Override
        public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
            return producer.createProcessInstanceUpdateEvt(execution);
        }
    });
}
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)

Example 8 with HistoryEvent

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

the class HistoricTaskInstanceManager method updateHistoricTaskInstance.

public void updateHistoricTaskInstance(final TaskEntity taskEntity) {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = configuration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_UPDATE, taskEntity)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

            @Override
            public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                return producer.createTaskInstanceUpdateEvt(taskEntity);
            }
        });
    }
}
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)

Example 9 with HistoryEvent

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

the class IncidentEntity method fireHistoricIncidentEvent.

protected void fireHistoricIncidentEvent(final HistoryEventType eventType) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    HistoryLevel historyLevel = processEngineConfiguration.getHistoryLevel();
    if (historyLevel.isHistoryEventProduced(eventType, this)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

            @Override
            public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                HistoryEvent event = null;
                if (HistoryEvent.INCIDENT_CREATE.equals(eventType.getEventName())) {
                    event = producer.createHistoricIncidentCreateEvt(IncidentEntity.this);
                } else if (HistoryEvent.INCIDENT_RESOLVE.equals(eventType.getEventName())) {
                    event = producer.createHistoricIncidentResolveEvt(IncidentEntity.this);
                } else if (HistoryEvent.INCIDENT_DELETE.equals(eventType.getEventName())) {
                    event = producer.createHistoricIncidentDeleteEvt(IncidentEntity.this);
                }
                return event;
            }
        });
    }
}
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)

Example 10 with HistoryEvent

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

the class AbstractSetProcessInstanceStateCmd method triggerHistoryEvent.

@Override
protected void triggerHistoryEvent(CommandContext commandContext) {
    HistoryLevel historyLevel = commandContext.getProcessEngineConfiguration().getHistoryLevel();
    List<ProcessInstance> updatedProcessInstances = obtainProcessInstances(commandContext);
    // suspension state is not updated synchronously
    if (getNewSuspensionState() != null && updatedProcessInstances != null) {
        for (final ProcessInstance processInstance : updatedProcessInstances) {
            if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance)) {
                HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {

                    @Override
                    public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
                        HistoricProcessInstanceEventEntity processInstanceUpdateEvt = (HistoricProcessInstanceEventEntity) producer.createProcessInstanceUpdateEvt((DelegateExecution) processInstance);
                        if (SuspensionState.SUSPENDED.getStateCode() == getNewSuspensionState().getStateCode()) {
                            processInstanceUpdateEvt.setState(HistoricProcessInstance.STATE_SUSPENDED);
                        } else {
                            processInstanceUpdateEvt.setState(HistoricProcessInstance.STATE_ACTIVE);
                        }
                        return processInstanceUpdateEvt;
                    }
                });
            }
        }
    }
}
Also used : HistoryLevel(org.camunda.bpm.engine.impl.history.HistoryLevel) HistoryEventProcessor(org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor) HistoricProcessInstanceEventEntity(org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoryEventProducer(org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer) HistoryEvent(org.camunda.bpm.engine.impl.history.event.HistoryEvent)

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