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


Java RuntimeManager类代码示例

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


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

示例1: testDeleteProcess

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
@Test
public void testDeleteProcess() {

	RuntimeManager manager = createRuntimeManager("approval.bpmn");
	RuntimeEngine engine = getRuntimeEngine(null);
	KieSession ksession = engine.getKieSession();
	KieRuntimeLogger log = KieServices.Factory.get().getLoggers().newThreadedFileLogger(ksession, "test", 1000);
	ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());

	TaskService taskService = engine.getTaskService();

	long processInstanceId = startProcess(ksession, taskService);

	callDelete(taskService);

	assertProcessInstanceCompleted(processInstanceId);

	System.out.println("Process instance completed");
	log.close();

	manager.disposeRuntimeEngine(engine);
	manager.close();
}
 
开发者ID:awizen,项目名称:gangehi,代码行数:24,代码来源:ApprovalProcessTest.java

示例2: 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

示例3: 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

示例4: getRuntimeManager

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
/**
 * 
 * Create the runtime manager for the process in the classpath
 * 
 * @return
 */
public static RuntimeManager getRuntimeManager() {
	setupPoolingDataSource();
	EntityManagerFactory emf = Persistence
			.createEntityManagerFactory("org.jbpm.persistence.jpa");
	RuntimeEnvironment env = RuntimeEnvironmentBuilder.Factory
			.get()
			.newDefaultBuilder()
			.entityManagerFactory(emf)
			.addAsset(
					ResourceFactory
							.newClassPathResource("helloProcess.bpmn2"),
					ResourceType.BPMN2).get();
	RuntimeManager manager = RuntimeManagerFactory.Factory.get()
			.newSingletonRuntimeManager(env);
	return manager;
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:23,代码来源:Util.java

示例5: 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

示例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();
	
	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

示例7: KnowledgeRuntimeManager

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
/**
 * Creates a new KnowledgeRuntimeManager.
 * @param classLoader the classLoader
 * @param type the type
 * @param serviceDomainName the serviceDomainName
 * @param serviceName the serviceName
 * @param runtimeManager the runtimeManager
 * @param persistent if persistent
 * @param channelBuilders the channelBuilders
 * @param loggerBuilders the loggerBuilders
 */
KnowledgeRuntimeManager(
        ClassLoader classLoader,
        KnowledgeRuntimeManagerType type,
        QName serviceDomainName,
        QName serviceName,
        RuntimeManager runtimeManager,
        boolean persistent,
        List<ChannelBuilder> channelBuilders,
        List<LoggerBuilder> loggerBuilders) {
    _kieServices = KieServices.Factory.get();
    _classLoader = classLoader;
    _type = type;
    _serviceDomainName = serviceDomainName;
    _serviceName = serviceName;
    _runtimeManager = runtimeManager;
    _persistent = persistent;
    _channelBuilders = channelBuilders;
    _loggerBuilders = loggerBuilders;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:31,代码来源:KnowledgeRuntimeManager.java

示例8: build

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
/**
 * Builds a RuntimeManager.
 * @param type type
 * @param identifier identifier
 * @return a RuntimeManager
 */
public RuntimeManager build(KnowledgeRuntimeManagerType type, String identifier) {
    final RuntimeManager runtimeManager;
    final RuntimeEnvironment runtimeEnvironment = _runtimeEnvironmentBuilder.build();
    final RemoteManifest remoteManifest = RemoteManifest.removeFromEnvironment(runtimeEnvironment.getEnvironment());
    if (remoteManifest != null) {
        runtimeManager = new RemoteRuntimeManager(remoteManifest.buildConfiguration(), identifier);
    } else {
        switch (type) {
            case SINGLETON:
                runtimeManager = _runtimeManagerFactory.newSingletonRuntimeManager(runtimeEnvironment, identifier);
                break;
            case PER_REQUEST:
                runtimeManager = _runtimeManagerFactory.newPerRequestRuntimeManager(runtimeEnvironment, identifier);
                break;
            case PER_PROCESS_INSTANCE:
                runtimeManager = _runtimeManagerFactory.newPerProcessInstanceRuntimeManager(runtimeEnvironment, identifier);
                break;
            default:
                runtimeManager = null;
                break;
        }
    }
    return runtimeManager;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:31,代码来源:RuntimeManagerBuilder.java

示例9: build

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
/** Builds a RuntimeManager.
 * 
 * @param type type
 * @param identifier identifier
 * @return a RuntimeManager */
public RuntimeManager build(KnowledgeRuntimeManagerType type, String identifier) {
    final RuntimeManager runtimeManager;
    final RuntimeEnvironment runtimeEnvironment = _runtimeEnvironmentBuilder.build();
    final RemoteManifest remoteManifest = RemoteManifest.removeFromEnvironment(runtimeEnvironment.getEnvironment());
    if (remoteManifest != null) {
        runtimeManager = new RemoteRuntimeManager(remoteManifest.buildConfiguration(), identifier);
    } else {
        switch (type) {
        case SINGLETON:
            runtimeManager = _runtimeManagerFactory.newSingletonRuntimeManager(runtimeEnvironment, identifier);
            break;
        case PER_REQUEST:
            runtimeManager = _runtimeManagerFactory.newPerRequestRuntimeManager(runtimeEnvironment, identifier);
            break;
        case PER_PROCESS_INSTANCE:
            runtimeManager = _runtimeManagerFactory.newPerProcessInstanceRuntimeManager(runtimeEnvironment, identifier);
            break;
        default:
            runtimeManager = null;
            break;
        }
    }
    return runtimeManager;
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:30,代码来源:RuntimeManagerBuilder.java

示例10: 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

示例11: getRuntimeManager

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
/**
 * Returns a RuntimeManager from the ProcessEngineService for the given KModuleDeploymentUnit.
 * Creates a RuntimeManager if it didn't already exist.
 * @param processEngineService
 * @param unit
 * @return RuntimeManager
 */
public RuntimeManager getRuntimeManager(ProcessEngineService processEngineService, KModuleDeploymentUnit unit) {

	//First see if we have one
	RuntimeManager runtimeManager = processEngineService.getRuntimeManager(unit.getIdentifier());
	if (runtimeManager==null) {
		if (isSRAMPPackageDeployed(unit.getGroupId(), unit.getArtifactId(), unit.getVersion())) {
			unit.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE);
			processEngineService.deployUnit(unit);
			runtimeManager = processEngineService.getRuntimeManager(unit.getIdentifier());
			logger.info(Messages.i18n.format("KieSrampUtil.FoundAndDeployed", unit.getIdentifier() )); //$NON-NLS-1$
		} else {
			logger.error(Messages.i18n.format("KieSrampUtil.NotFound", unit.getIdentifier() )); //$NON-NLS-1$
			throw new IllegalStateException(Messages.i18n.format("KieSrampUtil.NotFound", unit.getIdentifier() )); //$NON-NLS-1$
		}
	}
	return runtimeManager;

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

示例12: testEvaluationProcess

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
@Test
public void testEvaluationProcess() {

	RuntimeManager manager = createRuntimeManager("approval.bpmn");
	RuntimeEngine engine = getRuntimeEngine(null);
	KieSession ksession = engine.getKieSession();
	KieRuntimeLogger log = KieServices.Factory.get().getLoggers().newThreadedFileLogger(ksession, "test", 1000);
	ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());

	TaskService taskService = engine.getTaskService();

	long processInstanceId = startProcess(ksession, taskService);

	approveTask(taskService, "userA", "userB");
	assertNodeTriggered(processInstanceId, "notify next approver");
	List<TaskSummary> tasks = taskService.getTasksOwned("userB", "en-UK");
	assertEquals(1, tasks.size());

	approveTask(taskService, "userB", "userC");
	assertNodeTriggered(processInstanceId, "notify next approver");
	tasks = taskService.getTasksOwned("userC", "en-UK");
	assertEquals(1, tasks.size());


	approveTask(taskService, "userC", "userD");
	tasks = taskService.getTasksOwned("userD", "en-UK");
	assertEquals(1, tasks.size());

	approveTask(taskService, "userD", null);

	assertNodeTriggered(processInstanceId, "authorised");

	System.out.println("Process instance completed");
	log.close();

	manager.disposeRuntimeEngine(engine);
	manager.close();
}
 
开发者ID:awizen,项目名称:gangehi,代码行数:39,代码来源:ApprovalProcessTest.java

示例13: testRejectAbortProcess

import org.kie.api.runtime.manager.RuntimeManager; //导入依赖的package包/类
@Test
public void testRejectAbortProcess() {

	RuntimeManager manager = createRuntimeManager("approval.bpmn");
	RuntimeEngine engine = getRuntimeEngine(null);
	KieSession ksession = engine.getKieSession();
	KieRuntimeLogger log = KieServices.Factory.get().getLoggers().newThreadedFileLogger(ksession, "test", 1000);
	ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());

	TaskService taskService = engine.getTaskService();

	long processInstanceId = startProcess(ksession, taskService);

	approveTask(taskService, "userA", "userB");
	assertNodeTriggered(processInstanceId, "notify next approver");
	List<TaskSummary> tasks = taskService.getTasksOwned("userB", "en-UK");
	assertEquals(1, tasks.size());

	rejectTask(taskService, "userB", "userC");
	assertNodeTriggered(processInstanceId, "notify originator");
	tasks = taskService.getTasksOwned("userC", "en-UK");
	assertEquals(1, tasks.size());

	TaskSummary taskSummary = tasks.get(0);
	assertEquals("edit approval item", taskSummary.getName());

	abortTask(taskService, "userC");
	assertNodeTriggered(processInstanceId, "aborted");

	System.out.println("Process instance completed");
	log.close();

	manager.disposeRuntimeEngine(engine);
	manager.close();
}
 
开发者ID:awizen,项目名称:gangehi,代码行数:36,代码来源:ApprovalProcessTest.java

示例14: 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

示例15: 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


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