use of org.kie.dmn.model.api.DRGElement in project drools by kiegroup.
the class DefinitionsConverter method assignChildElement.
@Override
protected void assignChildElement(Object parent, String nodeName, Object child) {
Definitions def = (Definitions) parent;
if (IMPORT.equals(nodeName)) {
def.getImport().add((Import) child);
} else if (ITEM_DEFINITION.equals(nodeName)) {
def.getItemDefinition().add((ItemDefinition) child);
} else if (child instanceof DRGElement) {
def.getDrgElement().add((DRGElement) child);
} else if (child instanceof Artifact) {
def.getArtifact().add((Artifact) child);
} else if (ELEMENT_COLLECTION.equals(nodeName)) {
def.getElementCollection().add((ElementCollection) child);
} else if (child instanceof BusinessContextElement) {
def.getBusinessContextElement().add((BusinessContextElement) child);
} else if (child instanceof DMNDI) {
DMNDI dmndi = (DMNDI) child;
dmndi.normalize();
def.setDMNDI(dmndi);
} else {
super.assignChildElement(def, nodeName, child);
}
}
use of org.kie.dmn.model.api.DRGElement in project drools by kiegroup.
the class DMNModelIOSets method buildIODoc.
private void buildIODoc() {
for (DRGElement drge : model.getDefinitions().getDrgElement()) {
if (drge instanceof InputData) {
inputDoc.put(drge.getName(), drge.getDescription());
outputDoc.put(drge.getName(), drge.getDescription());
} else if (drge instanceof Decision) {
outputDoc.put(drge.getName(), drge.getDescription());
}
}
}
use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testRemoveDrgElementsWithoutShape.
@Test
public void testRemoveDrgElementsWithoutShape() {
final String id1 = "id1";
final String id2 = "id2";
final String id3 = "id3";
final DRGElement e1 = createDRGElement(id1);
final DRGElement e2 = createDRGElement(id2);
final DRGElement e3 = createDRGElement(id3);
final List<org.kie.dmn.model.api.DRGElement> drgElements = new ArrayList<>(Arrays.asList(e1, e2, e3));
final DMNShape s1 = createDMNShape(id1);
final DMNShape s3 = createDMNShape(id3);
final List<DMNShape> dmnShapes = new ArrayList<>(Arrays.asList(s1, s3));
getDMNMarshaller().removeDrgElementsWithoutShape(drgElements, dmnShapes);
assertEquals(2, drgElements.size());
assertEquals(e1, drgElements.get(0));
assertEquals(e3, drgElements.get(1));
}
use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testIsImportedDRGElementWithWbDRGElement.
@Test
public void testIsImportedDRGElementWithWbDRGElement() {
final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller());
final List<org.kie.dmn.model.api.DRGElement> importedDrgElements = new ArrayList<>();
final org.kie.dmn.model.api.DRGElement imported = mock(org.kie.dmn.model.api.DRGElement.class);
when(imported.getId()).thenReturn("id");
importedDrgElements.add(imported);
final org.kie.workbench.common.dmn.api.definition.model.DRGElement drgElement = mock(org.kie.workbench.common.dmn.api.definition.model.DRGElement.class);
final Id id = mock(Id.class);
when(id.getValue()).thenReturn("id");
when(drgElement.getId()).thenReturn(id);
final boolean actual = marshaller.isImportedDRGElement(importedDrgElements, drgElement);
assertTrue(actual);
}
use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testRemoveDrgElementsWithoutShapeWhenAllElementsHaveShape.
@Test
public void testRemoveDrgElementsWithoutShapeWhenAllElementsHaveShape() {
final String id1 = "id1";
final String id2 = "id2";
final String id3 = "id3";
final DRGElement e1 = createDRGElement(id1);
final DRGElement e2 = createDRGElement(id2);
final DRGElement e3 = createDRGElement(id3);
final List<org.kie.dmn.model.api.DRGElement> drgElements = new ArrayList<>(Arrays.asList(e1, e2, e3));
final DMNShape s1 = createDMNShape(id1);
final DMNShape s2 = createDMNShape(id2);
final DMNShape s3 = createDMNShape(id3);
final List<DMNShape> dmnShapes = new ArrayList<>(Arrays.asList(s1, s2, s3));
getDMNMarshaller().removeDrgElementsWithoutShape(drgElements, dmnShapes);
assertEquals(3, drgElements.size());
assertEquals(e1, drgElements.get(0));
assertEquals(e2, drgElements.get(1));
assertEquals(e3, drgElements.get(2));
}
Aggregations