Search in sources :

Example 16 with Property

use of io.atlasmap.v2.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 17 with Property

use of io.atlasmap.v2.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)

Example 18 with Property

use of io.atlasmap.v2.Property in project kie-wb-common by kiegroup.

the class MultipleInstanceActivityPropertyWriterTest method setUp.

@Before
public void setUp() {
    activity = Factories.bpmn2.createUserTask();
    activity.setId(ACTIVITY_ID);
    variableScope = mock(VariableScope.class);
    VariableScope.Variable variable = mock(VariableScope.Variable.class);
    when(variableScope.lookup(PROPERTY_ID)).thenReturn(Optional.of(variable));
    Property property = mockProperty(PROPERTY_ID, ITEM_ID);
    when(variable.getTypedIdentifier()).thenReturn(property);
    writer = new MultipleInstanceActivityPropertyWriter(activity, variableScope, new HashSet<>());
}
Also used : Property(org.eclipse.bpmn2.Property) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 19 with Property

use of io.atlasmap.v2.Property in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testMarshallProcessVariables.

@Test
public void testMarshallProcessVariables() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSVARIABLES);
    String result = tested.marshall(diagram);
    assertDiagram(result, 1, 7, 7);
    Definitions definitions = new DefinitionsConverter(diagram.getGraph()).toDefinitions();
    assertNotNull(definitions);
    List<RootElement> rootElements = definitions.getRootElements();
    assertNotNull(rootElements);
    assertItemExists(rootElements, "_employeeItem", "java.lang.String");
    assertItemExists(rootElements, "_reasonItem", "java.lang.String");
    assertItemExists(rootElements, "_performanceItem", "java.lang.String");
    Process process = getProcess(definitions);
    assertNotNull(process);
    List<Property> properties = process.getProperties();
    assertNotNull(properties);
    assertNotNull(getProcessProperty(properties, "employee", "_employeeItem"));
    assertNotNull(getProcessProperty(properties, "reason", "_reasonItem"));
    assertNotNull(getProcessProperty(properties, "performance", "_performanceItem"));
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) RootElement(org.eclipse.bpmn2.RootElement) Definitions(org.eclipse.bpmn2.Definitions) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Process(org.eclipse.bpmn2.Process) DefinitionsConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter) Property(org.eclipse.bpmn2.Property) Test(org.junit.Test)

Example 20 with Property

use of io.atlasmap.v2.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)

Aggregations

Property (org.eclipse.bpmn2.Property)21 Property (io.atlasmap.v2.Property)7 AtlasMapping (io.atlasmap.v2.AtlasMapping)6 ArrayList (java.util.ArrayList)6 Process (org.eclipse.bpmn2.Process)6 Test (org.junit.Test)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 Properties (io.atlasmap.v2.Properties)4 DataInput (org.eclipse.bpmn2.DataInput)4 DeclarationList (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList)4 PropertyField (io.atlasmap.v2.PropertyField)3 List (java.util.List)3 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)3 DataOutput (org.eclipse.bpmn2.DataOutput)3 FlowElement (org.eclipse.bpmn2.FlowElement)3 SubProcess (org.eclipse.bpmn2.SubProcess)3 AtlasConversionException (io.atlasmap.api.AtlasConversionException)2