use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener in project camunda-bpmn-model by camunda.
the class CamundaTaskListenerImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CamundaTaskListener.class, CAMUNDA_ELEMENT_TASK_LISTENER).namespaceUri(CAMUNDA_NS).instanceProvider(new ModelTypeInstanceProvider<CamundaTaskListener>() {
public CamundaTaskListener newInstance(ModelTypeInstanceContext instanceContext) {
return new CamundaTaskListenerImpl(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();
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener in project camunda-bpmn-model by camunda.
the class ProcessBuilderTest method testCamundaTaskListenerByDelegateExpression.
@Test
public void testCamundaTaskListenerByDelegateExpression() {
modelInstance = Bpmn.createProcess().startEvent().userTask("task").camundaTaskListenerDelegateExpression("start", "aDelegate").endEvent().done();
UserTask userTask = modelInstance.getModelElementById("task");
ExtensionElements extensionElements = userTask.getExtensionElements();
Collection<CamundaTaskListener> taskListeners = extensionElements.getChildElementsByType(CamundaTaskListener.class);
assertThat(taskListeners).hasSize(1);
CamundaTaskListener taskListener = taskListeners.iterator().next();
assertThat(taskListener.getCamundaDelegateExpression()).isEqualTo("aDelegate");
assertThat(taskListener.getCamundaEvent()).isEqualTo("start");
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener in project camunda-bpmn-model by camunda.
the class AbstractUserTaskBuilder method camundaTaskListenerExpression.
public B camundaTaskListenerExpression(String eventName, String expression) {
CamundaTaskListener executionListener = createInstance(CamundaTaskListener.class);
executionListener.setCamundaEvent(eventName);
executionListener.setCamundaExpression(expression);
addExtensionElement(executionListener);
return myself;
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener in project camunda-bpmn-model by camunda.
the class AbstractUserTaskBuilder method camundaTaskListenerDelegateExpression.
public B camundaTaskListenerDelegateExpression(String eventName, String delegateExpression) {
CamundaTaskListener executionListener = createInstance(CamundaTaskListener.class);
executionListener.setCamundaEvent(eventName);
executionListener.setCamundaDelegateExpression(delegateExpression);
addExtensionElement(executionListener);
return myself;
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener in project camunda-bpmn-model by camunda.
the class ProcessBuilderTest method testCamundaTaskListenerByClassName.
@Test
public void testCamundaTaskListenerByClassName() {
modelInstance = Bpmn.createProcess().startEvent().userTask("task").camundaTaskListenerClass("start", "aClass").endEvent().done();
UserTask userTask = modelInstance.getModelElementById("task");
ExtensionElements extensionElements = userTask.getExtensionElements();
Collection<CamundaTaskListener> taskListeners = extensionElements.getChildElementsByType(CamundaTaskListener.class);
assertThat(taskListeners).hasSize(1);
CamundaTaskListener taskListener = taskListeners.iterator().next();
assertThat(taskListener.getCamundaClass()).isEqualTo("aClass");
assertThat(taskListener.getCamundaEvent()).isEqualTo("start");
}
Aggregations