Search in sources :

Example 26 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class ActivityPropertyReaderTest method mockDataInput.

public static DataInput mockDataInput(String id, String name, FeatureMap.Entry... entries) {
    ItemDefinition itemDefinition = mock(ItemDefinition.class);
    when(itemDefinition.getStructureRef()).thenReturn("java.lang.Object");
    DataInput dataInput = mock(DataInput.class);
    when(dataInput.getItemSubjectRef()).thenReturn(itemDefinition);
    when(dataInput.getId()).thenReturn(id);
    when(dataInput.getName()).thenReturn(name);
    List<FeatureMap.Entry> entriesList = new ArrayList<>();
    if (entries != null) {
        entriesList.addAll(Arrays.asList(entries));
    }
    FeatureMap featureMap = mock(FeatureMap.class);
    when(featureMap.stream()).thenReturn(entriesList.stream());
    when(dataInput.getAnyAttribute()).thenReturn(featureMap);
    return dataInput;
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) ArrayList(java.util.ArrayList)

Example 27 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class AssignmentsInfosTest method JBPM_7447_shouldNotFilterOutDataOutputsWithEmptyType.

@Test
public void JBPM_7447_shouldNotFilterOutDataOutputsWithEmptyType() {
    DataInput dataInput = bpmn2.createDataInput();
    dataInput.setName("InputName");
    dataInput.setId("InputID");
    DataOutput dataOutput = bpmn2.createDataOutput();
    dataOutput.setName("OutputName");
    dataOutput.setId("OutputID");
    ParsedAssignmentsInfo result = AssignmentsInfos.parsed(Collections.singletonList(dataInput), Collections.emptyList(), Collections.singletonList(dataOutput), Collections.emptyList(), false);
    assertThat(result.getOutputs().getDeclarations()).isNotEmpty();
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) DataOutput(org.eclipse.bpmn2.DataOutput) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) Test(org.junit.Test)

Example 28 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class ActivityPropertyWriter method setAssignmentsInfo.

public void setAssignmentsInfo(AssignmentsInfo info) {
    final ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info);
    final List<InitializedInputVariable> inputs = assignmentsInfo.createInitializedInputVariables(getId(), variableScope, dataObjects);
    if (!inputs.isEmpty()) {
        final InputOutputSpecification ioSpec = getIoSpecification();
        for (InitializedInputVariable input : inputs) {
            if (isReservedIdentifier(input.getIdentifier())) {
                continue;
            }
            DataInput dataInput = input.getDataInput();
            getInputSet(ioSpec).getDataInputRefs().add(dataInput);
            ioSpec.getDataInputs().add(dataInput);
            this.addItemDefinition(input.getItemDefinition());
            DataInputAssociation dataInputAssociation = input.getDataInputAssociation();
            if (dataInputAssociation != null) {
                activity.getDataInputAssociations().add(dataInputAssociation);
            }
        }
    }
    final List<InitializedOutputVariable> outputs = assignmentsInfo.createInitializedOutputVariables(getId(), variableScope, dataObjects);
    if (!outputs.isEmpty()) {
        final InputOutputSpecification ioSpec = getIoSpecification();
        for (InitializedOutputVariable output : outputs) {
            DataOutput dataOutput = output.getDataOutput();
            getOutputSet(ioSpec).getDataOutputRefs().add(dataOutput);
            ioSpec.getDataOutputs().add(dataOutput);
            this.addItemDefinition(output.getItemDefinition());
            DataOutputAssociation dataOutputAssociation = output.getDataOutputAssociation();
            if (dataOutputAssociation != null) {
                activity.getDataOutputAssociations().add(dataOutputAssociation);
            }
        }
    }
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) InitializedOutputVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedOutputVariable) DataOutput(org.eclipse.bpmn2.DataOutput) InputOutputSpecification(org.eclipse.bpmn2.InputOutputSpecification) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) InitializedInputVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedInputVariable) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Example 29 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class ThrowEventPropertyWriter method setAssignmentsInfo.

@Override
public void setAssignmentsInfo(AssignmentsInfo info) {
    ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info);
    List<InitializedInputVariable> inputs = assignmentsInfo.createInitializedInputVariables(getId(), variableScope, dataObjects);
    if (inputs.isEmpty()) {
        return;
    }
    if (inputs.size() > 1) {
        throw new IllegalArgumentException("Input Associations should be at most 1 in Throw Events");
    }
    InitializedInputVariable input = inputs.get(0);
    if (isReservedIdentifier(input.getIdentifier())) {
        return;
    }
    DataInput dataInput = input.getDataInput();
    throwEvent.getDataInputs().add(dataInput);
    getInputSet().getDataInputRefs().add(dataInput);
    this.addItemDefinition(input.getItemDefinition());
    DataInputAssociation dataInputAssociation = input.getDataInputAssociation();
    if (dataInputAssociation != null) {
        throwEvent.getDataInputAssociation().add(dataInputAssociation);
    }
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) InitializedInputVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedInputVariable) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Example 30 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class MultipleInstanceActivityPropertyWriter method setInput.

protected void setInput(String name, boolean addDataInputAssociation) {
    if (isEmpty(name)) {
        return;
    }
    String[] variable = name.split(":");
    String variableName = getVariableName(variable);
    String variableType = getVariableType(variable);
    setUpLoopCharacteristics();
    DataInput miDataInputElement = createDataInput(variableName, variableName);
    ItemDefinition item = createItemDefinition(variableName, variableType);
    addItemDefinition(item);
    miDataInputElement.setItemSubjectRef(item);
    miloop.setInputDataItem(miDataInputElement);
    String id = Ids.dataInput(activity.getId(), variableName);
    DataInput dataInputElement = createDataInput(id, variableName);
    dataInputElement.setItemSubjectRef(item);
    addSafe(ioSpec.getDataInputs(), dataInputElement);
    addSafe(inputSet.getDataInputRefs(), dataInputElement);
    if (addDataInputAssociation) {
        DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation();
        dia.getSourceRef().add(miDataInputElement);
        dia.setTargetRef(dataInputElement);
        addSafe(activity.getDataInputAssociations(), dia);
    }
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Aggregations

DataInput (org.eclipse.bpmn2.DataInput)38 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)21 DataInput (org.geotoolkit.wps.xml.v200.DataInput)19 DataOutput (org.eclipse.bpmn2.DataOutput)17 Data (org.geotoolkit.wps.xml.v200.Data)15 FormalExpression (org.eclipse.bpmn2.FormalExpression)14 Test (org.junit.Test)14 ArrayList (java.util.ArrayList)13 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)12 Assignment (org.eclipse.bpmn2.Assignment)11 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)11 List (java.util.List)10 ReferenceProxy (org.geotoolkit.wps.xml.ReferenceProxy)10 Format (org.geotoolkit.wps.xml.v200.Format)10 UnconvertibleObjectException (org.apache.sis.util.UnconvertibleObjectException)9 InputSet (org.eclipse.bpmn2.InputSet)9 InputOutputSpecification (org.eclipse.bpmn2.InputOutputSpecification)8 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)8 ComplexData (org.geotoolkit.wps.xml.v200.ComplexData)8 IOException (java.io.IOException)6