- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.kie.api.runtime.process.WorkItemHandler
类的一些代码示例,展示了WorkItemHandler
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkItemHandler
类的具体详情如下:
包路径:org.kie.api.runtime.process.WorkItemHandler
类名称:WorkItemHandler
[英]A work item handler is responsible for executing work items of a specific type. They represent the glue code between an abstract, high-level work item that is used inside the process and the implementation of this work item. Work item handlers should be registered with the WorkItemManager
for each type of work that can be executed in the engine. A work item handler is responsible for executing a work item whenever the work item manager delegates one to it. It should also notify the work item manager when the work item has been completed. It is also possible that a work item handler is requested to abort an existing work item (that is still executing) because it is no longer necessary. This might for example be because the process instance (or a part of the process instance) that is was executing in is being aborted. The work item handler should then try to abort this work item (if possible) and if necessary clean up runtime state related to its execution. For example, a work item handler that is responsible for executing email work items will retrieve the necessary information from the work item (from, to, body, etc.) and invoke the mail server. Afterwards, it will notify the WorkItemManager
that the work item was completed.
[中]工作项处理程序负责执行特定类型的工作项。它们表示流程内部使用的抽象、高级工作项与该工作项的实现之间的粘合代码。对于可以在引擎中执行的每种工作类型,工作项处理程序都应该向WorkItemManager
注册。工作项处理程序负责在工作项经理将一个工作项委托给它时执行该工作项。当工作项完成时,还应通知工作项经理。工作项处理程序也可能因为不再需要而被请求中止现有工作项(仍在执行)。例如,这可能是因为正在中执行的流程实例(或流程实例的一部分)正在被中止。然后,工作项处理程序应尝试中止此工作项(如果可能),并在必要时清除与其执行相关的运行时状态。例如,负责执行电子邮件工作项的工作项处理程序将从工作项(从、到、正文等)检索必要的信息,并调用邮件服务器。之后,它将通知WorkItemManager
工作项已完成。
代码示例来源:origin: kiegroup/jbpm
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
try {
originalTaskHandler.executeWorkItem(workItem, manager);
} catch( Throwable cause ) {
handleExecuteException(cause, workItem, manager);
}
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testTaskAbortSkippable() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
getHandler().abortWorkItem(workItem, manager);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
@Test
代码示例来源:origin: kiegroup/jbpm
@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
try {
originalTaskHandler.abortWorkItem(workItem, manager);
} catch( RuntimeException re ) {
handleAbortException(re, workItem, manager);
}
}
代码示例来源:origin: org.jbpm/jbpm-bpmn2
@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
try {
originalTaskHandler.abortWorkItem(workItem, manager);
} catch( RuntimeException re ) {
handleAbortException(re, workItem, manager);
}
}
代码示例来源:origin: kiegroup/jbpm
@Test(timeout = 10000)
public void testTaskWithVariablesRecurse() {
final TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
handler.executeWorkItem(prepareWorkItemWithTaskVariables("Comment for task ${task.description}"), manager);
final List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(1, tasks.size());
final Task task = taskService.getTaskById(tasks.get(0).getId());
testTaskWithExpectedDescription(task, task.getDescription());
taskService.start(task.getId(), "Darth Vader");
taskService.complete(task.getId(), "Darth Vader", null);
assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME));
final String actualOwner = (String) manager.getResults().get("ActorId");
assertNotNull(actualOwner);
assertEquals("Darth Vader", actualOwner);
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testTaskAbortNotSkippable() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setParameter("Skippable", "false");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(1, tasks.size());
getHandler().abortWorkItem(workItem, manager);
// aborting work item will exit task and not skip it
tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
@Test
代码示例来源:origin: org.drools/knowledge-api
@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
delegate.abortWorkItem(new WorkItemKieAdapter(workItem), new WorkItemManagerKieAdapter(manager));
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testTaskSingleAndGroupActors() throws Exception {
// Properties userGroups = new Properties();
// userGroups.setProperty("Darth Vader", "Crusaders");
//
// UserGroupCallbackManager.getInstance().setCallback(new DefaultUserGroupCallbackImpl(userGroups));
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task One");
workItem.setParameter("NodeName", "TaskNameOne");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("GroupId", "Crusaders");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
workItem = new WorkItemImpl();
workItem.setName("Human Task Two");
workItem.setParameter("NodeName", "TaskNameTwo");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
getHandler().executeWorkItem(workItem, manager);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(2, tasks.size());
}
@Test
代码示例来源:origin: kiegroup/jbpm
@Test
public void testTaskExitByCustomBusinessAdmin() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setParameter("BusinessAdministratorId", "Luke Cage");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
Task task = taskService.getTaskByWorkItemId(workItem.getId());
assertNotNull(task);
getHandler().abortWorkItem(workItem, manager);
task = taskService.getTaskByWorkItemId(workItem.getId());
assertEquals("TaskName", task.getNames().get(0).getText());
assertEquals(10, task.getPriority().intValue());
assertEquals("Comment", task.getDescriptions().get(0).getText());
assertEquals(Status.Exited, task.getTaskData().getStatus());
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
代码示例来源:origin: org.drools/drools-persistence-jpa
public void internalAbortWorkItem( long id ) {
PersistenceContext context = getPersistenceContext();
WorkItemInfo workItemInfo = (WorkItemInfo) context.findWorkItem( id );
// work item may have been aborted
if ( workItemInfo != null ) {
WorkItemImpl workItem = (WorkItemImpl) internalGetWorkItem( workItemInfo );
WorkItemHandler handler = (WorkItemHandler) this.workItemHandlers.get( workItem.getName() );
if ( handler != null ) {
handler.abortWorkItem( workItem, this );
} else {
if ( workItems != null ) {
workItems.remove( id );
throwWorkItemNotFoundException( workItem );
}
}
if ( workItems != null ) {
workItems.remove( id );
}
context.remove( workItemInfo );
}
}
代码示例来源:origin: kiegroup/jbpm
handler.executeWorkItem(workItem, manager);
long currentTime = new Date().getTime();
代码示例来源:origin: org.jbpm/jbpm-human-task-workitems
@Test
public void testTaskAbortSkippable() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
getHandler().abortWorkItem(workItem, manager);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
@Test
代码示例来源:origin: org.kie/drools-infinispan-persistence
@Override
public void internalAbortWorkItem(long id) {
Environment env = this.kruntime.getEnvironment();
//EntityManager em = (EntityManager) env.get(EnvironmentName.CMD_SCOPED_ENTITY_MANAGER);
PersistenceContext context = ((PersistenceContextManager) env.get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER )).getCommandScopedPersistenceContext();
PersistentWorkItem workItemInfo = context.findWorkItem( id );
// work item may have been aborted
if (workItemInfo != null) {
WorkItemImpl workItem = (WorkItemImpl) internalGetWorkItem(workItemInfo);
WorkItemHandler handler = (WorkItemHandler) this.workItemHandlers.get(workItem.getName());
if (handler != null) {
handler.abortWorkItem(workItem, this);
} else {
throwWorkItemNotFoundException( workItem );
}
context.remove(workItemInfo);
}
}
代码示例来源:origin: kiegroup/jbpm
workItem.setParameter("MyObject", myObject);
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
代码示例来源:origin: org.jbpm/jbpm-human-task-workitems
@Test
public void testTaskAbortNotSkippable() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setParameter("Skippable", "false");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(1, tasks.size());
getHandler().abortWorkItem(workItem, manager);
// aborting work item will exit task and not skip it
tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
@Test
代码示例来源:origin: kiegroup/jbpm
@Test
public void testTaskExit() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
Task task = taskService.getTaskByWorkItemId(workItem.getId());
taskService.exit(task.getId(), "Administrator");
task = taskService.getTaskByWorkItemId(workItem.getId());
assertEquals("TaskName", task.getNames().get(0).getText());
assertEquals(10, task.getPriority().intValue());
assertEquals("Comment", task.getDescriptions().get(0).getText());
assertEquals(Status.Exited, task.getTaskData().getStatus());
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
@Test
代码示例来源:origin: org.jbpm/jbpm-human-task-workitems
@Test
public void testTaskExitByCustomBusinessAdmin() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("ActorId", "Darth Vader");
workItem.setParameter("BusinessAdministratorId", "Luke Cage");
workItem.setProcessInstanceId(10);
getHandler().executeWorkItem(workItem, manager);
Task task = taskService.getTaskByWorkItemId(workItem.getId());
assertNotNull(task);
getHandler().abortWorkItem(workItem, manager);
task = taskService.getTaskByWorkItemId(workItem.getId());
assertEquals("TaskName", task.getNames().get(0).getText());
assertEquals(10, task.getPriority().intValue());
assertEquals("Comment", task.getDescriptions().get(0).getText());
assertEquals(Status.Exited, task.getTaskData().getStatus());
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(0, tasks.size());
}
代码示例来源:origin: kiegroup/jbpm
workItem.setParameter("ActorId", "Darth Vader");
workItem.setProcessInstanceId(10);
handler.executeWorkItem(workItem, manager);
代码示例来源:origin: kiegroup/jbpm
handler.executeWorkItem(workItem, manager);
代码示例来源:origin: kiegroup/jbpm
@Test
public void testTaskWithDisableAutoClaimTaskWithGroupOnly() throws Exception {
TestWorkItemManager manager = new TestWorkItemManager();
env.set("Autoclaim", "false");
ksession.setEnvironment(env);
ksession.setWorkItemManager(manager);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Human Task");
workItem.setParameter("NodeName", "TaskName");
workItem.setParameter("Comment", "Comment");
workItem.setParameter("Priority", "10");
workItem.setParameter("GroupId", "Crusaders");
workItem.setParameter("SwimlaneActorId", "Darth Vader");
workItem.setProcessInstanceId(10);
handler.executeWorkItem(workItem, manager);
List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
assertEquals(1, tasks.size());
TaskSummary task = tasks.get(0);
assertEquals("TaskName", task.getName());
assertEquals(10, task.getPriority().intValue());
assertEquals("Comment", task.getDescription());
assertEquals(Status.Ready, task.getStatus());
assertEquals(10, task.getProcessInstanceId().intValue());
taskService.start(task.getId(), "Darth Vader");
taskService.complete(task.getId(), "Darth Vader", null);
assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME));
}
我已经设置了 Azure API 管理服务,并在自定义域上配置了它。在 Azure 门户中 API 管理服务的配置部分下,我设置了以下内容: 因为这是一个客户端系统,我必须屏蔽细节,但以下是基础知识:
我是一名习惯 React Native 的新程序员。我最近开始学习 Fetch API 及其工作原理。我的问题是,我找不到人们使用 API key 在他们的获取语句中访问信息的示例(我很难清楚地表达有
这里有很多关于 API 是什么的东西,但是我找不到我需要的关于插件 API 和类库 API 之间的区别。反正我不明白。 在 Documenting APIs 一书中,我读到:插件 API 和类库 AP
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我正在尝试找出设计以下场景的最佳方法。 假设我已经有了一个 REST API 实现,它将从不同的供应商那里获取书籍并将它们返回给我自己的客户端。 每个供应商都提供单独的 API 来向其消费者提供图书。
请有人向我解释如何使用 api key 以及它有什么用处。 我对此进行了很多搜索,但得到了不同且相互矛盾的答案。有人说 API key 是保密的,它从不作为通信的一部分发送,而其他人则将它发送给客户端
关闭。这个问题是opinion-based .它目前不接受答案。 想改进这个问题?更新问题,以便 editing this post 可以用事实和引用来回答它. 4年前关闭。 Improve this
谁能告诉我为什么 WSo2 API 管理器不进行身份验证?我已经设置了两个 WSo2 API Manager 1.8.0 实例并创建了一个 api。它作为原型(prototype) api 工作正常。
我在学习 DSL 的过程中遇到了 Fluent API。 我在流利的 API 上搜索了很多……我可以得出的基本结论是,流利的 API 使用方法链来使代码流利。 但我无法理解——在面向对象的语言中,我们
基本上,我感兴趣的是在多个区域设置 WSO2 API 管理器;例如亚洲、美国和欧洲。一些 API 将部署在每个区域的数据中心内,而其他 API 将仅部署在特定区域内。 理想情况下,我想要的是一个单一的
我正在构建自己的 API,供以下用户使用: 1) 安卓应用 2) 桌面应用 我的网址之一是:http://api.chatapp.info/order_api/files/getbeers.php我的
我需要向所有用户显示我的站点的分析,但使用 OAuth 它显示为登录用户配置的站点的分析。如何使用嵌入 API 实现仪表板但仅显示我的网站分析? 我能想到的最好的可能性是使用 API key 而不是客
我正在研究大公司如何管理其公共(public) API。我想到的是拥有成熟 API 的公司,例如 Google、Facebook、Twitter 和 Amazon。 这些公司向公众公开了许多不同的 A
在定义客户可访问的 API 时,以下是首选的行业惯例: a) 定义一组显式 API 方法,每个方法都有非常狭窄和特定的目的,例如: SetUserName SetUserAge Se
这在本地 deserver 和部署时都会发生。我成功地能够通过留言簿教程使用 API 资源管理器,但现在我已经创建了自己的项目并尝试访问我编写的第一个 API,它从未出现过。搜索栏旁边的黄色“正在加载
我正在尝试使用 http://ip-api.com/ api通过我的ip地址获取经度和纬度。当我访问 http://ip-api.com/json从我的浏览器或使用 curl,它以 json 格式返回
这里的典型示例是 Twitter 的 API。我从概念上理解 REST API 的工作原理,本质上它只是针对您的特定请求向他们的服务器查询,然后您会在其中收到响应(JSON、XML 等),很棒。 但是
我能想到的最好的标题,但要澄清的是,情况是这样的: 我正在开发一种类似短 url 的服务,该服务允许用户使用他们的 Twitter 帐户“登录”并发布内容。现在这项服务可以包含在 Tweetdeck
我正在设计用于管理评论和讨论线程的 API 方案。我想有一个点 /discussions/:discussionId 当您GET 时,它会返回一组评论和一些元数据。评论也许可以单独访问 /discus
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭去年。 Improve this quest
我是一名优秀的程序员,十分优秀!