• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EntityManagerSessionFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.activiti.engine.impl.variable.EntityManagerSessionFactory的典型用法代码示例。如果您正苦于以下问题:Java EntityManagerSessionFactory类的具体用法?Java EntityManagerSessionFactory怎么用?Java EntityManagerSessionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EntityManagerSessionFactory类属于org.activiti.engine.impl.variable包,在下文中一共展示了EntityManagerSessionFactory类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initializeProcessEngine

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:19,代码来源:JPAVariableTest.java


示例2: initializeProcessEngine

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:22,代码来源:JPAEnhancedVariableTest.java


示例3: initializeProcessEngine

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:HistoricJPAVariableTest.java


示例4: initJpa

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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));
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:27,代码来源:ProcessEngineConfigurationImpl.java


示例5: initializeProcessEngine

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:17,代码来源:LeaveJpaEntityTest.java


示例6: initJpa

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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());
      }        
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:ProcessEngineConfigurationImpl.java


示例7: testReadJpaVariableValueFromHistoricVariableUpdate

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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());
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:40,代码来源:FullHistoryTest.java


示例8: initializeProcessEngine

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:16,代码来源:LeaveJpaEntityTest.java


示例9: initializeProcessEngine

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:16,代码来源:JPAVariableTest.java


示例10: testReadJpaVariableValueFromHistoricVariableUpdate

import org.activiti.engine.impl.variable.EntityManagerSessionFactory; //导入依赖的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());
  }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:37,代码来源:FullHistoryTest.java



注:本文中的org.activiti.engine.impl.variable.EntityManagerSessionFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LongDocValues类代码示例发布时间:2022-05-23
下一篇:
Java DefaultAdapter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap