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