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


Java ProcessEngine类代码示例

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


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

示例1: buildProcessEngine

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
/**
 * Takes in an Activiti 6 process engine config, gives back an Activiti 5 Process engine.
 */
@Override
public ProcessEngine buildProcessEngine(ProcessEngineConfigurationImpl activiti6Configuration) {

    org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5Configuration = null;
    if (activiti6Configuration instanceof SpringProcessEngineConfiguration) {
        activiti5Configuration = new org.activiti.spring.SpringProcessEngineConfiguration();
        super.copyConfigItems(activiti6Configuration, activiti5Configuration);
        copySpringConfigItems((SpringProcessEngineConfiguration) activiti6Configuration, (org.activiti.spring.SpringProcessEngineConfiguration) activiti5Configuration);
        return activiti5Configuration.buildProcessEngine();

    } else {
        return super.buildProcessEngine(activiti6Configuration);
    }

}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:19,代码来源:DefaultSpringProcessEngineFactory.java

示例2: onSetUpInTransaction

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
	 ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
     this.workflowService = registry.getWorkflowService();
     this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
     this.nodeService = registry.getNodeService();
     
     this.transactionHelper = (RetryingTransactionHelper) this.applicationContext
     	.getBean("retryingTransactionHelper");
     
     this.activitiProcessEngine = (ProcessEngine) this.applicationContext.getBean("activitiProcessEngine");
     
     MutableAuthenticationService authenticationService = registry.getAuthenticationService();
     PersonService personService = registry.getPersonService();

     this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
     
     authenticationComponent.setSystemUserAsCurrentUser();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ActivitiTimerExecutionTest.java

示例3: setVariable

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

示例4: getVariable

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

示例5: getImage

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

示例6: testEngineEventsTest

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
public void testEngineEventsTest() {
    // Fetch the listener to check received events
    TestFlowableEventListener listener = (TestFlowableEventListener) processEngineConfiguration.getBeans().get("eventListener");
    assertNotNull(listener);

    // Check create-event
    assertEquals(2, listener.getEventsReceived().size());
    assertEquals(FlowableEngineEventType.ENGINE_CREATED, listener.getEventsReceived().get(0).getType());
    assertEquals(FlowableEngineEventType.ENGINE_CREATED, listener.getEventsReceived().get(1).getType());
    listener.clearEventsReceived();

    // Check close-event
    ProcessEngine activiti5ProcessEngine = (ProcessEngine) processEngineConfiguration.getFlowable5CompatibilityHandler().getRawProcessEngine();
    activiti5ProcessEngine.close();
    assertEquals(1, listener.getEventsReceived().size());
    assertEquals(FlowableEngineEventType.ENGINE_CLOSED, listener.getEventsReceived().get(0).getType());

}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:19,代码来源:EngineEventsTest.java

示例7: testStartProcess

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

示例8: dbSchemaUpgrade

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
protected void dbSchemaUpgrade(String component, String dbVersion) {
  log.info("upgrading activiti "+component+" schema from "+dbVersion+" to "+ProcessEngine.VERSION);
  
  if (dbVersion.endsWith("-SNAPSHOT")) {
    dbVersion = dbVersion.substring(0, dbVersion.length()-"-SNAPSHOT".length());
  }
  int minorDbVersionNumber = Integer.parseInt(dbVersion.substring(2));
  
  String libraryVersion = ProcessEngine.VERSION;
  if (ProcessEngine.VERSION.endsWith("-SNAPSHOT")) {
    libraryVersion = ProcessEngine.VERSION.substring(0, ProcessEngine.VERSION.length()-"-SNAPSHOT".length());
  }
  int minorLibraryVersionNumber = Integer.parseInt(libraryVersion.substring(2));
  
  while (minorDbVersionNumber<minorLibraryVersionNumber) {
    executeSchemaResource("upgrade", component, getResourceForDbOperation("upgrade", "upgradestep.5"+minorDbVersionNumber+".to.5"+(minorDbVersionNumber+1), component), true);
    minorDbVersionNumber++;
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:DbSqlSession.java

示例9: buildProcessEngine

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
public static ProcessEngine buildProcessEngine(URL resource) {
  log.fine("==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE =========================================");
  
  ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource));
  Map<String, ProcessEngine> beansOfType = applicationContext.getBeansOfType(ProcessEngine.class);
  if ( (beansOfType==null)
       || (beansOfType.isEmpty())
     ) {
    throw new ActivitiException("no "+ProcessEngine.class.getName()+" defined in the application context "+resource.toString());
  }
  
  ProcessEngine processEngine = beansOfType.values().iterator().next();

  log.fine("==== SPRING PROCESS ENGINE CREATED ==================================================================");
  return processEngine;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:SpringConfigurationHelper.java

示例10: main

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx =
            new AnnotationConfigApplicationContext();
    ctx.register(SpringAnnotationConfiguration.class);
    ctx.refresh();

    assertNotNull(ctx.getBean(ProcessEngine.class));
    assertNotNull(ctx.getBean(RuntimeService.class));
    TaskService bean = ctx.getBean(TaskService.class);
    assertNotNull(bean);
    assertNotNull(ctx.getBean(HistoryService.class));
    assertNotNull(ctx.getBean(RepositoryService.class));
    assertNotNull(ctx.getBean(ManagementService.class));
    assertNotNull(ctx.getBean(FormService.class));
    Task task = bean.newTask();
    task.setName("哈哈");
    bean.saveTask(task);
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:19,代码来源:InitProcessEngineBySpringAnnotation.java

示例11: initializeProcessEngine

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
@Override
protected void initializeProcessEngine() {
  ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
  String[] value = contextConfiguration.value();
  if (value==null) {
    throw new ActivitiException("value is mandatory in ContextConfiguration");
  }
  if (value.length!=1) {
    throw new ActivitiException("SpringActivitiTestCase requires exactly one value in annotation ContextConfiguration");
  }
  String configurationFile = value[0];
  processEngine = cachedProcessEngines.get(configurationFile);
  if (processEngine==null) {
    processEngine = applicationContext.getBean(ProcessEngine.class);
    cachedProcessEngines.put(configurationFile, processEngine);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:SpringActivitiTestCase.java

示例12: main

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	// 得到任务服务组件
	TaskService taskService = engine.getTaskService();
	// 得到管理服务组件
	ManagementService managementService = engine.getManagementService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/SignalThrowingEvent.bpmn").deploy();
	// 启动流程
	runtimeService.startProcessInstanceByKey("stProcess");
	// 完成选择商品任务
	Task firstTask = taskService.createTaskQuery().singleResult();
	taskService.complete(firstTask.getId());
	// 完成用户支付任务
	Task payTask = taskService.createTaskQuery().singleResult();
	taskService.complete(payTask.getId());
	// 由于使用了异步的中间Throwing事件,因此会产生2条工作数据
	List<Job> jobs = managementService.createJobQuery().list();
	System.out.println(jobs.size());
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:27,代码来源:SignalThrowingEvent.java

示例13: main

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/MessageCatchingEvent.bpmn").deploy();
	// 启动流程
	ProcessInstance pi = runtimeService.startProcessInstanceByKey("mcProcess");
	Execution exe = runtimeService.createExecutionQuery().activityId("messageintermediatecatchevent1").singleResult();
	runtimeService.messageEventReceived("myMsg", exe.getId());
	// 输出当前的任务
	List<Task> tasks = taskService.createTaskQuery().list();
	for (Task task : tasks) {
		System.out.println(task.getName());
	}
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:22,代码来源:MessageCatchingEvent.java

示例14: main

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines
			.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	// 获取流程任务组件
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/ErrorBoundaryEvent.bpmn").deploy();
	// 启动流程
	runtimeService.startProcessInstanceByKey("ebProcess");
	// 进行任务查询
	Task task = taskService.createTaskQuery().singleResult();
	System.out.println(task.getName());
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:20,代码来源:ErrorBoundaryEvent.java

示例15: main

import org.activiti.engine.ProcessEngine; //导入依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/SignalCatchingEvent.bpmn").deploy();
	// 启动流程
	runtimeService.startProcessInstanceByKey("scProcess");
	Task firstTask = taskService.createTaskQuery().singleResult();
	taskService.complete(firstTask.getId());
	// 此时会出现并行的两个流程分支,查找用户任务并完成
	Task payTask = taskService.createTaskQuery().singleResult();
	// 完成任务
	taskService.complete(payTask.getId());
	// 发送信号完成支付
	runtimeService.signalEventReceived("finishPay");
	Task finishTask = taskService.createTaskQuery().singleResult();
	System.out.println("当前流程任务:" + finishTask.getName());
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:25,代码来源:SignalCatchingEvent.java


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