use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TestVariableEventListenerStore method onEvent.
@Override
public void onEvent(ActivitiEvent event) {
if (event instanceof ActivitiVariableEvent) {
eventsReceived.add(event);
EventLogEntryEntity eventLogEntry = new EventLogEntryEntity();
eventLogEntry.setProcessDefinitionId(event.getProcessDefinitionId());
eventLogEntry.setProcessInstanceId(event.getProcessInstanceId());
eventLogEntry.setExecutionId(event.getExecutionId());
eventLogEntry.setTaskId(((ActivitiVariableEvent) event).getTaskId());
eventLogEntry.setType(event.getType().name());
eventLogEntry.setTimeStamp(new Date());
CommandContext commandContext = Context.getCommandContext();
commandContext.getEventLogEntryEntityManager().insert(eventLogEntry);
}
}
use of org.activiti.engine.impl.interceptor.CommandContext in project Activiti by Activiti.
the class TimerEventCompatibilityTest method changeConfigurationToPlainText.
protected void changeConfigurationToPlainText(JobEntity job) {
String activityId = TimerEventHandler.getActivityIdFromConfiguration(job.getJobHandlerConfiguration());
final JobEntity finalJob = job;
CommandExecutor commandExecutor = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getCommandExecutor();
CommandConfig config = new CommandConfig().transactionNotSupported();
final String finalActivityId = activityId;
commandExecutor.execute(config, new Command<Object>() {
public Object execute(CommandContext commandContext) {
DbSqlSession session = commandContext.getSession(DbSqlSession.class);
session.delete(finalJob);
session.flush();
session.commit();
return null;
}
});
commandExecutor.execute(config, new Command<Object>() {
public Object execute(CommandContext commandContext) {
DbSqlSession session = commandContext.getSession(DbSqlSession.class);
finalJob.setJobHandlerConfiguration(finalActivityId);
finalJob.setId(null);
session.insert(finalJob);
session.flush();
session.commit();
return null;
}
});
}
Aggregations