本文整理汇总了Java中org.kie.api.runtime.manager.RuntimeEngine类的典型用法代码示例。如果您正苦于以下问题:Java RuntimeEngine类的具体用法?Java RuntimeEngine怎么用?Java RuntimeEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeEngine类属于org.kie.api.runtime.manager包,在下文中一共展示了RuntimeEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDeleteProcess
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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.RuntimeEngine; //导入依赖的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: populateSamples
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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
示例4: main
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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
示例5: doTest
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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.RuntimeEngine; //导入依赖的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: getRuntimeEngine
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
private KnowledgeRuntimeEngine getRuntimeEngine(Exchange exchange, Message message) throws HandlerException {
RuntimeEngine runtimeEngine = null;
Long processInstanceId = getProcessInstanceId(exchange, message);
if (processInstanceId != null) {
runtimeEngine = _runtimeManager.getRuntimeEngine(processInstanceId);
}
if (runtimeEngine == null) {
CorrelationKey correlationKey = getCorrelationKey(exchange, message);
if (correlationKey != null) {
runtimeEngine = _runtimeManager.getRuntimeEngine(correlationKey);
}
}
if (runtimeEngine == null) {
throw new HandlerException("runtimeEngine == null");
}
return (KnowledgeRuntimeEngine)runtimeEngine;
}
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:18,代码来源:BPMExchangeHandler.java
示例8: getTaskService
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
/**
* Gets a task service.
* @param serviceDomainName the service domain name
* @param serviceName the service name
* @return the task service
*/
public static final synchronized BPMTaskService getTaskService(QName serviceDomainName, QName serviceName) {
KnowledgeRuntimeManager runtimeManager = KnowledgeRuntimeManagerRegistry.getRuntimeManager(serviceDomainName, serviceName);
if (runtimeManager != null) {
RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine();
if (runtimeEngine != null) {
final TaskService taskService = runtimeEngine.getTaskService();
if (taskService != null) {
InvocationHandler ih = new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return method.invoke(taskService, args);
}
};
return (BPMTaskService)Proxy.newProxyInstance(BPMTaskService.class.getClassLoader(), new Class[]{BPMTaskService.class}, ih);
}
}
}
return null;
}
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:26,代码来源:BPMTaskServiceRegistry.java
示例9: doTestResources
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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
示例10: doTestResources
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
private Throwable doTestResources(String xml) {
try {
ClassLoader loader = getClass().getClassLoader();
SwitchYardModel switchyardModel = _puller.pull(xml, loader);
RulesComponentImplementationModel implementationModel = (RulesComponentImplementationModel)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.insert(this);
session.fireAllRules();
runtimeManager.disposeRuntimeEngine(runtimeEngine);
runtimeManager.close();
return null;
} catch (Throwable t) {
return t;
}
}
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:21,代码来源:RulesSessionTests.java
示例11: getRuntimeEngine
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public RuntimeEngine getRuntimeEngine(Context<?> context) {
KnowledgeRuntimeEngine runtimeEngine;
if (context == null || _type != KnowledgeRuntimeManagerType.PER_PROCESS_INSTANCE) {
context = EmptyContext.get();
}
final ClassLoader origTCCL = Classes.setTCCL(_classLoader);
try {
RuntimeEngine wrapped = _runtimeManager.getRuntimeEngine(context);
initRuntimeEngine(wrapped);
runtimeEngine = new KnowledgeRuntimeEngine(wrapped, _persistent);
} finally {
Classes.setTCCL(origTCCL);
}
return runtimeEngine;
}
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:20,代码来源:KnowledgeRuntimeManager.java
示例12: getTaskService
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
/** Gets a task service.
*
* @param serviceDomainName the service domain name
* @param serviceName the service name
* @return the task service */
public static final synchronized BPMTaskService getTaskService(QName serviceDomainName, QName serviceName) {
KnowledgeRuntimeManager runtimeManager = KnowledgeRuntimeManagerRegistry.getRuntimeManager(serviceDomainName, serviceName);
if (runtimeManager != null) {
RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine();
if (runtimeEngine != null) {
final TaskService taskService = runtimeEngine.getTaskService();
if (taskService != null) {
InvocationHandler ih = new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return method.invoke(taskService, args);
}
};
return (BPMTaskService)Proxy.newProxyInstance(BPMTaskService.class.getClassLoader(), new Class[] {BPMTaskService.class}, ih);
}
}
}
return null;
}
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:25,代码来源:BPMTaskServiceRegistry.java
示例13: getRuntimeEngine
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public RuntimeEngine getRuntimeEngine(Context<?> context) {
KnowledgeRuntimeEngine runtimeEngine;
if (context == null || _type != KnowledgeRuntimeManagerType.PER_PROCESS_INSTANCE) {
context = EmptyContext.get();
}
final ClassLoader origTCCL = Classes.setTCCL(_classLoader);
try {
RuntimeEngine wrapped = _runtimeManager.getRuntimeEngine(context);
initRuntimeEngine(wrapped);
runtimeEngine = new KnowledgeRuntimeEngine(wrapped, _persistent);
} finally {
Classes.setTCCL(origTCCL);
}
return runtimeEngine;
}
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:18,代码来源:KnowledgeRuntimeManager.java
示例14: disposeRuntimeEngine
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
@Override
public void disposeRuntimeEngine(RuntimeEngine runtime) {
if (isClosed()) {
throw new IllegalStateException("Runtime manager " + identifier + " is already closed");
}
local.remove(getIdentifier());
try {
if (canDestroy(runtime)) {
runtime.getKieSession().destroy();
} else {
if (runtime instanceof Disposable) {
((Disposable)runtime).dispose();
}
}
} catch (Exception e) {
// do nothing
if (runtime instanceof Disposable) {
((Disposable)runtime).dispose();
}
}
}
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:22,代码来源:KnowledgePerRequestRuntimeManager.java
示例15: startProcess
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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
示例16: createProducer
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
public Producer createProducer() throws Exception {
RemoteRestRuntimeEngineBuilder engineBuilder = RemoteRuntimeEngineFactory.newRestBuilder();
if (configuration.getUserName() != null) {
engineBuilder.addUserName(configuration.getUserName());
}
if (configuration.getPassword() != null) {
engineBuilder.addPassword(configuration.getPassword());
}
if (configuration.getDeploymentId() != null) {
engineBuilder.addDeploymentId(configuration.getDeploymentId());
}
if (configuration.getConnectionURL() != null) {
engineBuilder.addUrl(configuration.getConnectionURL());
}
if (configuration.getProcessInstanceId() != null) {
engineBuilder.addProcessInstanceId(configuration.getProcessInstanceId());
}
if (configuration.getTimeout() != null) {
engineBuilder.addTimeout(configuration.getTimeout());
}
if (configuration.getExtraJaxbClasses() != null) {
engineBuilder.addExtraJaxbClasses(configuration.getExtraJaxbClasses());
}
RuntimeEngine runtimeEngine = engineBuilder.build();
return new JBPMProducer(this, runtimeEngine);
}
开发者ID:HydAu,项目名称:Camel,代码行数:28,代码来源:JBPMEndpoint.java
示例17: getRuntimeEngine
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的package包/类
private RuntimeEngine getRuntimeEngine() {
try {
if (remoteRestSessionFactory == null) {
URL jbpmURL = new URL(applicationHttpContext);
remoteRestSessionFactory = RemoteRuntimeEngineFactory.newRestBuilder().addDeploymentId(deploymentId).addUrl(jbpmURL).addUserName(userId).addPassword(password)
.buildFactory();
}
RuntimeEngine runtimeEngine = remoteRestSessionFactory.newRuntimeEngine();
return runtimeEngine;
} catch (MalformedURLException e) {
throw new IllegalStateException("This URL is always expected to be valid!", e);
}
}
开发者ID:rhtconsulting,项目名称:task-dashboard-bpms-angular-app,代码行数:14,代码来源:CreateRemoteTasks.java
示例18: testEvaluationProcess
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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
示例19: testRejectAbortProcess
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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
示例20: main
import org.kie.api.runtime.manager.RuntimeEngine; //导入依赖的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
注:本文中的org.kie.api.runtime.manager.RuntimeEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论