Search in sources :

Example 1 with CamundaOutputParameter

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

the class CamundaOutputParameterImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CamundaOutputParameter.class, CAMUNDA_ELEMENT_OUTPUT_PARAMETER).namespaceUri(CAMUNDA_NS).instanceProvider(new ModelTypeInstanceProvider<CamundaOutputParameter>() {

        public CamundaOutputParameter newInstance(ModelTypeInstanceContext instanceContext) {
            return new CamundaOutputParameterImpl(instanceContext);
        }
    });
    camundaNameAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_NAME).namespace(CAMUNDA_NS).required().build();
    typeBuilder.build();
}
Also used : CamundaOutputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 2 with CamundaOutputParameter

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

the class CamundaExtensionsTest method testCamundaNestedOutputParameter.

@Test
public void testCamundaNestedOutputParameter() {
    CamundaOutputParameter camundaOutputParameter = serviceTask.getExtensionElements().getElementsQuery().filterByType(CamundaInputOutput.class).singleResult().getCamundaOutputParameters().iterator().next();
    assertThat(camundaOutputParameter).isNotNull();
    assertThat(camundaOutputParameter.getCamundaName()).isEqualTo("nested");
    CamundaList list = camundaOutputParameter.getValue();
    assertThat(list).isNotNull();
    assertThat(list.getValues()).hasSize(2);
    Iterator<BpmnModelElementInstance> iterator = list.getValues().iterator();
    // nested list
    CamundaList nestedList = (CamundaList) iterator.next().getUniqueChildElementByType(CamundaList.class);
    assertThat(nestedList).isNotNull();
    assertThat(nestedList.getValues()).hasSize(2);
    for (BpmnModelElementInstance value : nestedList.getValues()) {
        assertThat(value.getTextContent()).isEqualTo("list");
    }
    // nested map
    CamundaMap nestedMap = (CamundaMap) iterator.next().getUniqueChildElementByType(CamundaMap.class);
    assertThat(nestedMap).isNotNull();
    assertThat(nestedMap.getCamundaEntries()).hasSize(2);
    Iterator<CamundaEntry> mapIterator = nestedMap.getCamundaEntries().iterator();
    // nested list in nested map
    CamundaEntry nestedListEntry = mapIterator.next();
    assertThat(nestedListEntry).isNotNull();
    assertThat(nestedListEntry.getCamundaKey()).isEqualTo("list");
    CamundaList nestedNestedList = nestedListEntry.getValue();
    for (BpmnModelElementInstance value : nestedNestedList.getValues()) {
        assertThat(value.getTextContent()).isEqualTo("map");
    }
    // nested map in nested map
    CamundaEntry nestedMapEntry = mapIterator.next();
    assertThat(nestedMapEntry).isNotNull();
    assertThat(nestedMapEntry.getCamundaKey()).isEqualTo("map");
    CamundaMap nestedNestedMap = nestedMapEntry.getValue();
    CamundaEntry entry = nestedNestedMap.getCamundaEntries().iterator().next();
    assertThat(entry.getCamundaKey()).isEqualTo("so");
    assertThat(entry.getTextContent()).isEqualTo("nested");
}
Also used : CamundaOutputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter) CamundaMap(org.camunda.bpm.model.bpmn.instance.camunda.CamundaMap) BpmnModelElementInstance(org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance) CamundaEntry(org.camunda.bpm.model.bpmn.instance.camunda.CamundaEntry) CamundaList(org.camunda.bpm.model.bpmn.instance.camunda.CamundaList) Test(org.junit.Test)

Example 3 with CamundaOutputParameter

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

the class CamundaExtensionsTest method testCamundaConnector.

@Test
public void testCamundaConnector() {
    CamundaConnector camundaConnector = serviceTask.getExtensionElements().getElementsQuery().filterByType(CamundaConnector.class).singleResult();
    assertThat(camundaConnector).isNotNull();
    CamundaConnectorId camundaConnectorId = camundaConnector.getCamundaConnectorId();
    assertThat(camundaConnectorId).isNotNull();
    assertThat(camundaConnectorId.getTextContent()).isEqualTo("soap-http-connector");
    CamundaInputOutput camundaInputOutput = camundaConnector.getCamundaInputOutput();
    Collection<CamundaInputParameter> inputParameters = camundaInputOutput.getCamundaInputParameters();
    assertThat(inputParameters).hasSize(1);
    CamundaInputParameter inputParameter = inputParameters.iterator().next();
    assertThat(inputParameter.getCamundaName()).isEqualTo("endpointUrl");
    assertThat(inputParameter.getTextContent()).isEqualTo("http://example.com/webservice");
    Collection<CamundaOutputParameter> outputParameters = camundaInputOutput.getCamundaOutputParameters();
    assertThat(outputParameters).hasSize(1);
    CamundaOutputParameter outputParameter = outputParameters.iterator().next();
    assertThat(outputParameter.getCamundaName()).isEqualTo("result");
    assertThat(outputParameter.getTextContent()).isEqualTo("output");
}
Also used : CamundaOutputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter) CamundaConnector(org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnector) CamundaConnectorId(org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnectorId) CamundaInputOutput(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputOutput) CamundaInputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter) Test(org.junit.Test)

Example 4 with CamundaOutputParameter

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

the class ProcessBuilderTest method assertCamundaInputOutputParameter.

protected void assertCamundaInputOutputParameter(BaseElement element) {
    CamundaInputOutput camundaInputOutput = element.getExtensionElements().getElementsQuery().filterByType(CamundaInputOutput.class).singleResult();
    assertThat(camundaInputOutput).isNotNull();
    List<CamundaInputParameter> camundaInputParameters = new ArrayList<CamundaInputParameter>(camundaInputOutput.getCamundaInputParameters());
    assertThat(camundaInputParameters).hasSize(2);
    CamundaInputParameter camundaInputParameter = camundaInputParameters.get(0);
    assertThat(camundaInputParameter.getCamundaName()).isEqualTo("foo");
    assertThat(camundaInputParameter.getTextContent()).isEqualTo("bar");
    camundaInputParameter = camundaInputParameters.get(1);
    assertThat(camundaInputParameter.getCamundaName()).isEqualTo("yoo");
    assertThat(camundaInputParameter.getTextContent()).isEqualTo("hoo");
    List<CamundaOutputParameter> camundaOutputParameters = new ArrayList<CamundaOutputParameter>(camundaInputOutput.getCamundaOutputParameters());
    assertThat(camundaOutputParameters).hasSize(2);
    CamundaOutputParameter camundaOutputParameter = camundaOutputParameters.get(0);
    assertThat(camundaOutputParameter.getCamundaName()).isEqualTo("one");
    assertThat(camundaOutputParameter.getTextContent()).isEqualTo("two");
    camundaOutputParameter = camundaOutputParameters.get(1);
    assertThat(camundaOutputParameter.getCamundaName()).isEqualTo("three");
    assertThat(camundaOutputParameter.getTextContent()).isEqualTo("four");
}
Also used : CamundaOutputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter) CamundaInputOutput(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputOutput) ArrayList(java.util.ArrayList) CamundaInputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter)

Example 5 with CamundaOutputParameter

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

the class AbstractActivityBuilder method camundaOutputParameter.

/**
 * Creates a new camunda output parameter extension element with the
 * given name and value.
 *
 * @param name the name of the output parameter
 * @param value the value of the output parameter
 * @return the builder object
 */
public B camundaOutputParameter(String name, String value) {
    CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
    CamundaOutputParameter camundaOutputParameter = createChild(camundaInputOutput, CamundaOutputParameter.class);
    camundaOutputParameter.setCamundaName(name);
    camundaOutputParameter.setTextContent(value);
    return myself;
}
Also used : CamundaOutputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter) CamundaInputOutput(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputOutput)

Aggregations

CamundaOutputParameter (org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter)6 CamundaInputOutput (org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputOutput)4 CamundaInputParameter (org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 BpmnModelElementInstance (org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance)1 CamundaConnector (org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnector)1 CamundaConnectorId (org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnectorId)1 CamundaEntry (org.camunda.bpm.model.bpmn.instance.camunda.CamundaEntry)1 CamundaList (org.camunda.bpm.model.bpmn.instance.camunda.CamundaList)1 CamundaMap (org.camunda.bpm.model.bpmn.instance.camunda.CamundaMap)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1