Search in sources :

Example 11 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project kie-wb-common by kiegroup.

the class MultipleInstanceActivityPropertyWriter method setCollectionInput.

public void setCollectionInput(String collectionInput) {
    if (isEmpty(collectionInput)) {
        return;
    }
    setUpLoopCharacteristics();
    String suffix = "IN_COLLECTION";
    String id = Ids.dataInput(activity.getId(), suffix);
    DataInput dataInputElement = createDataInput(id, suffix);
    ioSpec.getDataInputs().add(dataInputElement);
    // check whether this exist
    Optional<Property> property = findPropertyById(collectionInput);
    Optional<DataObject> dataObject = findDataObjectById(collectionInput);
    if (property.isPresent()) {
        processDataInput(dataInputElement, property.get());
    } else if (dataObject.isPresent()) {
        processDataInput(dataInputElement, dataObject.get());
    }
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) DataObject(org.eclipse.bpmn2.DataObject) Property(org.eclipse.bpmn2.Property)

Example 12 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project kie-wb-common by kiegroup.

the class ProcessPropertyWriter method setProcessVariables.

public void setProcessVariables(BaseProcessVariables processVariables) {
    String value = processVariables.getValue();
    DeclarationList declarationList = DeclarationList.fromString(value);
    List<Property> properties = process.getProperties();
    declarationList.getDeclarations().forEach(decl -> {
        VariableScope.Variable variable = variableScope.declare(this.process.getId(), decl.getIdentifier(), decl.getType(), decl.getTags());
        if (!decl.getTags().isEmpty()) {
            CustomElement.customTags.of(variable.getTypedIdentifier()).set(decl.getTags());
        }
        properties.add(variable.getTypedIdentifier());
        this.itemDefinitions.add(variable.getTypeDeclaration());
    });
}
Also used : DeclarationList(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList) Property(org.eclipse.bpmn2.Property)

Example 13 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project kie-wb-common by kiegroup.

the class ActivityPropertyReaderTest method mockProperty.

public static Property mockProperty(String id) {
    Property property = mock(Property.class);
    when(property.getId()).thenReturn(id);
    return property;
}
Also used : Property(org.eclipse.bpmn2.Property)

Example 14 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project kie-wb-common by kiegroup.

the class OutputAssignmentReaderTest method testFromAssociationWithPropertyName.

@Test
public void testFromAssociationWithPropertyName() {
    Property property = mockProperty(TARGET_ID, TARGET_NAME);
    DataOutputAssociation outputAssociation = mockDataOutputAssociation(SOURCE_NAME, property);
    OutputAssignmentReader outputReader = OutputAssignmentReader.fromAssociation(outputAssociation);
    assertNotNull(outputReader);
    assertResult(SOURCE_NAME, TARGET_NAME, AssociationDeclaration.Type.SourceTarget, outputReader.getAssociationDeclaration());
}
Also used : DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) Property(org.eclipse.bpmn2.Property) Test(org.junit.Test)

Example 15 with Property

use of org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property in project kie-wb-common by kiegroup.

the class SubProcessConverterTest method assertVariables.

private static void assertVariables(List<Pair<String, String>> expectedVariables, List<Property> properties) {
    assertEquals(expectedVariables.size(), properties.size());
    Pair<String, String> expectedVariable;
    Property property;
    for (int i = 0; i < expectedVariables.size(); i++) {
        expectedVariable = expectedVariables.get(i);
        property = properties.get(i);
        assertEquals(expectedVariable.getK1(), property.getId());
        assertEquals(expectedVariable.getK1(), property.getName());
        assertEquals(String.format("_%sItem", expectedVariable.getK1()), property.getItemSubjectRef().getId());
        assertEquals(expectedVariable.getK2(), property.getItemSubjectRef().getStructureRef());
    }
}
Also used : Property(org.eclipse.bpmn2.Property)

Aggregations

Property (org.eclipse.bpmn2.Property)21 Test (org.junit.Test)8 Property (io.atlasmap.v2.Property)7 ArrayList (java.util.ArrayList)7 Node (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Node)7 Process (org.eclipse.bpmn2.Process)6 Property (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.Property)6 DataObject (org.eclipse.bpmn2.DataObject)5 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)5 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)5 RootElement (org.eclipse.bpmn2.RootElement)5 NodeAttributes (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.NodeAttributes)5 PropertyAttributes (org.eclipse.smarthome.binding.mqtt.generic.internal.convention.homie300.PropertyAttributes)5 Properties (io.atlasmap.v2.Properties)4 List (java.util.List)4 DataInput (org.eclipse.bpmn2.DataInput)4 DeclarationList (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList)4 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)3 DataOutput (org.eclipse.bpmn2.DataOutput)3 FlowElement (org.eclipse.bpmn2.FlowElement)3