use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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;
}
});
}
}
}
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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);
}
});
}
}
}
}
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer 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);
}
});
}
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceManager method createHistoricTask.
public void createHistoricTask(final TaskEntity task) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
HistoryLevel historyLevel = configuration.getHistoryLevel();
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_CREATE, task)) {
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
return producer.createTaskInstanceCreateEvt(task);
}
});
}
}
use of org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceManager method markTaskInstanceEnded.
public void markTaskInstanceEnded(String taskId, final String deleteReason) {
ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
final TaskEntity taskEntity = Context.getCommandContext().getDbEntityManager().selectById(TaskEntity.class, taskId);
HistoryLevel historyLevel = configuration.getHistoryLevel();
if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_COMPLETE, taskEntity)) {
HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
@Override
public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
return producer.createTaskInstanceCompleteEvt(taskEntity, deleteReason);
}
});
}
}
Aggregations