Search in sources :

Example 11 with DataInput

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

the class CustomInput method readInputFrom.

private DataInput readInputFrom(String targetName, ItemDefinition typeDef) {
    DataInput dataInput = bpmn2.createDataInput();
    dataInput.setName(targetName);
    // the id is an encoding of the node id + the name of the input
    dataInput.setId(Ids.dataInput(element.getId(), targetName));
    dataInput.setItemSubjectRef(typeDef);
    CustomAttribute.dtype.of(dataInput).set(typeDef.getStructureRef());
    return dataInput;
}
Also used : DataInput(org.eclipse.bpmn2.DataInput)

Example 12 with DataInput

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

the class ActivityPropertyReaderTest method testGetAssignmentsInfoWithNoAssignments.

@Test
public void testGetAssignmentsInfoWithNoAssignments() {
    List<DataInput> dataInputs = new ArrayList<>();
    List<DataInputAssociation> dataInputAssociations = new ArrayList<>();
    List<DataOutput> dataOutputs = new ArrayList<>();
    List<DataOutputAssociation> dataOutputAssociations = new ArrayList<>();
    InputOutputSpecification ioSpec = mock(InputOutputSpecification.class);
    when(ioSpec.getDataInputs()).thenReturn(dataInputs);
    when(ioSpec.getDataOutputs()).thenReturn(dataOutputs);
    when(activity.getIoSpecification()).thenReturn(ioSpec);
    when(activity.getDataInputAssociations()).thenReturn(dataInputAssociations);
    when(activity.getDataOutputAssociations()).thenReturn(dataOutputAssociations);
    AssignmentsInfo result = reader.getAssignmentsInfo();
    assertEquals("||||", result.getValue());
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) DataOutput(org.eclipse.bpmn2.DataOutput) InputOutputSpecification(org.eclipse.bpmn2.InputOutputSpecification) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) ArrayList(java.util.ArrayList) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Test(org.junit.Test)

Example 13 with DataInput

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

the class ActivityPropertyReaderTest method testGetAssignmentsInfo.

@Test
public void testGetAssignmentsInfo() {
    List<DataInput> dataInputs = new ArrayList<>();
    DataInput dataInput1 = mockDataInput("INPUT_ID_1", "INPUT_NAME_1", mockEntry("dtype", "Integer"));
    DataInput dataInput2 = mockDataInput("INPUT_ID_2", "INPUT_NAME_2", mockEntry("dtype", "String"));
    dataInputs.add(dataInput1);
    dataInputs.add(dataInput2);
    InputOutputSpecification ioSpec = mock(InputOutputSpecification.class);
    List<DataInputAssociation> dataInputAssociations = new ArrayList<>();
    DataInputAssociation inputAssociation = mockDataInputAssociation(dataInput1, "VARIABLE1");
    DataInputAssociation inputAssociation2 = mockDataInputAssociation(dataInput2, "VARIABLE2");
    dataInputAssociations.add(inputAssociation);
    dataInputAssociations.add(inputAssociation2);
    List<DataOutput> dataOutputs = new ArrayList<>();
    DataOutput dataOutput1 = mockDataOutput("OUTPUT_ID_1", "OUTPUT_NAME_1", mockEntry("dtype", "Boolean"));
    DataOutput dataOutput2 = mockDataOutput("OUTPUT_ID_2", "OUTPUT_NAME_2", mockEntry("dtype", "Float"));
    dataOutputs.add(dataOutput1);
    dataOutputs.add(dataOutput2);
    List<DataOutputAssociation> dataOutputAssociations = new ArrayList<>();
    DataOutputAssociation outputAssociation1 = mockDataOutputAssociation(dataOutput1, "VARIABLE3");
    DataOutputAssociation outputAssociation2 = mockDataOutputAssociation(dataOutput2, "VARIABLE4");
    dataOutputAssociations.add(outputAssociation1);
    dataOutputAssociations.add(outputAssociation2);
    when(ioSpec.getDataInputs()).thenReturn(dataInputs);
    when(ioSpec.getDataOutputs()).thenReturn(dataOutputs);
    when(activity.getIoSpecification()).thenReturn(ioSpec);
    when(activity.getDataInputAssociations()).thenReturn(dataInputAssociations);
    when(activity.getDataOutputAssociations()).thenReturn(dataOutputAssociations);
    AssignmentsInfo result = reader.getAssignmentsInfo();
    String expectedResult = "|INPUT_NAME_1:Integer,INPUT_NAME_2:String||OUTPUT_NAME_1:Boolean,OUTPUT_NAME_2:Float|[din]VARIABLE1->INPUT_NAME_1,[din]VARIABLE2->INPUT_NAME_2,[dout]OUTPUT_NAME_1->VARIABLE3,[dout]OUTPUT_NAME_2->VARIABLE4";
    assertEquals(expectedResult, result.getValue());
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) DataOutput(org.eclipse.bpmn2.DataOutput) InputOutputSpecification(org.eclipse.bpmn2.InputOutputSpecification) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) ArrayList(java.util.ArrayList) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Test(org.junit.Test)

Example 14 with DataInput

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

the class MultipleInstanceActivityPropertyReaderTest method testGetDataInput.

@Test
public void testGetDataInput() {
    DataInput item = mockDataInput(ITEM_ID, PROPERTY_ID);
    when(miloop.getInputDataItem()).thenReturn(item);
    assertEquals(PROPERTY_ID + DELIMITER + DATA_TYPE, reader.getDataInput());
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) ActivityPropertyReaderTest.mockDataInput(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ActivityPropertyReaderTest.mockDataInput) Test(org.junit.Test)

Example 15 with DataInput

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

the class MultipleInstanceActivityPropertyReader method getDataInputIdForDataInputVariable.

protected String getDataInputIdForDataInputVariable() {
    String dataInputVariableId = null;
    DataInput variableDataInput = getMultiInstanceLoopCharacteristics().map(MultiInstanceLoopCharacteristics::getInputDataItem).orElse(null);
    if (variableDataInput != null) {
        String itemSubjectRef = getItemSubjectRef(variableDataInput);
        String variableId = ItemNameReader.from(variableDataInput).getName();
        dataInputVariableId = super.getDataInputs().stream().filter(input -> Objects.equals(variableId, input.getName())).filter(input -> hasItemSubjectRef(input, itemSubjectRef)).map(BaseElement::getId).findFirst().orElse(null);
    }
    return dataInputVariableId;
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) BaseElement(org.eclipse.bpmn2.BaseElement) FormalExpression(org.eclipse.bpmn2.FormalExpression) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Activity(org.eclipse.bpmn2.Activity) DefinitionResolver(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) List(java.util.List) DataInput(org.eclipse.bpmn2.DataInput) MultiInstanceLoopCharacteristics(org.eclipse.bpmn2.MultiInstanceLoopCharacteristics) DataOutput(org.eclipse.bpmn2.DataOutput) Optional(java.util.Optional) DataAssociation(org.eclipse.bpmn2.DataAssociation) StringUtils(org.kie.workbench.common.stunner.core.util.StringUtils)

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