当前位置: 首页>>代码示例>>Java>>正文


Java ProcessEngineConfiguration类代码示例

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


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

示例1: setVariable

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void setVariable() {
    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
    logger.info("### ============= 创建Activiti流程引擎实例, {}", processEngine);

    TaskService taskService = processEngine.getTaskService();

    Task task = taskService.createTaskQuery()
            .processInstanceId("2501")
            .singleResult();

    taskService.setVariable(task.getId(), "流程变量名01", "流程变量值01");
    taskService.setVariable(task.getId(), "流程变量名02", "流程变量值02");
    taskService.setVariable(task.getId(), "流程变量名03", "流程变量值03");

    processEngine.close();
}
 
开发者ID:Lzw2016,项目名称:study,代码行数:18,代码来源:Test01.java

示例2: getVariable

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void getVariable() {
    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
    logger.info("### ============= 创建Activiti流程引擎实例, {}", processEngine);

    TaskService taskService = processEngine.getTaskService();

    Task task = taskService.createTaskQuery()
            .processInstanceId("2501")
            .singleResult();

    String tmp = taskService.getVariable(task.getId(), "流程变量名01", String.class);
    logger.info("### ==================== {}", tmp);
    tmp = taskService.getVariable(task.getId(), "流程变量名02", String.class);
    logger.info("### ==================== {}", tmp);
    tmp = taskService.getVariable(task.getId(), "流程变量名03", String.class);
    logger.info("### ==================== {}", tmp);

    processEngine.close();
}
 
开发者ID:Lzw2016,项目名称:study,代码行数:21,代码来源:Test01.java

示例3: getImage

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void getImage() throws IOException {
    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
    logger.info("### ============= 创建Activiti流程引擎实例, {}", processEngine);

    RepositoryService repositoryService = processEngine.getRepositoryService();

    //通过流程ID(XML上写的)找到流程
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
            .processDefinitionId("请假流程:2:10004")
            .singleResult();
    String diagramResourceName = processDefinition.getDiagramResourceName();
    logger.info(diagramResourceName);
    InputStream imageStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);

    FileUtils.writeByteArrayToFile(new File("F:\\123456.png"),IOUtils.toByteArray(imageStream));
    imageStream.close();

    processEngine.close();
}
 
开发者ID:Lzw2016,项目名称:study,代码行数:21,代码来源:Test01.java

示例4: createProcessEngine

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
public boolean createProcessEngine(String driver, String databaseURL, String username, String password){
    
    try{
        //Create process engine
        processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
                .setJdbcDriver(driver)
                .setJdbcUrl(databaseURL)
                .setJdbcUsername(username)
                .setJdbcPassword(password)
                .buildProcessEngine();
        
        //If engine is successfully created
        if(processEngine != null)
            return true;
        
        return false;
    
    }catch(Exception ex){          
        return false;
    }   
}
 
开发者ID:usplssb,项目名称:SemanticSCo,代码行数:23,代码来源:Activiti.java

示例5: findSignalEventSubscriptionsByEventName

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<SignalEventSubscriptionEntity> findSignalEventSubscriptionsByEventName(String eventName, String tenantId) {
    final String query = "selectSignalEventSubscriptionsByEventName";

    Set<SignalEventSubscriptionEntity> selectList = null;
    Map<String, String> params = new HashMap<>();
    params.put("eventName", eventName);
    if (tenantId != null && !tenantId.equals(ProcessEngineConfiguration.NO_TENANT_ID)) {
        params.put("tenantId", tenantId);
        selectList = new HashSet<SignalEventSubscriptionEntity>(getDbSqlSession().selectList(query, params));
    } else {
        selectList = new HashSet<SignalEventSubscriptionEntity>(getDbSqlSession().selectList(query, params));
    }

    // add events created in this command (not visible yet in query)
    for (SignalEventSubscriptionEntity entity : createdSignalSubscriptions) {
        if (eventName.equals(entity.getEventName())) {
            selectList.add(entity);
        }
    }

    return new ArrayList<>(selectList);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:EventSubscriptionEntityManager.java

示例6: findNewLatestProcessDefinitionAfterRemovalOf

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
protected ProcessDefinition findNewLatestProcessDefinitionAfterRemovalOf(ProcessDefinition processDefinitionToBeRemoved) {

        // The latest process definition is not necessarily the one with 'version -1' (some versions could have been deleted)
        // Hence, the following logic

        ProcessDefinitionQueryImpl query = new ProcessDefinitionQueryImpl();
        query.processDefinitionKey(processDefinitionToBeRemoved.getKey());

        if (processDefinitionToBeRemoved.getTenantId() != null
                && !ProcessEngineConfiguration.NO_TENANT_ID.equals(processDefinitionToBeRemoved.getTenantId())) {
            query.processDefinitionTenantId(processDefinitionToBeRemoved.getTenantId());
        } else {
            query.processDefinitionWithoutTenantId();
        }

        query.processDefinitionVersionLowerThan(processDefinitionToBeRemoved.getVersion());
        query.orderByProcessDefinitionVersion().desc();

        List<ProcessDefinition> processDefinitions = getProcessDefinitionManager().findProcessDefinitionsByQueryCriteria(query, new Page(0, 1));
        if (processDefinitions != null && processDefinitions.size() > 0) {
            return processDefinitions.get(0);
        }
        return null;
    }
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:25,代码来源:DeploymentEntityManager.java

示例7: removeObsoleteTimers

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
protected void removeObsoleteTimers(ProcessDefinitionEntity processDefinition) {

        List<Job> jobsToDelete = null;

        if (processDefinition.getTenantId() != null && !ProcessEngineConfiguration.NO_TENANT_ID.equals(processDefinition.getTenantId())) {
            jobsToDelete = Context.getCommandContext().getTimerJobEntityManager().findTimerJobsByTypeAndProcessDefinitionKeyAndTenantId(
                    TimerStartEventJobHandler.TYPE, processDefinition.getKey(), processDefinition.getTenantId());
        } else {
            jobsToDelete = Context.getCommandContext().getTimerJobEntityManager()
                    .findTimerJobsByTypeAndProcessDefinitionKeyNoTenantId(TimerStartEventJobHandler.TYPE, processDefinition.getKey());
        }

        if (jobsToDelete != null) {
            for (Job job : jobsToDelete) {
                new CancelJobsCmd(job.getId()).execute(Context.getCommandContext());
            }
        }
    }
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:19,代码来源:BpmnDeployer.java

示例8: initializeProcessEngine

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的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

示例9: testStartProcess

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void testStartProcess() throws Exception {
    // 创建流程引擎,使用内存数据库
    ProcessEngine processEngine = ProcessEngineConfiguration
            .createStandaloneInMemProcessEngineConfiguration()
            .buildProcessEngine();

    // 部署流程定义文件
    RepositoryService repositoryService = processEngine.getRepositoryService();
    String processFileName = "me/kafeitu/activiti/helloworld/sayhelloleave.bpmn";
    repositoryService.createDeployment().addClasspathResource(processFileName)
            .deploy();

    // 验证已部署流程定义
    ProcessDefinition processDefinition = repositoryService
            .createProcessDefinitionQuery().singleResult();
    assertEquals("leavesayhello", processDefinition.getKey());

    // 启动流程并返回流程实例
    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService
            .startProcessInstanceByKey("leavesayhello");
    assertNotNull(processInstance);
    System.out.println("pid=" + processInstance.getId() + ", pdid="
            + processInstance.getProcessDefinitionId());
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:27,代码来源:VerySimpleLeaveProcessTest.java

示例10: loadBus

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
@Override
public void loadBus(ServletConfig servletConfig) throws ServletException {
    super.loadBus(servletConfig);
    
    // TODO: Hacky first version to get default Process Engine
    ProcessEngine processEngine = ProcessEngineConfiguration
      .createProcessEngineConfigurationFromResourceDefault()
      .buildProcessEngine();
    
    Bus bus = getBus();
    BusFactory.setDefaultBus(bus); 
    Endpoint.publish("/RuntimeService", new RuntimeWebServiceImpl(processEngine));
    
    // You can als use the simple frontend API to do this
    ServerFactoryBean factory = new ServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceClass(RuntimeWebServiceImpl.class);
    factory.setAddress("/RuntimeService");
    factory.create();              
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:WebServiceProviderServlet.java

示例11: init

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
public void init() throws Exception {
    ClassLoader previous = Thread.currentThread().getContextClassLoader();

    try {
        ClassLoader cl = new BundleDelegatingClassLoader(bundle);

        Thread.currentThread().setContextClassLoader(new ClassLoaderWrapper(
                cl,
                ProcessEngineFactory.class.getClassLoader(),
                ProcessEngineConfiguration.class.getClassLoader(),
                previous
        ));

        processEngineConfiguration.setClassLoader(cl);

        processEngine = (ProcessEngineImpl) processEngineConfiguration.buildProcessEngine();

    } finally {
        Thread.currentThread().setContextClassLoader(previous);
    }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:ProcessEngineFactory.java

示例12: performSchemaOperationsProcessEngineBuild

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
public void performSchemaOperationsProcessEngineBuild() {
  String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate();
  if (ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate)) {
    try {
      dbSchemaDrop();
    } catch (RuntimeException e) {
      // ignore
    }
  }
  if ( org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP.equals(databaseSchemaUpdate) 
       || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate)
       || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_CREATE.equals(databaseSchemaUpdate)
     ) {
    dbSchemaCreate();
    
  } else if (org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE.equals(databaseSchemaUpdate)) {
    dbSchemaCheckVersion();
    
  } else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE.equals(databaseSchemaUpdate)) {
    dbSchemaUpdate();
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:23,代码来源:DbSqlSession.java

示例13: initialiseActivitiDBSchema

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
/**
 * Initialises the Activiti DB schema, if not present it's created.
 * 
 * @param connection Connection to use the initialise DB schema
 */
private void initialiseActivitiDBSchema(Connection connection)
{
    // create instance of activiti engine to initialise schema
    ProcessEngine engine = null;
    ProcessEngineConfiguration engineConfig = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
    try
    {
        // build the engine
        engine = engineConfig.setDataSource(dataSource).
            setDatabaseSchemaUpdate("none").
            setProcessEngineName("activitiBootstrapEngine").
            setHistory("full").
            setJobExecutorActivate(false).
            buildProcessEngine();

        String schemaName = dbSchemaName != null ? dbSchemaName : databaseMetaDataHelper.getSchema(connection);
        // create or upgrade the DB schema
        engine.getManagementService().databaseSchemaUpgrade(connection, null, schemaName);
    }
    finally
    {
        if (engine != null)
        {
            // close the process engine
            engine.close();
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:SchemaBootstrap.java

示例14: getProcessEngineConfiguration

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
public ProcessEngineConfiguration getProcessEngineConfiguration() {
    if (processEngine == null) {
        return null;
    }

    return processEngine.getProcessEngineConfiguration();
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:8,代码来源:ProxyProcessEngine.java

示例15: execute

import org.activiti.engine.ProcessEngineConfiguration; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinitionEntity = commandContext
            .getProcessDefinitionEntityManager().findProcessDefinitionById(
                    processDefinitionId);
    String resourceName = processDefinitionEntity.getResourceName();
    String deploymentId = processDefinitionEntity.getDeploymentId();
    JdbcTemplate jdbcTemplate = new JdbcTemplate(Context
            .getProcessEngineConfiguration().getDataSource());
    jdbcTemplate
            .update("update ACT_GE_BYTEARRAY set BYTES_=? where NAME_=? and DEPLOYMENT_ID_=?",
                    bytes, resourceName, deploymentId);

    Context.getProcessEngineConfiguration().getProcessDefinitionCache()
            .remove(processDefinitionId);

    try {
        // update png
        GetBpmnModelCmd getBpmnModelCmd = new GetBpmnModelCmd(
                processDefinitionId);
        BpmnModel bpmnModel = getBpmnModelCmd.execute(commandContext);
        ProcessEngineConfiguration processEngineConfiguration = Context
                .getProcessEngineConfiguration();
        ProcessDefinitionDiagramCmd processDefinitionDiagramCmd = new ProcessDefinitionDiagramCmd(
                processDefinitionEntity.getId());
        InputStream is = processDefinitionDiagramCmd
                .execute(commandContext);
        byte[] pngBytes = IOUtils.toByteArray(is);
        String diagramResourceName = processDefinitionEntity
                .getDiagramResourceName();
        jdbcTemplate
                .update("update ACT_GE_BYTEARRAY set BYTES_=? where NAME_=? and DEPLOYMENT_ID_=?",
                        pngBytes, diagramResourceName, deploymentId);
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
    }

    return null;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:39,代码来源:UpdateProcessCmd.java


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