Search in sources :

Example 1 with CamundaTaskListener

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();
}
Also used : CamundaTaskListener(org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener) SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 2 with CamundaTaskListener

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");
}
Also used : CamundaTaskListener(org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener) Test(org.junit.Test)

Example 3 with CamundaTaskListener

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;
}
Also used : CamundaTaskListener(org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener)

Example 4 with CamundaTaskListener

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;
}
Also used : CamundaTaskListener(org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener)

Example 5 with CamundaTaskListener

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");
}
Also used : CamundaTaskListener(org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener) Test(org.junit.Test)

Aggregations

CamundaTaskListener (org.camunda.bpm.model.bpmn.instance.camunda.CamundaTaskListener)12 Test (org.junit.Test)6 UserTask (org.camunda.bpm.model.bpmn.instance.UserTask)2 CamundaField (org.camunda.bpm.model.bpmn.instance.camunda.CamundaField)1 CamundaScript (org.camunda.bpm.model.bpmn.instance.camunda.CamundaScript)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 SequenceBuilder (org.camunda.bpm.model.xml.type.child.SequenceBuilder)1