use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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);
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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);
}
});
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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);
}
});
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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);
}
});
}
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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;
}
});
}
}
Aggregations