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


Java CamundaExecutionListener.setCamundaExpression方法代码示例

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


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

示例1: testExecutionListenerExtension

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testExecutionListenerExtension() {
  CamundaExecutionListener processListener = process.getExtensionElements().getElementsQuery().filterByType(CamundaExecutionListener.class).singleResult();
  CamundaExecutionListener startEventListener = startEvent.getExtensionElements().getElementsQuery().filterByType(CamundaExecutionListener.class).singleResult();
  CamundaExecutionListener serviceTaskListener = serviceTask.getExtensionElements().getElementsQuery().filterByType(CamundaExecutionListener.class).singleResult();
  assertThat(processListener.getCamundaClass()).isEqualTo(TEST_CLASS_XML);
  assertThat(processListener.getCamundaEvent()).isEqualTo(TEST_EXECUTION_EVENT_XML);
  assertThat(startEventListener.getCamundaExpression()).isEqualTo(TEST_EXPRESSION_XML);
  assertThat(startEventListener.getCamundaEvent()).isEqualTo(TEST_EXECUTION_EVENT_XML);
  assertThat(serviceTaskListener.getCamundaDelegateExpression()).isEqualTo(TEST_DELEGATE_EXPRESSION_XML);
  assertThat(serviceTaskListener.getCamundaEvent()).isEqualTo(TEST_EXECUTION_EVENT_XML);
  processListener.setCamundaClass(TEST_CLASS_API);
  processListener.setCamundaEvent(TEST_EXECUTION_EVENT_API);
  startEventListener.setCamundaExpression(TEST_EXPRESSION_API);
  startEventListener.setCamundaEvent(TEST_EXECUTION_EVENT_API);
  serviceTaskListener.setCamundaDelegateExpression(TEST_DELEGATE_EXPRESSION_API);
  serviceTaskListener.setCamundaEvent(TEST_EXECUTION_EVENT_API);
  assertThat(processListener.getCamundaClass()).isEqualTo(TEST_CLASS_API);
  assertThat(processListener.getCamundaEvent()).isEqualTo(TEST_EXECUTION_EVENT_API);
  assertThat(startEventListener.getCamundaExpression()).isEqualTo(TEST_EXPRESSION_API);
  assertThat(startEventListener.getCamundaEvent()).isEqualTo(TEST_EXECUTION_EVENT_API);
  assertThat(serviceTaskListener.getCamundaDelegateExpression()).isEqualTo(TEST_DELEGATE_EXPRESSION_API);
  assertThat(serviceTaskListener.getCamundaEvent()).isEqualTo(TEST_EXECUTION_EVENT_API);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:25,代码来源:CamundaExtensionsTest.java

示例2: camundaExecutionListenerExpression

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
public B camundaExecutionListenerExpression(String eventName, String expression) {
  CamundaExecutionListener executionListener = createInstance(CamundaExecutionListener.class);
  executionListener.setCamundaEvent(eventName);
  executionListener.setCamundaExpression(expression);

  addExtensionElement(executionListener);

  return myself;
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:10,代码来源:AbstractFlowNodeBuilder.java

示例3: testSetVariableInTakeListener

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testSetVariableInTakeListener() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
    .startEvent(START_EVENT_ID)
    .userTask(TASK_BEFORE_CONDITION_ID)
      .name(TASK_BEFORE_CONDITION)
    .sequenceFlowId(FLOW_ID)
    .userTask(TASK_WITH_CONDITION_ID)
      .name(TASK_WITH_CONDITION)
    .endEvent(END_EVENT_ID)
    .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  modelInstance = specifier.specifyConditionalProcess(modelInstance, true);
  engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy());

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
  Task task = taskQuery.singleResult();
  assertNotNull(task);
  assertEquals(TASK_BEFORE_CONDITION, task.getName());

  //when task is completed
  taskService.complete(task.getId());

  //then take listener sets variable
  //conditional event is triggered
  tasksAfterVariableIsSet = taskQuery.list();
  specifier.assertTaskNames(tasksAfterVariableIsSet, true, false);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:35,代码来源:ConditionalEventTriggeredByExecutionListenerTest.java

示例4: testNonInterruptingSetVariableInTakeListener

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testNonInterruptingSetVariableInTakeListener() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
    .startEvent(START_EVENT_ID)
    .userTask(TASK_BEFORE_CONDITION_ID)
      .name(TASK_BEFORE_CONDITION)
    .sequenceFlowId(FLOW_ID)
    .userTask(TASK_WITH_CONDITION_ID)
      .name(TASK_WITH_CONDITION)
    .endEvent(END_EVENT_ID)
    .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  modelInstance = specifier.specifyConditionalProcess(modelInstance, false);
  engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy());

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
  Task task = taskQuery.singleResult();
  assertNotNull(task);
  assertEquals(TASK_BEFORE_CONDITION, task.getName());

  //when task is completed
  taskService.complete(task.getId());

  //then take listener sets variable
  //non interrupting boundary event is triggered
  tasksAfterVariableIsSet = taskQuery.list();
  assertEquals(specifier.expectedTaskCount(), tasksAfterVariableIsSet.size());
  assertEquals(specifier.expectedSubscriptions(), conditionEventSubscriptionQuery.list().size());
  specifier.assertTaskNames(tasksAfterVariableIsSet, false, false);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:37,代码来源:ConditionalEventTriggeredByExecutionListenerTest.java

示例5: testSetVariableInTakeListenerWithAsyncBefore

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testSetVariableInTakeListenerWithAsyncBefore() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
    .startEvent(START_EVENT_ID)
    .userTask(TASK_BEFORE_CONDITION_ID)
      .name(TASK_BEFORE_CONDITION)
    .sequenceFlowId(FLOW_ID)
    .userTask(TASK_WITH_CONDITION_ID)
      .name(TASK_WITH_CONDITION)
      .camundaAsyncBefore()
    .endEvent(END_EVENT_ID)
    .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  modelInstance = specifier.specifyConditionalProcess(modelInstance, true);
  engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy());

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
  Task task = taskQuery.singleResult();
  assertNotNull(task);
  assertEquals(TASK_BEFORE_CONDITION, task.getName());

  //when task is completed
  taskService.complete(task.getId());

  //then take listener sets variable
  //conditional event is triggered
  tasksAfterVariableIsSet = taskQuery.list();
  specifier.assertTaskNames(tasksAfterVariableIsSet, true, false);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:36,代码来源:ConditionalEventTriggeredByExecutionListenerTest.java

示例6: testSetVariableOnParentScopeInTakeListener

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testSetVariableOnParentScopeInTakeListener() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
    .startEvent(START_EVENT_ID)
    .subProcess()
    .embeddedSubProcess()
    .startEvent()
      .userTask(TASK_BEFORE_CONDITION_ID)
        .name(TASK_BEFORE_CONDITION)
      .sequenceFlowId(FLOW_ID)
      .userTask(TASK_WITH_CONDITION_ID)
        .name(TASK_WITH_CONDITION)
      .endEvent()
    .subProcessDone()
    .endEvent(END_EVENT_ID)
    .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE_ON_PARENT);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  modelInstance = specifier.specifyConditionalProcess(modelInstance, true);
  engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy());

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
  Task task = taskQuery.singleResult();
  assertNotNull(task);
  assertEquals(TASK_BEFORE_CONDITION, task.getName());

  //when task is completed
  taskService.complete(task.getId());

  //then start listener sets variable
  //conditional event is triggered
  tasksAfterVariableIsSet = taskQuery.list();
  specifier.assertTaskNames(tasksAfterVariableIsSet, true, false);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:40,代码来源:ConditionalEventTriggeredByExecutionListenerTest.java

示例7: testNonInterruptingSetVariableOnParentScopeInTakeListener

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testNonInterruptingSetVariableOnParentScopeInTakeListener() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
    .startEvent(START_EVENT_ID)
    .subProcess()
    .embeddedSubProcess()
      .startEvent()
      .userTask(TASK_BEFORE_CONDITION_ID)
        .name(TASK_BEFORE_CONDITION)
      .sequenceFlowId(FLOW_ID)
        .userTask(TASK_WITH_CONDITION_ID)
        .name(TASK_WITH_CONDITION)
      .endEvent()
    .subProcessDone()
    .endEvent(END_EVENT_ID)
    .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE_ON_PARENT);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  modelInstance = specifier.specifyConditionalProcess(modelInstance, false);
  engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy());

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
  Task task = taskQuery.singleResult();
  assertNotNull(task);
  assertEquals(TASK_BEFORE_CONDITION, task.getName());

  //when task is completed
  taskService.complete(task.getId());

  //then start listener sets variable
  //non interrupting boundary event is triggered
  tasksAfterVariableIsSet = taskQuery.list();
  specifier.assertTaskNames(tasksAfterVariableIsSet, false, false);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:40,代码来源:ConditionalEventTriggeredByExecutionListenerTest.java

示例8: testSetVariableInTakeListener

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testSetVariableInTakeListener() {
  final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
                                                .startEvent()
                                                .userTask(TASK_BEFORE_CONDITION_ID)
                                                  .name(TASK_BEFORE_CONDITION)
                                                .sequenceFlowId(FLOW_ID)
                                                .userTask(TASK_WITH_CONDITION_ID).name(TASK_WITH_CONDITION)
                                                .endEvent()
                                                .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  deployConditionalBoundaryEventProcess(modelInstance, TASK_WITH_CONDITION_ID, true);

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
  Task task = taskQuery.singleResult();
  assertNotNull(task);
  assertEquals(TASK_BEFORE_CONDITION, task.getName());

  //when task is completed
  taskService.complete(task.getId());

  //then take listener sets variable
  //non interrupting boundary event is triggered with default evaluation behavior
  tasksAfterVariableIsSet = taskQuery.list();
  assertEquals(TASK_AFTER_CONDITION, tasksAfterVariableIsSet.get(0).getName());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:33,代码来源:BoundaryConditionalEventTest.java

示例9: testNonInterruptingSetVariableInTakeListener

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testNonInterruptingSetVariableInTakeListener() {
  final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
                                                .startEvent()
                                                .userTask(TASK_BEFORE_CONDITION_ID)
                                                  .name(TASK_BEFORE_CONDITION)
                                                .sequenceFlowId(FLOW_ID)
                                                .userTask(TASK_WITH_CONDITION_ID).name(TASK_WITH_CONDITION)
                                                .endEvent()
                                                .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  deployConditionalBoundaryEventProcess(modelInstance, TASK_WITH_CONDITION_ID, false);

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());
  Task task = taskQuery.singleResult();
  assertNotNull(task);
  assertEquals(TASK_BEFORE_CONDITION, task.getName());

  //when task is completed
  taskService.complete(task.getId());

  //then take listener sets variable
  //non interrupting boundary event is triggered with default evaluation behavior
  tasksAfterVariableIsSet = taskQuery.list();
  assertEquals(2, tasksAfterVariableIsSet.size());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:33,代码来源:BoundaryConditionalEventTest.java

示例10: testNonInterruptingSetVariableInTakeListenerWithAsyncBefore

import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入方法依赖的package包/类
@Test
public void testNonInterruptingSetVariableInTakeListenerWithAsyncBefore() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
    .startEvent(START_EVENT_ID)
    .userTask(TASK_BEFORE_CONDITION_ID)
      .name(TASK_BEFORE_CONDITION)
    .sequenceFlowId(FLOW_ID)
    .userTask(TASK_WITH_CONDITION_ID)
      .name(TASK_WITH_CONDITION)
      .camundaAsyncBefore()
    .endEvent(END_EVENT_ID)
    .done();
  CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
  listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
  listener.setCamundaExpression(EXPR_SET_VARIABLE);
  modelInstance.<SequenceFlow>getModelElementById(FLOW_ID).builder().addExtensionElement(listener);
  modelInstance = specifier.specifyConditionalProcess(modelInstance, false);
  engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy());

  // given
  ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);

  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId());

  //when task is completed
  taskService.complete(taskQuery.singleResult().getId());

  //then take listener sets variable
  //non interrupting boundary event is triggered
  specifier.assertTaskNames(taskQuery.list(), false, true);

  //and job was created
  Job job = engine.getManagementService().createJobQuery().singleResult();
  assertNotNull(job);
  assertEquals(1, conditionEventSubscriptionQuery.list().size());

  //when job is executed task is created
  engine.getManagementService().executeJob(job.getId());
  //when tasks are completed
  for (Task task : taskQuery.list()) {
    taskService.complete(task.getId());
  }

  //then no task exist and process instance is ended
  tasksAfterVariableIsSet = taskQuery.list();
  assertEquals(0, tasksAfterVariableIsSet.size());
  assertNull(runtimeService.createProcessInstanceQuery().singleResult());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:49,代码来源:ConditionalEventTriggeredByExecutionListenerTest.java


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