use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class ReplaySimulationRun method initSimulationRunContext.
@Override
protected void initSimulationRunContext(VariableScope execution) {
SimulationRunContext.setEventCalendar(eventCalendar);
SimulationRunContext.setProcessEngine(processEngine);
ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
SimulationRunContext.setSimulationRunId(configuration.getIdGenerator().getNextId());
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class HistoricJPAVariableTest method initializeProcessEngine.
@Override
protected void initializeProcessEngine() {
if (cachedProcessEngine == null) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/activiti.cfg.xml");
cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration.getSessionFactories().get(EntityManagerSession.class);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
}
processEngine = cachedProcessEngine;
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class JPAVariableTest method initializeProcessEngine.
protected void initializeProcessEngine() {
if (cachedProcessEngine == null) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/activiti.cfg.xml");
cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration.getSessionFactories().get(EntityManagerSession.class);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
}
processEngine = cachedProcessEngine;
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class DefaultHistoryManager method recordProcessInstanceEnd.
// Process related history
/* (non-Javadoc)
* @see org.activiti.engine.impl.history.HistoryManagerInterface#recordProcessInstanceEnd(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public void recordProcessInstanceEnd(String processInstanceId, String deleteReason, String activityId) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager().findHistoricProcessInstance(processInstanceId);
if (historicProcessInstance != null) {
historicProcessInstance.markEnded(deleteReason);
historicProcessInstance.setEndActivityId(activityId);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.HISTORIC_PROCESS_INSTANCE_ENDED, historicProcessInstance));
}
}
}
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class DefaultHistoryManager method recordActivityStart.
// Activity related history
/* (non-Javadoc)
* @see org.activiti.engine.impl.history.HistoryManagerInterface#recordActivityStart(org.activiti.engine.impl.persistence.entity.ExecutionEntity)
*/
@Override
public void recordActivityStart(ExecutionEntity executionEntity) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
if (executionEntity.getActivity() != null) {
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
String processDefinitionId = executionEntity.getProcessDefinitionId();
String processInstanceId = executionEntity.getProcessInstanceId();
String executionId = executionEntity.getId();
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(processDefinitionId);
historicActivityInstance.setProcessInstanceId(processInstanceId);
historicActivityInstance.setExecutionId(executionId);
historicActivityInstance.setActivityId(executionEntity.getActivityId());
historicActivityInstance.setActivityName((String) executionEntity.getActivity().getProperty("name"));
historicActivityInstance.setActivityType((String) executionEntity.getActivity().getProperty("type"));
historicActivityInstance.setStartTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime());
// Inherit tenant id (if applicable)
if (executionEntity.getTenantId() != null) {
historicActivityInstance.setTenantId(executionEntity.getTenantId());
}
getDbSqlSession().insert(historicActivityInstance);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.HISTORIC_ACTIVITY_INSTANCE_CREATED, historicActivityInstance));
}
}
}
}
Aggregations