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();
}
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");
}
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");
}
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");
}
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;
}
Aggregations