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


Java KieSession.startProcess方法代码示例

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


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

示例1: doTest

import org.kie.api.runtime.KieSession; //导入方法依赖的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: populateSamples

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
public void populateSamples(int numTask, int numProcessVars, String processId) {

		RuntimeEngine runtimeEngine = getRuntimeEngine();

		KieSession kieSession = runtimeEngine.getKieSession();
		Map<String, Object> processVariables;

		// Name, age, email, income, amount, period.
		for (int i = 0; i < numTask; i++) {
			// 1 2 3
			processVariables = getProcessArgs(numProcessVars);
			kieSession.startProcess(processId, processVariables);
		}

		// getTasks();
	}
 
开发者ID:rhtconsulting,项目名称:task-dashboard-bpms-angular-app,代码行数:17,代码来源:CreateRemoteTasks.java

示例3: runFaultBoundaryProcess

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
private void runFaultBoundaryProcess(final boolean bomb) throws Exception {
    serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
        public void handleMessage(Exchange exchange) throws HandlerException {
            if (bomb) {
                throw new HandlerException("BOOM!");
            }
        }
    });
    serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add(ResourceFactory.newClassPathResource(FAULT_BOUNDARY_PROCESS_BPMN), ResourceType.BPMN2);
    KieBase kbase = kbuilder.newKnowledgeBase();
    KieSession ksession = kbase.newKieSession();
    SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
    ssth.setProcessRuntime(ksession);
    ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
    ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
    WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultBoundaryProcess");
    String output = (String)wpi.getVariable("TestOutput");
    Assert.assertEquals(bomb ? "Failure" : "Success", output);
    ksession.halt();
    ksession.dispose();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:24,代码来源:BPMServiceTests.java

示例4: testCallService

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Test
public void testCallService() throws Exception {
    final Holder holder = new Holder();
    serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
        public void handleMessage(Exchange exchange) throws HandlerException {
            holder.setValue("message handled");
        }
    });
    serviceDomain.registerServiceReference(new QName("CallService"), new InOnlyService());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add(ResourceFactory.newClassPathResource(CALL_SERVICE_BPMN), ResourceType.BPMN2);
    KieBase kbase = kbuilder.newKnowledgeBase();
    KieSession ksession = kbase.newKieSession();
    SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
    ssth.setProcessRuntime(ksession);
    ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
    ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
    ksession.startProcess("CallService");
    ksession.halt();
    ksession.dispose();
    Assert.assertEquals("message handled", holder.getValue());
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:23,代码来源:BPMServiceTests.java

示例5: doTest

import org.kie.api.runtime.KieSession; //导入方法依赖的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

示例6: doTestResources

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
private Throwable doTestResources(String xml) {
    try {
        ClassLoader loader = getClass().getClassLoader();
        SwitchYardModel switchyardModel = _puller.pull(xml, loader);
        BPMComponentImplementationModel implementationModel = (BPMComponentImplementationModel)switchyardModel.getComposite().getComponents().get(0).getImplementation();
        ServiceDomain serviceDomain = new ServiceDomainManager().createDomain();
        QName serviceName = new QName("test");
        KnowledgeRuntimeManagerFactory runtimeManagerFactory = new KnowledgeRuntimeManagerFactory(loader, serviceDomain, serviceName, implementationModel);
        KnowledgeRuntimeManager runtimeManager = runtimeManagerFactory.newRuntimeManager(KnowledgeRuntimeManagerType.SINGLETON);
        RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine();
        KieSession session = runtimeEngine.getKieSession();
        session.startProcess("TestProcess");
        runtimeManager.disposeRuntimeEngine(runtimeEngine);
        runtimeManager.close();
        return null;
    } catch (Throwable t) {
        return t;
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:20,代码来源:BPMSessionTests.java

示例7: doTest

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
@Test
public void doTest() throws Exception {
	List<Status> status = Arrays.asList(Status.Ready);
	KieSession ksession = engine.getKieSession();
	TaskService taskService = engine.getTaskService();
	// you could also use getTasksAssignedAsPotentialOwner(user, lang)
	List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwnerByStatus(USER, status, "en-UK");
	cleanTasks(taskService, tasks);
	for (int i = 0; i < TOTAL_PROCESSES; i++) {
		ksession.startProcess(PROCESS_WITH_TASK_ASSIGNED_TO_A_GROUP);
	}
	tasks = taskService.getTasksAssignedAsPotentialOwnerByStatus(USER, status, "en-UK");
	assertEquals(TOTAL_PROCESSES, tasks.size());
	cleanTasks(taskService, tasks);
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:17,代码来源:StartProcesssAndHandleTasks.java

示例8: main

import org.kie.api.runtime.KieSession; //导入方法依赖的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

示例9: doTest

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Test
public void doTest() throws IOException {
	KieServices ks = KieServices.Factory.get();
	KieRepository kr = ks.getRepository();
	UrlResource urlResource = (UrlResource) ks.getResources().newUrlResource(URL);
	urlResource.setUsername(USER);
	urlResource.setPassword(PASSWORD);
	urlResource.setBasicAuthentication("enabled");
	InputStream is = urlResource.getInputStream();
	KieModule kModule = kr.addKieModule(ks.getResources().newInputStreamResource(is));
	KieContainer kc = ks.newKieContainer(kModule.getReleaseId());
	KieSession kSession = kc.newKieSession();
	kSession.startProcess("project1.hello");
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:15,代码来源:UrlResourceTest.java

示例10: doTest

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Test
public void doTest() {
	logger.info("Testing simple process without persistence");
	KieContainer kc = KieServices.Factory.get().getKieClasspathContainer();
	KieSession ksession = kc.getKieBase("TestProcessKB").newKieSession();
	ksession.startProcess("HelloWorldProcess");
	ksession.dispose();
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:9,代码来源:ProcessTest.java

示例11: runFaultEventProcess

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
private void runFaultEventProcess(final boolean bomb) throws Exception {
    serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
        public void handleMessage(Exchange exchange) throws HandlerException {
            if (bomb) {
                throw new HandlerException("BOOM!");
            }
        }
    });
    serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add(ResourceFactory.newClassPathResource(FAULT_EVENT_PROCESS_BPMN), ResourceType.BPMN2);
    KieBase kbase = kbuilder.newKnowledgeBase();
    KieSession ksession = kbase.newKieSession();
    SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
    ssth.setProcessRuntime(ksession);
    ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
    ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
    WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultEventProcess");
    HandlerException he = (HandlerException)wpi.getVariable("faultEvent");
    if (bomb) {
        Assert.assertNotNull(he);
        Assert.assertEquals("BOOM!", he.getMessage());
    } else {
        Assert.assertNull(he);
    }
    ksession.halt();
    ksession.dispose();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:29,代码来源:BPMServiceTests.java

示例12: main

import org.kie.api.runtime.KieSession; //导入方法依赖的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

示例13: main

import org.kie.api.runtime.KieSession; //导入方法依赖的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

示例14: execute

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Override
void execute(KieSession kieSession, TaskService taskService, JBPMConfiguration configuration, Exchange exchange) {
    ProcessInstance processInstance = kieSession.startProcess(getProcessId(configuration, exchange), getParameters(configuration, exchange));
    setResult(exchange, processInstance);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:JBPMProducer.java

示例15: start

import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
@Test
public void start() {
	KieSession kieSession = engine.getKieSession();
	ProcessInstance pi = kieSession.startProcess(PROCESS_ID);
	System.out.println("Process Started! Instance ID: " + pi.getId());
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:7,代码来源:StartProcessJMSTest.java


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