本文整理汇总了Java中org.activiti.engine.impl.variable.EntityManagerSession类的典型用法代码示例。如果您正苦于以下问题:Java EntityManagerSession类的具体用法?Java EntityManagerSession怎么用?Java EntityManagerSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityManagerSession类属于org.activiti.engine.impl.variable包,在下文中一共展示了EntityManagerSession类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeProcessEngine
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
protected void initializeProcessEngine() {
if (cachedProcessEngine == null) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/flowable.cfg.xml");
cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) ((ProcessEngineConfigurationImpl) cachedProcessEngine
.getProcessEngineConfiguration()).getFlowable5CompatibilityHandler().getRawProcessConfiguration();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig
.getSessionFactories()
.get(EntityManagerSession.class);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
}
processEngine = cachedProcessEngine;
}
示例2: initializeProcessEngine
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
@Override
protected void initializeProcessEngine() {
if (cachedProcessEngine == null) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/flowable.cfg.xml");
cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
activiti5ProcessEngineConfig = (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) ((ProcessEngineConfigurationImpl) cachedProcessEngine.getProcessEngineConfiguration()).getFlowable5CompatibilityHandler()
.getRawProcessConfiguration();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig
.getSessionFactories()
.get(EntityManagerSession.class);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
setupJPAVariables();
}
processEngine = cachedProcessEngine;
}
示例3: initializeProcessEngine
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
@Override
protected void initializeProcessEngine() {
if (cachedProcessEngine == null) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/flowable.cfg.xml");
cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) ((ProcessEngineConfigurationImpl) cachedProcessEngine
.getProcessEngineConfiguration()).getFlowable5CompatibilityHandler().getRawProcessConfiguration();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig
.getSessionFactories()
.get(EntityManagerSession.class);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
}
processEngine = cachedProcessEngine;
}
示例4: initJpa
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
protected void initJpa() {
if (jpaPersistenceUnitName != null) {
jpaEntityManagerFactory = JpaHelper.createEntityManagerFactory(jpaPersistenceUnitName);
}
if (jpaEntityManagerFactory != null) {
sessionFactories.put(EntityManagerSession.class, new EntityManagerSessionFactory(jpaEntityManagerFactory, jpaHandleTransaction, jpaCloseEntityManager));
VariableType jpaType = variableTypes.getVariableType(JPAEntityVariableType.TYPE_NAME);
// Add JPA-type
if (jpaType == null) {
// We try adding the variable right before SerializableType, if available
int serializableIndex = variableTypes.getTypeIndex(SerializableType.TYPE_NAME);
if (serializableIndex > -1) {
variableTypes.addType(new JPAEntityVariableType(), serializableIndex);
} else {
variableTypes.addType(new JPAEntityVariableType());
}
}
jpaType = variableTypes.getVariableType(JPAEntityListVariableType.TYPE_NAME);
// Add JPA-list type after regular JPA type if not already present
if (jpaType == null) {
variableTypes.addType(new JPAEntityListVariableType(), variableTypes.getTypeIndex(JPAEntityVariableType.TYPE_NAME));
}
}
}
示例5: initializeProcessEngine
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
protected void initializeProcessEngine() {
if (cachedProcessEngine == null) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");
cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
.getSessionFactories()
.get(EntityManagerSession.class);
System.out.println("entityManagerSessionFactory=" + entityManagerSessionFactory);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
}
processEngine = cachedProcessEngine;
}
示例6: initJpa
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
protected void initJpa() {
if(jpaPersistenceUnitName!=null) {
jpaEntityManagerFactory = JpaHelper.createEntityManagerFactory(jpaPersistenceUnitName);
}
if(jpaEntityManagerFactory!=null) {
sessionFactories.put(EntityManagerSession.class, new EntityManagerSessionFactory(jpaEntityManagerFactory, jpaHandleTransaction, jpaCloseEntityManager));
VariableType jpaType = variableTypes.getVariableType(JPAEntityVariableType.TYPE_NAME);
// Add JPA-type
if(jpaType == null) {
// We try adding the variable right before SerializableType, if available
int serializableIndex = variableTypes.getTypeIndex(SerializableType.TYPE_NAME);
if(serializableIndex > -1) {
variableTypes.addType(new JPAEntityVariableType(), serializableIndex);
} else {
variableTypes.addType(new JPAEntityVariableType());
}
}
}
}
示例7: testReadJpaVariableValueFromHistoricVariableUpdate
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
@Deployment(resources = { "org/activiti/standalone/jpa/JPAVariableTest.testQueryJPAVariable.bpmn20.xml" })
public void testReadJpaVariableValueFromHistoricVariableUpdate() {
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) processEngineConfiguration.getFlowable5CompatibilityHandler()
.getRawProcessConfiguration();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig
.getSessionFactories()
.get(EntityManagerSession.class);
EntityManagerFactory entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
String executionId = runtimeService.startProcessInstanceByKey("JPAVariableProcess").getProcessInstanceId();
String variableName = "name";
FieldAccessJPAEntity entity = new FieldAccessJPAEntity();
entity.setId(1L);
entity.setValue("Test");
EntityManager manager = entityManagerFactory.createEntityManager();
manager.getTransaction().begin();
manager.persist(entity);
manager.flush();
manager.getTransaction().commit();
manager.close();
org.flowable.task.api.Task task = taskService.createTaskQuery().processInstanceId(executionId).taskName("my task").singleResult();
runtimeService.setVariable(executionId, variableName, entity);
taskService.complete(task.getId());
List<org.activiti.engine.history.HistoricDetail> variableUpdates = activiti5ProcessEngineConfig.getHistoryService().createHistoricDetailQuery().processInstanceId(executionId).variableUpdates().list();
assertEquals(1, variableUpdates.size());
org.activiti.engine.history.HistoricVariableUpdate update = (org.activiti.engine.history.HistoricVariableUpdate) variableUpdates.get(0);
assertNotNull(update.getValue());
assertTrue(update.getValue() instanceof FieldAccessJPAEntity);
assertEquals(entity.getId(), ((FieldAccessJPAEntity) update.getValue()).getId());
}
示例8: initJpa
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
@Override
protected void initJpa() {
super.initJpa();
if (jpaEntityManagerFactory != null) {
sessionFactories.put(EntityManagerSession.class, new SpringEntityManagerSessionFactory(jpaEntityManagerFactory, jpaHandleTransaction, jpaCloseEntityManager));
}
}
示例9: initializeProcessEngine
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
protected void initializeProcessEngine() {
if (cachedProcessEngine == null) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");
cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
.getSessionFactories()
.get(EntityManagerSession.class);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
}
processEngine = cachedProcessEngine;
}
示例10: initJpa
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
@Override
protected void initJpa() {
super.initJpa();
if (jpaEntityManagerFactory != null) {
sessionFactories.put(EntityManagerSession.class,
new SpringEntityManagerSessionFactory(jpaEntityManagerFactory, jpaHandleTransaction, jpaCloseEntityManager));
}
}
示例11: initializeProcessEngine
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
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;
}
示例12: testReadJpaVariableValueFromHistoricVariableUpdate
import org.activiti.engine.impl.variable.EntityManagerSession; //导入依赖的package包/类
@Deployment(resources = {
"org/activiti/standalone/jpa/JPAVariableTest.testQueryJPAVariable.bpmn20.xml" })
public void testReadJpaVariableValueFromHistoricVariableUpdate() {
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
.getSessionFactories()
.get(EntityManagerSession.class);
EntityManagerFactory entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
String executionId = runtimeService.startProcessInstanceByKey("JPAVariableProcess").getProcessInstanceId();
String variableName = "name";
FieldAccessJPAEntity entity = new FieldAccessJPAEntity();
entity.setId(1L);
entity.setValue("Test");
EntityManager manager = entityManagerFactory.createEntityManager();
manager.getTransaction().begin();
manager.persist(entity);
manager.flush();
manager.getTransaction().commit();
manager.close();
runtimeService.setVariable(executionId, variableName, entity);
runtimeService.signal(executionId);
List<HistoricDetail> variableUpdates = historyService.createHistoricDetailQuery().processInstanceId(executionId).variableUpdates().list();
assertEquals(1, variableUpdates.size());
HistoricVariableUpdate update = (HistoricVariableUpdate) variableUpdates.get(0);
assertNotNull(update.getValue());
assertTrue(update.getValue() instanceof FieldAccessJPAEntity);
assertEquals(entity.getId(), ((FieldAccessJPAEntity)update.getValue()).getId());
}