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


Java RuntimeManager.getRuntimeEngine方法代码示例

本文整理汇总了Java中org.kie.api.runtime.manager.RuntimeManager.getRuntimeEngine方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeManager.getRuntimeEngine方法的具体用法?Java RuntimeManager.getRuntimeEngine怎么用?Java RuntimeManager.getRuntimeEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kie.api.runtime.manager.RuntimeManager的用法示例。


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

示例1: doTest

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
@Test
public void doTest() {
    try {
    	KieBase kbase = getKieBase(URL, USER, PASSWORD);
        RuntimeManager manager = getRuntimeManager(kbase);        
        RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtime.getKieSession();
        ksession.startProcess("test.proc_ht");

        // "sales-rep" reviews request
        TaskService taskService = runtime.getTaskService();
		long taskId = taskService.getTasksAssignedAsPotentialOwner(TASK_USER, "en-UK").get(0).getId();
		taskService.claim(taskId, TASK_USER);
		taskService.start(taskId, TASK_USER);
		taskService.complete(taskId, TASK_USER, null);
		System.out.println("Process instance completed");
		manager.disposeRuntimeEngine(runtime);
    } catch (Throwable t) {
        t.printStackTrace();
    }
    System.exit(0);
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:23,代码来源:HumanTaskTest.java

示例2: main

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
public static void main(String[] args) {
	RuntimeManager manager = Util.getRuntimeManager();
	RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
	JPAAuditLogService jpaAuditLogService = (JPAAuditLogService) engine
			.getAuditService();
	
	long startQuery = System.currentTimeMillis();
	NodeInstanceLogQueryBuilder nodeInstanceLogQueryBuilder = new NodeInstLogQueryBuilderImpl(
			jpaAuditLogService);
	nodeInstanceLogQueryBuilder.processInstanceId(PIID);
	nodeInstanceLogQueryBuilder.intersect();
	nodeInstanceLogQueryBuilder.nodeType(SCRIPT_NODE);
	ParametrizedQuery<NodeInstanceLog> nodeInstanceList = nodeInstanceLogQueryBuilder
			.build();
	List<NodeInstanceLog> nodeInstanceLogList = nodeInstanceList
			.getResultList();
	long endQuery = System.currentTimeMillis();
	long diffQuery = endQuery - startQuery;
	System.out.println("Time for Query = " + diffQuery);
	for (NodeInstanceLog node : nodeInstanceLogList) {
		System.out.printf("Node ID: %s - Node Name: %s - Date: %s \n", node.getNodeId(), node.getNodeName(), node.getDate().toString());
	}
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:24,代码来源:NodeInstanceLogQuery.java

示例3: doTest

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
@Test
public void doTest() {
    try {
        RuntimeManager manager = getRuntimeManager("org/jugvale/bpms/local/processes/humantask/HumanTask.bpmn");        
        RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtime.getKieSession();
        ksession.startProcess("test.proc_ht");

        // "sales-rep" reviews request
        TaskService taskService = runtime.getTaskService();
		long taskId = taskService.getTasksAssignedAsPotentialOwner(USER, "en-UK").get(0).getId();
		taskService.claim(taskId, USER);
		taskService.start(taskId, USER);
		taskService.complete(taskId, USER, null);
		System.out.println("Process instance completed");
		manager.disposeRuntimeEngine(runtime);
    } catch (Throwable t) {
        t.printStackTrace();
    }
    System.exit(0);
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:22,代码来源:HumanTaskTest.java

示例4: main

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
public static void main(String[] args) {
	RuntimeManager manager = Util.getRuntimeManager();
	RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
	JPAAuditLogService jpaAuditLogService = (JPAAuditLogService) engine
			.getAuditService();
	
	long startQuery = System.currentTimeMillis();
	NodeInstanceLogQueryBuilder nodeInstanceLogQueryBuilder = new NodeInstLogQueryBuilderImpl(
			jpaAuditLogService);
	nodeInstanceLogQueryBuilder.processInstanceId(PIID);
	nodeInstanceLogQueryBuilder.and();
	nodeInstanceLogQueryBuilder.nodeType(SCRIPT_NODE);
	ParametrizedQuery<NodeInstanceLog> nodeInstanceList = nodeInstanceLogQueryBuilder
			.build();
	List<NodeInstanceLog> nodeInstanceLogList = nodeInstanceList
			.getResultList();
	long endQuery = System.currentTimeMillis();
	long diffQuery = endQuery - startQuery;
	System.out.println("Time for Query = " + diffQuery);
	for (NodeInstanceLog node : nodeInstanceLogList) {
		System.out.printf("Node ID: %s - Node Name: %s - Date: %s \n", node.getNodeId(), node.getNodeName(), node.getDate().toString());
	}
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:24,代码来源:NodeInstanceLogQuery.java

示例5: startProcess

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
/**
    * Starts up a new ProcessInstance with the given deploymentId and
    * ProcessId. The parameters Map is set into the context of the workflow.
    *
    * @param deploymentId
    *            the deployment id
    * @param processId
    *            the process id
    * @param parameters
    *            the parameters
    * @return the long
    * @throws Exception
    *             the exception
    */
   public long startProcess(String deploymentId, String processId, Map<String, Object> parameters)
		throws Exception {

	long processInstanceId = -1;
	try {
		KieSrampUtil kieSrampUtil = new KieSrampUtil();
		RuntimeManager runtimeManager = kieSrampUtil.getRuntimeManager(processEngineService, deploymentId);
		RuntimeEngine runtime = runtimeManager.getRuntimeEngine(EmptyContext.get());
		KieSession ksession = runtime.getKieSession();
		// start a new process instance
		ProcessInstance processInstance = ksession.startProcess(processId,
				parameters);
		processInstanceId = processInstance.getId();
		logger.info(Messages.i18n.format("ProcessBean.Started", processInstanceId)); //$NON-NLS-1$

	} catch (Exception e) {
		e.printStackTrace();

		throw e;
	}
	return processInstanceId;
}
 
开发者ID:Governance,项目名称:dtgov,代码行数:37,代码来源:ProcessBean.java

示例6: main

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
public static void main(String[] args) {
	RuntimeManager manager = Util.getRuntimeManager();
	RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
	JPAAuditLogService jpaAuditLogService = (JPAAuditLogService) engine
			.getAuditService();
	VariableInstanceLogQueryBuilder varQueryBuilder = new VarInstLogQueryBuilderImpl(jpaAuditLogService);
	ParametrizedQuery<VariableInstanceLog> queryVariable = varQueryBuilder.variableId(VAR_ID).value(VAR_VALUE).build();
	List<VariableInstanceLog> resultList = queryVariable.getResultList();
	System.out.printf("Number of process that has variable %s with value %s: %d\n", VAR_ID, VAR_VALUE, resultList.size());
	for (VariableInstanceLog variableInstanceLog : resultList) {
		System.out.printf("Process ID: %s - Instance ID: %d ", variableInstanceLog.getProcessId(), variableInstanceLog.getProcessInstanceId());
	}
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:14,代码来源:ProcessVariableQuery.java

示例7: main

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
       RuntimeManager manager = Util.getRuntimeManager();
       RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
       KieSession kSession = engine.getKieSession();
	for (int i = 0; i < 50000; i++) {
		System.out.println("Starting process number " + i);
		kSession.startProcess("org.fxapps.bpms.helloProcess");
	}
	manager.disposeRuntimeEngine(engine);
	manager.close();
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:12,代码来源:HelloWorldProcessRunner.java

示例8: main

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
	
	// no delay to call the executor and not using JMS
	System.setProperty("org.kie.executor.jms", "false");
	System.setProperty("org.kie.executor.initial.delay", "1");
	
	JBPMHelper.startH2Server();
	JBPMHelper.setupDataSource();
	
	// This entity manager factory contains Executor entities
	EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.with.executor");
	ExecutorService executorService = ExecutorServiceFactory.newExecutorService();
	
	// initialize the executor service - it is important or it won't work
	executorService.init();
	
	
	RuntimeEnvironment env = RuntimeEnvironmentBuilder.Factory
			.get()
			.newEmptyBuilder()
			// remember to register the executor service
			.addEnvironmentEntry("ExecutorService", executorService) 
			.entityManagerFactory(emf)
			.addAsset(
					KieServices.Factory.get().getResources()
							.newClassPathResource("org.jbpm.async_test.v1.0.bpmn2"),
					ResourceType.BPMN2).get();
	

	RuntimeManager runtimeManager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(env);
	RuntimeEngine engine = runtimeManager.getRuntimeEngine(EmptyContext.get());
	KieSession kieSession = engine.getKieSession();
	
	// registering the WIH for the Service task
	kieSession.getWorkItemManager().registerWorkItemHandler("Service Task", new ServiceTaskHandler());

	kieSession.startProcess("test.async_test");

	runtimeManager.disposeRuntimeEngine(engine);
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:41,代码来源:TestExecutor.java

示例9: main

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
       RuntimeManager manager = Util.getRuntimeManager();
       RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
       KieSession kSession = engine.getKieSession();
       TaskService taskService = engine.getTaskService();
	Long piid = kSession.startProcess("org.fxapps.bpms.HT").getId();
	Long tid = taskService.getTasksByProcessInstanceId(piid).iterator().next();
	taskService.start(tid, "bpmsAdmin");
	taskService.complete(tid, "bpmsAdmin", null);
	manager.disposeRuntimeEngine(engine);
	manager.close();
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:13,代码来源:HTProcessRunner.java

示例10: main

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
       RuntimeManager manager = Util.getRuntimeManager();
       RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
       KieSession kSession = engine.getKieSession();
	for (int i = 0; i < 100; i++) {
		System.out.println("Starting process number " + i);
		kSession.startProcess("org.fxapps.bpms.helloProcess");
	}
	manager.disposeRuntimeEngine(engine);
	manager.close();
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:12,代码来源:HelloWorldProcessRunner.java

示例11: configure

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
@PostConstruct
public void configure() {
	//we need it to start to startup task management - however
	//we don't want it to start before we have the workflow are
	//definitions deployed (on first time boot)
	synchronized(hasSRAMPPackageDeployed) {
		KieSrampUtil kieSrampUtil = new KieSrampUtil();
           SrampAtomApiClient client = SrampAtomApiClientFactory.createAtomApiClient();
           // With this easy instruction we get all the kie jar artifacts
           List<KieJar> workflows = WorkflowUtil.getCurrentKieJar(client);
		if(workflows!=null && workflows.size()>0){
               // Iterate over all the workflows defined and then initialized
               // the runtime manager
		    for(KieJar workflow:workflows){
		        if (kieSrampUtil.isSRAMPPackageDeployed(workflow.getGroupId(), workflow.getArtifactId(), workflow.getVersion())) {
	                KModuleDeploymentUnit unit = new KModuleDeploymentUnit(
	                        workflow.getGroupId(),
	                        workflow.getArtifactId(),
	                        workflow.getVersion(),
	                        workflow.getWorkflowPackage(),
	                        workflow.getWorkflowKSession());
	                RuntimeManager runtimeManager = kieSrampUtil.getRuntimeManager(processEngineService, unit);
	                RuntimeEngine runtime = runtimeManager.getRuntimeEngine(EmptyContext.get());
	                //use toString to make sure CDI initializes the bean
	                //to make sure the task manager starts up on reboot
	                runtime.getTaskService().toString();
	            }
		    }
		}


	}
}
 
开发者ID:Governance,项目名称:dtgov,代码行数:34,代码来源:TaskApi.java

示例12: stopProcess

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
/**
 * Stop a running process.
 *
 * @param processInstanceId
 *            the process instance id
 */
public void stopProcess(long processInstanceId) {
    KieSrampUtil kieSrampUtil = new KieSrampUtil();
    logger.debug(Messages.i18n.format("ProcessBean.Stopping", processInstanceId)); //$NON-NLS-1$
    String deploymentId = processEngineService.getProcessInstance(processInstanceId).getDeploymentId();
    RuntimeManager runtimeManager = kieSrampUtil.getRuntimeManager(processEngineService, deploymentId);
    RuntimeEngine runtime = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId));
    KieSession ksession = runtime.getKieSession();
    ksession.abortProcessInstance(processInstanceId);
    logger.debug(Messages.i18n.format("ProcessBean.Stopped", processInstanceId)); //$NON-NLS-1$
}
 
开发者ID:Governance,项目名称:dtgov,代码行数:17,代码来源:ProcessBean.java

示例13: signalProcess

import org.kie.api.runtime.manager.RuntimeManager; //导入方法依赖的package包/类
/**
    * Signal a running process.
    * 
    * @param processInstanceId
    *            the process instance id
    * @param signalType
    *            the signal type
    * @param event
    *            the event
    */
public void signalProcess(long processInstanceId, String signalType, Object event) {
	KieSrampUtil kieSrampUtil = new KieSrampUtil();
	logger.info(Messages.i18n.format("ProcessBean.Signalled", processInstanceId, signalType)); //$NON-NLS-1$
    String deploymentId = processEngineService.getProcessInstance(processInstanceId).getDeploymentId();
	RuntimeManager runtimeManager = kieSrampUtil.getRuntimeManager(processEngineService, deploymentId);
	RuntimeEngine runtime = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId));
	KieSession ksession = runtime.getKieSession();
	ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId);
	ksession.signalEvent(signalType, event,processInstance.getId());
}
 
开发者ID:Governance,项目名称:dtgov,代码行数:21,代码来源:ProcessBean.java


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