Search in sources :

Example 1 with ExtensionElements

use of org.camunda.bpm.model.bpmn.instance.ExtensionElements in project camunda-bpmn-model by camunda.

the class CompatabilityTest method modifyingElementWithActivitiNsKeepsIt.

@Test
public void modifyingElementWithActivitiNsKeepsIt() {
    BpmnModelInstance modelInstance = Bpmn.readModelFromStream(CamundaExtensionsTest.class.getResourceAsStream("CamundaExtensionsCompatabilityTest.xml"));
    ProcessImpl process = modelInstance.getModelElementById(PROCESS_ID);
    ExtensionElements extensionElements = process.getExtensionElements();
    Collection<CamundaExecutionListener> listeners = extensionElements.getChildElementsByType(CamundaExecutionListener.class);
    String listenerClass = "org.foo.Bar";
    for (CamundaExecutionListener listener : listeners) {
        listener.setCamundaClass(listenerClass);
    }
    for (CamundaExecutionListener listener : listeners) {
        assertThat(listener.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "class"), is(listenerClass));
    }
}
Also used : ExtensionElements(org.camunda.bpm.model.bpmn.instance.ExtensionElements) ProcessImpl(org.camunda.bpm.model.bpmn.impl.instance.ProcessImpl) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) CamundaExtensionsTest(org.camunda.bpm.model.bpmn.CamundaExtensionsTest) CamundaExtensionsTest(org.camunda.bpm.model.bpmn.CamundaExtensionsTest) Test(org.junit.Test)

Example 2 with ExtensionElements

use of org.camunda.bpm.model.bpmn.instance.ExtensionElements in project camunda-bpmn-model by camunda.

the class ExtensionElementsImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ExtensionElements.class, BPMN_ELEMENT_EXTENSION_ELEMENTS).namespaceUri(BPMN20_NS).instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<ExtensionElements>() {

        public ExtensionElements newInstance(ModelTypeInstanceContext instanceContext) {
            return new ExtensionElementsImpl(instanceContext);
        }
    });
    typeBuilder.build();
}
Also used : ExtensionElements(org.camunda.bpm.model.bpmn.instance.ExtensionElements) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Aggregations

ExtensionElements (org.camunda.bpm.model.bpmn.instance.ExtensionElements)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)1 CamundaExtensionsTest (org.camunda.bpm.model.bpmn.CamundaExtensionsTest)1 ProcessImpl (org.camunda.bpm.model.bpmn.impl.instance.ProcessImpl)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 Test (org.junit.Test)1