Search in sources :

Example 11 with ItemDefinition

use of org.eclipse.bpmn2.ItemDefinition in project drools by kiegroup.

the class ItemDefinitionDependenciesGeneratedTest method getBaseListOfItemDefinitions.

private static List<ItemDefinition> getBaseListOfItemDefinitions(final int nameIndexFrom) {
    final List<ItemDefinition> itemDefinitions = new ArrayList<>();
    for (int i = nameIndexFrom; i < NUMBER_OF_BASE_ITEM_DEFINITIONS + nameIndexFrom; i++) {
        final ItemDefinition it = new ItemDefinition();
        it.setName(ITEM_DEFINITION_NAME_BASE + i);
        itemDefinitions.add(it);
    }
    return itemDefinitions;
}
Also used : ItemDefinition(org.kie.dmn.model.v1_1.ItemDefinition) ArrayList(java.util.ArrayList)

Example 12 with ItemDefinition

use of org.eclipse.bpmn2.ItemDefinition in project drools by kiegroup.

the class ItemDefinitionDependenciesTest method testGeneric2.

@Test
public void testGeneric2() {
    ItemDefinition z = build("z");
    ItemDefinition b = build("b");
    ItemDefinition a = build("a", z);
    List<ItemDefinition> originalList = Arrays.asList(new ItemDefinition[] { z, b, a });
    List<ItemDefinition> orderedList = orderingStrategy(originalList);
    assertTrue("Index of z < a", orderedList.indexOf(z) < orderedList.indexOf(a));
}
Also used : ItemDefinition(org.kie.dmn.model.v1_1.ItemDefinition) Test(org.junit.Test)

Example 13 with ItemDefinition

use of org.eclipse.bpmn2.ItemDefinition in project drools by kiegroup.

the class ItemDefinitionDependenciesTest method testOrdering4.

@Test
public void testOrdering4() {
    ItemDefinition _TypeDecisionA1 = build("TypeDecisionA1");
    ItemDefinition _TypeDecisionA2_x = build("TypeDecisionA2.x", _TypeDecisionA1);
    ItemDefinition _TypeDecisionA3 = build("TypeDecisionA3", _TypeDecisionA2_x);
    ItemDefinition _TypeDecisionB1 = build("TypeDecisionB1");
    ItemDefinition _TypeDecisionB2_x = build("TypeDecisionB2.x", _TypeDecisionB1);
    ItemDefinition _TypeDecisionB3 = build("TypeDecisionB3", _TypeDecisionB2_x, _TypeDecisionA3);
    ItemDefinition _TypeDecisionC1 = build("TypeDecisionC1", _TypeDecisionA3, _TypeDecisionB3);
    ItemDefinition _TypeDecisionC4 = build("TypeDecisionC4");
    List<ItemDefinition> originalList = Arrays.asList(new ItemDefinition[] { _TypeDecisionA1, _TypeDecisionA2_x, _TypeDecisionA3, _TypeDecisionB1, _TypeDecisionB2_x, _TypeDecisionB3, _TypeDecisionC1, _TypeDecisionC4 });
    List<ItemDefinition> orderedList = orderingStrategy(originalList);
    assertTrue("Index of _TypeDecisionA1 < _TypeDecisionA2_x", orderedList.indexOf(_TypeDecisionA1) < orderedList.indexOf(_TypeDecisionA2_x));
    assertTrue("Index of _TypeDecisionA2_x < _TypeDecisionA3", orderedList.indexOf(_TypeDecisionA2_x) < orderedList.indexOf(_TypeDecisionA3));
    assertTrue("Index of _TypeDecisionA3 < _TypeDecisionB3", orderedList.indexOf(_TypeDecisionA3) < orderedList.indexOf(_TypeDecisionB3));
    assertTrue("Index of _TypeDecisionA3 < _TypeDecisionC1", orderedList.indexOf(_TypeDecisionA3) < orderedList.indexOf(_TypeDecisionC1));
    assertTrue("Index of _TypeDecisionB1 < _TypeDecisionB2_x", orderedList.indexOf(_TypeDecisionB1) < orderedList.indexOf(_TypeDecisionB2_x));
    assertTrue("Index of _TypeDecisionB2_x < _TypeDecisionB3", orderedList.indexOf(_TypeDecisionB2_x) < orderedList.indexOf(_TypeDecisionB3));
    assertTrue("Index of _TypeDecisionB3 < _TypeDecisionC1", orderedList.indexOf(_TypeDecisionB3) < orderedList.indexOf(_TypeDecisionC1));
}
Also used : ItemDefinition(org.kie.dmn.model.v1_1.ItemDefinition) Test(org.junit.Test)

Example 14 with ItemDefinition

use of org.eclipse.bpmn2.ItemDefinition in project drools by kiegroup.

the class ItemDefinitionDependenciesTest method testGeneric.

@Test
public void testGeneric() {
    ItemDefinition a = build("a");
    ItemDefinition b = build("b");
    ItemDefinition c = build("c", a, b);
    ItemDefinition d = build("d", c);
    List<ItemDefinition> originalList = Arrays.asList(new ItemDefinition[] { d, c, b, a });
    List<ItemDefinition> orderedList = orderingStrategy(originalList);
    assertThat(orderedList.subList(0, 2), containsInAnyOrder(a, b));
    assertThat(orderedList.subList(2, 4), contains(c, d));
}
Also used : ItemDefinition(org.kie.dmn.model.v1_1.ItemDefinition) Test(org.junit.Test)

Example 15 with ItemDefinition

use of org.eclipse.bpmn2.ItemDefinition in project kie-wb-common by kiegroup.

the class DefinitionsConverter method wbFromDMN.

public static Definitions wbFromDMN(final org.kie.dmn.model.v1_1.Definitions dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Name name = new Name(dmn.getName());
    String namespace = dmn.getNamespace();
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Definitions result = new Definitions();
    result.setId(id);
    result.setName(name);
    result.setNamespace(namespace);
    result.setDescription(description);
    result.getNsContext().putAll(dmn.getNsContext());
    for (org.kie.dmn.model.v1_1.ItemDefinition itemDef : dmn.getItemDefinition()) {
        ItemDefinition itemDefConvered = ItemDefinitionPropertyConverter.wbFromDMN(itemDef);
        result.getItemDefinition().add(itemDefConvered);
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Definitions(org.kie.workbench.common.dmn.api.definition.v1_1.Definitions) ItemDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

ItemDefinition (org.kie.dmn.model.v1_1.ItemDefinition)22 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)21 ArrayList (java.util.ArrayList)17 RootElement (org.eclipse.bpmn2.RootElement)17 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)13 Process (org.eclipse.bpmn2.Process)13 SubProcess (org.eclipse.bpmn2.SubProcess)13 Entry (java.util.Map.Entry)11 FlowElement (org.eclipse.bpmn2.FlowElement)11 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)11 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)11 Message (org.eclipse.bpmn2.Message)10 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)9 Test (org.junit.Test)9 List (java.util.List)8 CallActivity (org.eclipse.bpmn2.CallActivity)7 DataInput (org.eclipse.bpmn2.DataInput)7 QName (javax.xml.namespace.QName)6 Activity (org.eclipse.bpmn2.Activity)6 DataOutput (org.eclipse.bpmn2.DataOutput)6