當前位置: 首頁>>代碼示例>>Java>>正文


Java RuntimeService類代碼示例

本文整理匯總了Java中org.activiti.engine.RuntimeService的典型用法代碼示例。如果您正苦於以下問題:Java RuntimeService類的具體用法?Java RuntimeService怎麽用?Java RuntimeService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RuntimeService類屬於org.activiti.engine包,在下文中一共展示了RuntimeService類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startProcess

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
@Test
public void startProcess() throws Exception {
	
	Map<String, Object> paramMap = new HashMap<String, Object>();
	paramMap.put("confirmPublish", "N");
	
	String processId = "Employee360DegreeFeedbackProjectPublishProcess";
	
	RuntimeService runtimeService = (RuntimeService) AppContext.getBean("runtimeService");
	ProcessInstance process = runtimeService.startProcessInstanceByKey(processId, paramMap);
	System.out.println("DeploymentId: " + process.getDeploymentId() );
	System.out.println("ActivityId: " + process.getActivityId() );
	System.out.println("Name: " + process.getName() );
	System.out.println("ProcessDefinitionId: " + process.getProcessDefinitionId());
	System.out.println("ProcessDefinitionKey: " + process.getProcessDefinitionKey());
	System.out.println("ProcessDefinitionName: " + process.getProcessDefinitionName());
	System.out.println("BusinessKey: " + process.getBusinessKey());
	
}
 
開發者ID:billchen198318,項目名稱:bamboobsc,代碼行數:20,代碼來源:TestBPMN001.java

示例2: testSend

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
@Deployment
public void testSend() {
  ProcessEngine processEngine = muleContext.getRegistry().get("processEngine");
  TestHelper.annotationDeploymentSetUp(processEngine, getClass(), getName());

  RuntimeService runtimeService = muleContext.getRegistry().get("runtimeService");
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  assertEquals(10, result);
}
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:12,代碼來源:MuleSendActivitiBehaviorTest.java

示例3: triggerSignalEvent

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
/**
 * Trigger a signal event on all executions for a specific business key.
 *
 * @see <a href="http://www.activiti.org/userguide/index.html#bpmnSignalEventDefinition" />
 * @see CoreSignals
 */
protected void triggerSignalEvent(ProcessEngine processEngine, String businessKey, String signalName) {
    RuntimeService runtimeService = processEngine.getRuntimeService();

    ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
        .processInstanceBusinessKey(businessKey).singleResult();

    List<Execution> executions = runtimeService.createExecutionQuery()
        .processInstanceId(processInstance.getProcessInstanceId())
        .signalEventSubscriptionName(signalName).list();

    if (executions.isEmpty()) {
        throw new NoSuchElementException(String.format("No executions found waiting " +
            "for signal '%s' on process %s", signalName, businessKey));
    }
    for (Execution execution : executions) {
        LOG.info("Sending '{}' signal to execution {} for process {}",
            new Object[]{signalName, execution.getId(), businessKey});
        runtimeService.signalEventReceived(signalName, execution.getId());

    }
}
 
開發者ID:apache,項目名稱:incubator-provisionr,代碼行數:28,代碼來源:ProvisionrSupport.java

示例4: getEngineServices

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
@Override
public EngineServices getEngineServices() {
    if (this.engineServicesMock != null) {
        return this.engineServicesMock;
    }

    this.engineServicesMock = mock(EngineServices.class);
    when(engineServicesMock.getFormService()).thenReturn(mock(FormService.class));
    when(engineServicesMock.getHistoryService()).thenReturn(mock(HistoryService.class));
    when(engineServicesMock.getIdentityService()).thenReturn(mock(IdentityService.class));
    when(engineServicesMock.getManagementService()).thenReturn(mock(ManagementService.class));
    when(engineServicesMock.getRepositoryService()).thenReturn(mock(RepositoryService.class));
    when(engineServicesMock.getRuntimeService()).thenReturn(mock(RuntimeService.class));
    when(engineServicesMock.getTaskService()).thenReturn(mock(TaskService.class));

    return engineServicesMock;
}
 
開發者ID:SAP,項目名稱:cf-mta-deploy-service,代碼行數:18,代碼來源:MockDelegateExecution.java

示例5: setUp

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
@BeforeTest
public void setUp(){
	RuntimeService rts = mock(RuntimeService.class);
	List<ProcessInstance> processList = new ArrayList<ProcessInstance>();
	ExecutionEntity executionEntity = new  ExecutionEntity();
	executionEntity.setActive(false);
	processList.add(executionEntity);
	
	ProcessInstanceQuery pQuery = mock(ProcessInstanceQuery.class);
	when(pQuery.active()).thenReturn(pQuery);
	when(pQuery.list()).thenReturn(processList);
	when(rts.createProcessInstanceQuery()).thenReturn(pQuery);

	this.servlet.setRuntimeService(rts);
	this.servlet.setWoDispatcher(mock(WoDispatcher.class));
	this.servlet.init();
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:18,代碼來源:CtrlrServletTest.java

示例6: stopProcessInstance

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
public void stopProcessInstance(String instanceId, String username, OperationResult parentResult) {
    OperationResult result = parentResult.createSubresult(OPERATION_STOP_PROCESS_INSTANCE);
    result.addParam("instanceId", instanceId);

    RuntimeService rs = activitiEngine.getRuntimeService();
    try {
        LOGGER.trace("Stopping process instance {} on the request of {}", instanceId, username);
        String deletionMessage = "Process instance stopped on the request of " + username;
        rs.setVariable(instanceId, CommonProcessVariableNames.VARIABLE_PROCESS_INSTANCE_IS_STOPPING, Boolean.TRUE);
        rs.deleteProcessInstance(instanceId, deletionMessage);
    } catch (RuntimeException e) {
        result.recordFatalError("Process instance couldn't be stopped: " + e.getMessage(), e);
        throw e;
    } finally {
        result.computeStatusIfUnknown();
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:18,代碼來源:ProcessInstanceManager.java

示例7: execute

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
public void execute(DelegateExecution execution) {

        if (LOGGER.isTraceEnabled()) {

			RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
        	Set<String> variablesSeen = new HashSet<>();

            LOGGER.trace("--------------------------------- DumpVariables: " + execution.getCurrentActivityId());
//			LOGGER.trace("All variables for execution id={}, parent id={}", execution.getId(), execution.getParentId());
//            execution.getVariableInstances().forEach((n, v) -> LOGGER.trace(" - {} = {} (in {})", n, v.getValue(), v.getExecutionId()));

            LOGGER.trace("Execution hierarchy for id={}", execution.getId());
            LOGGER.trace("------------------------------------");
            dumpExecutionVariables(execution.getId(), execution, null, variablesSeen, runtimeService);

			Collection<String> disjunction = CollectionUtils.disjunction(variablesSeen, execution.getVariableNames());
			if (!disjunction.isEmpty()) {
				LOGGER.trace("*** Variables not found in execution tree or 'execution.getVariableNames()': {}", disjunction);
			}
            LOGGER.trace("--------------------------------- DumpVariables: " + execution.getCurrentActivityId() + " END ------------");
        }

    }
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:24,代碼來源:DumpVariables.java

示例8: testStartProcess

import org.activiti.engine.RuntimeService; //導入依賴的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

示例9: main

import org.activiti.engine.RuntimeService; //導入依賴的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:shawn-gogh,項目名稱:myjavacode,代碼行數:19,代碼來源:InitProcessEngineBySpringAnnotation.java

示例10: testSpringMaster

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
@Test
public void testSpringMaster() throws Exception {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("mule/spring-master/spring-master.xml");

    MuleContext mc = (MuleContext) ctx.getBean("_muleContext");
    mc.start();

    RepositoryService repositoryService = (RepositoryService) ctx.getBean("repositoryService");
    repositoryService.createDeployment().addClasspathResource("mule/leaveWithMule.bpmn").deploy();

    RuntimeService runtimeService = (RuntimeService) ctx.getBean("runtimeService");

    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("days", 5);
    runtimeService.startProcessInstanceByKey("leaveWithMule", variableMap);

    TaskService taskService = (TaskService) ctx.getBean("taskService");
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
    assertEquals("部門經理審批", task.getName());

    mc.stop();
}
 
開發者ID:shawn-gogh,項目名稱:myjavacode,代碼行數:24,代碼來源:ActivitiWithMuleTest.java

示例11: main

import org.activiti.engine.RuntimeService; //導入依賴的package包/類
public static void main(String[] args) {
	// 創建流程引擎
	ProcessEngine engine = ProcessEngines
			.getDefaultProcessEngine();
	// 得到流程存儲服務組件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到運行時服務組件
	RuntimeService runtimeService = engine.getRuntimeService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("com/roger/activiti/workflow/CompensationBoundaryEvent.bpmn").deploy();
	// 初始化參數
	Map<String, Object> vars = new HashMap<String, Object>();
	vars.put("result", false);
	runtimeService.startProcessInstanceByKey("cbProcess", vars);
}
 
開發者ID:yudar1024,項目名稱:spring4-springmvc4-mybatis3-activiti,代碼行數:17,代碼來源:CompensationBoundaryEvent.java

示例12: main

import org.activiti.engine.RuntimeService; //導入依賴的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.RuntimeService; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
	// 創建流程引擎
	ProcessEngineImpl engine = (ProcessEngineImpl)ProcessEngines
			.getDefaultProcessEngine();
	// 啟動JobExecutor
	engine.getProcessEngineConfiguration().getJobExecutor().start();
	// 得到流程存儲服務組件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到運行時服務組件
	RuntimeService runtimeService = engine.getRuntimeService();
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/TimerCatchingEvent.bpmn").deploy();
	// 啟動流程
	runtimeService.startProcessInstanceByKey("tcProcess");
	// 查詢當前任務
	Task currentTask = taskService.createTaskQuery().singleResult();
	taskService.complete(currentTask.getId());
	Thread.sleep(1000 * 61);
	// 重新查詢當前任務
	currentTask = taskService.createTaskQuery().singleResult();
	System.out.println("定時器中間事件的觸發後任務:" + currentTask.getName());
	//關閉JobExecutor
	engine.getProcessEngineConfiguration().getJobExecutor().shutdown();
}
 
開發者ID:yudar1024,項目名稱:spring4-springmvc4-mybatis3-activiti,代碼行數:27,代碼來源:TimerCatchingEvent.java

示例14: main

import org.activiti.engine.RuntimeService; //導入依賴的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

示例15: main

import org.activiti.engine.RuntimeService; //導入依賴的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


注:本文中的org.activiti.engine.RuntimeService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。