本文整理汇总了Java中org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener类的典型用法代码示例。如果您正苦于以下问题:Java CamundaExecutionListener类的具体用法?Java CamundaExecutionListener怎么用?Java CamundaExecutionListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CamundaExecutionListener类属于org.camunda.bpm.model.bpmn.instance.camunda包,在下文中一共展示了CamundaExecutionListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: testCamundaScriptExecutionListener
import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入依赖的package包/类
@Test
public void testCamundaScriptExecutionListener() {
CamundaExecutionListener sequenceFlowListener = sequenceFlow.getExtensionElements().getElementsQuery().filterByType(CamundaExecutionListener.class).singleResult();
CamundaScript script = sequenceFlowListener.getCamundaScript();
assertThat(script.getCamundaScriptFormat()).isEqualTo("groovy");
assertThat(script.getCamundaResource()).isNull();
assertThat(script.getTextContent()).isEqualTo("println 'Hello World'");
CamundaScript newScript = modelInstance.newInstance(CamundaScript.class);
newScript.setCamundaScriptFormat("groovy");
newScript.setCamundaResource("test.groovy");
sequenceFlowListener.setCamundaScript(newScript);
script = sequenceFlowListener.getCamundaScript();
assertThat(script.getCamundaScriptFormat()).isEqualTo("groovy");
assertThat(script.getCamundaResource()).isEqualTo("test.groovy");
assertThat(script.getTextContent()).isEmpty();
}
示例3: testSetLocalScopeWithExecutionListenerTake
import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入依赖的package包/类
@Test
public void testSetLocalScopeWithExecutionListenerTake() {
BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process")
.startEvent().id("activityId")
.sequenceFlowId("sequenceFlow")
.endEvent()
.done();
CamundaExecutionListener listener = modelInstance.newInstance(CamundaExecutionListener.class);
listener.setCamundaEvent(ExecutionListener.EVENTNAME_TAKE);
listener.setCamundaClass(ExecutionListener.class.getName());
modelInstance.<SequenceFlow>getModelElementById("sequenceFlow").builder().addExtensionElement(listener);
testHelper.deploy(modelInstance);
engineRule.getRuntimeService().startProcessInstanceByKey("process");
}
示例4: tweakGateway
import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入依赖的package包/类
protected void tweakGateway(ExclusiveGateway xorGateway) {
ModelInstance bpmn = xorGateway.getModelInstance();
double probabilitySum = 0;
// Process Variable used to store sample from distribution to decide for
// outgoing transition
String var = "SIM_SAMPLE_VALUE_" + xorGateway.getId().replaceAll("-", "_");
Collection<SequenceFlow> flows = xorGateway.getOutgoing();
if (flows.size() > 1) { // if outgoing flows = 1 it is a joining gateway
for (SequenceFlow sequenceFlow : flows) {
double probability = readCamundaProperty(sequenceFlow, "probability").map(Double::valueOf).orElse(1.0);
ConditionExpression conditionExpression = bpmn.newInstance(ConditionExpression.class);
conditionExpression.setTextContent("#{" + var + " >= " + probabilitySum + " && " + var + " < " + (probabilitySum + probability) + "}");
sequenceFlow.setConditionExpression(conditionExpression);
probabilitySum += probability;
}
// add execution listener to do decision based on random which corresponds
// to configured probabilities
// (because of expressions on outgoing sequence flows)
CamundaExecutionListener executionListener = bpmn.newInstance(CamundaExecutionListener.class);
executionListener.setCamundaEvent("start");
CamundaScript script = bpmn.newInstance(CamundaScript.class);
script.setTextContent(//
"sample = com.camunda.demo.environment.simulation.StatisticsHelper.nextSample(" + probabilitySum + ");\n" + "execution.setVariable('" + var
+ "', sample);");
script.setCamundaScriptFormat("Javascript");
executionListener.setCamundaScript(script);
if (xorGateway.getExtensionElements() == null) {
ExtensionElements extensionElements = bpmn.newInstance(ExtensionElements.class);
xorGateway.addChildElement(extensionElements);
}
xorGateway.getExtensionElements().addChildElement(executionListener);
}
}
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:40,代码来源:DemoModelInstrumentator.java
示例5: registerType
import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入依赖的package包/类
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CamundaExecutionListener.class, CAMUNDA_ELEMENT_EXECUTION_LISTENER)
.namespaceUri(CAMUNDA_NS)
.instanceProvider(new ModelTypeInstanceProvider<CamundaExecutionListener>() {
public CamundaExecutionListener newInstance(ModelTypeInstanceContext instanceContext) {
return new CamundaExecutionListenerImpl(instanceContext);
}
});
camundaEventAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_EVENT)
.namespace(CAMUNDA_NS)
.build();
camundaClassAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CLASS)
.namespace(CAMUNDA_NS)
.build();
camundaExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_EXPRESSION)
.namespace(CAMUNDA_NS)
.build();
camundaDelegateExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DELEGATE_EXPRESSION)
.namespace(CAMUNDA_NS)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
camundaFieldCollection = sequenceBuilder.elementCollection(CamundaField.class)
.build();
camundaScriptChild = sequenceBuilder.element(CamundaScript.class)
.build();
typeBuilder.build();
}
示例6: camundaExecutionListenerClass
import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入依赖的package包/类
public B camundaExecutionListenerClass(String eventName, String fullQualifiedClassName) {
CamundaExecutionListener executionListener = createInstance(CamundaExecutionListener.class);
executionListener.setCamundaEvent(eventName);
executionListener.setCamundaClass(fullQualifiedClassName);
addExtensionElement(executionListener);
return myself;
}
示例7: 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;
}
示例8: camundaExecutionListenerDelegateExpression
import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入依赖的package包/类
public B camundaExecutionListenerDelegateExpression(String eventName, String delegateExpression) {
CamundaExecutionListener executionListener = createInstance(CamundaExecutionListener.class);
executionListener.setCamundaEvent(eventName);
executionListener.setCamundaDelegateExpression(delegateExpression);
addExtensionElement(executionListener);
return myself;
}
示例9: createModelAccessTask
import org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener; //导入依赖的package包/类
protected Task createModelAccessTask(BpmnModelInstance modelInstance, Class<?> delegateClass) {
ManualTask task = modelInstance.newInstance(ManualTask.class);
task.setId("manualTask");
CamundaExecutionListener executionListener = modelInstance.newInstance(CamundaExecutionListener.class);
executionListener.setCamundaEvent(ExecutionListener.EVENTNAME_START);
executionListener.setCamundaClass(delegateClass.getName());
task.builder().addExtensionElement(executionListener);
return task;
}
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: 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
示例15: 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());
}