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