gpt4 book ai didi

org.kie.api.runtime.process.WorkItemHandler.abortWorkItem()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 00:01:05 25 4
gpt4 key购买 nike

本文整理了Java中org.kie.api.runtime.process.WorkItemHandler.abortWorkItem()方法的一些代码示例,展示了WorkItemHandler.abortWorkItem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkItemHandler.abortWorkItem()方法的具体详情如下:
包路径:org.kie.api.runtime.process.WorkItemHandler
类名称:WorkItemHandler
方法名:abortWorkItem

WorkItemHandler.abortWorkItem介绍

[英]The given work item should be aborted.
[中]

代码示例

代码示例来源:origin: kiegroup/jbpm

@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
  try {
    originalTaskHandler.abortWorkItem(workItem, manager);
  } catch( RuntimeException re ) { 
    handleAbortException(re, 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

@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 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.jbpm/jbpm-bpmn2

@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
  try {
    originalTaskHandler.abortWorkItem(workItem, manager);
  } catch( RuntimeException re ) { 
    handleAbortException(re, workItem, manager);
  }
}

代码示例来源:origin: org.drools/knowledge-api

@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
  delegate.abortWorkItem(new WorkItemKieAdapter(workItem), new WorkItemManagerKieAdapter(manager));
}

代码示例来源: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: 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: 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.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: 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());
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com