use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class ListGroupItemPresenter method onToggleRowExpansion.
@Override
public void onToggleRowExpansion(ListGroupItemView listGroupItemView, boolean currentlyShown) {
if (disabled.get()) {
return;
}
if (currentlyShown) {
listGroupItemView.closeRow();
} else {
if (listGroupItemView.isToExpand()) {
FactModelTree factModelTree = testToolsPresenter.getFactModelTreeFromFactTypeMap(listGroupItemView.getFactType()).orElseGet(() -> testToolsPresenter.getFactModelTreeFromHiddenMap(listGroupItemView.getFactType()));
if (factModelTree != null) {
populateListGroupItemView(listGroupItemView, listGroupItemView.getParentPath(), listGroupItemView.getFactName(), factModelTree);
listGroupItemView.setToExpand(false);
}
}
listGroupItemView.expandRow();
}
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class DMNTypeServiceImplTest method createTopLevelFactModelTreeSimpleCollection.
@Test
public void createTopLevelFactModelTreeSimpleCollection() throws WrongDMNTypeException {
// Single property collection retrieve
DMNType simpleCollectionString = getSimpleCollection();
TreeMap<String, FactModelTree> hiddenFactSimpleCollection = new TreeMap<>();
FactModelTree retrieved = dmnTypeServiceImpl.createTopLevelFactModelTree("testPath", IMPORTED_PREFIX, simpleCollectionString, hiddenFactSimpleCollection, FactModelTree.Type.INPUT);
assertNotNull(retrieved);
assertEquals("testPath", retrieved.getFactName());
assertEquals(1, retrieved.getSimpleProperties().size());
assertTrue(retrieved.getSimpleProperties().containsKey(VALUE));
assertEquals("java.util.List", retrieved.getSimpleProperties().get(VALUE).getTypeName());
assertFalse(retrieved.getSimpleProperties().get(VALUE).getBaseTypeName().isPresent());
assertEquals("java.util.List", retrieved.getSimpleProperties().get(VALUE).getPropertyTypeNameToVisualize());
assertTrue(retrieved.getExpandableProperties().isEmpty());
assertEquals(1, retrieved.getGenericTypesMap().size());
assertTrue(retrieved.getGenericTypesMap().containsKey(VALUE));
assertNotNull(retrieved.getGenericTypesMap().get(VALUE));
assertEquals(1, retrieved.getGenericTypesMap().get(VALUE).size());
assertEquals(simpleCollectionString.getName(), retrieved.getGenericTypesMap().get(VALUE).get(0));
assertEquals(IMPORTED_PREFIX, retrieved.getImportPrefix());
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class DMNTypeServiceImplTest method createTopLevelFactModelTreeSimpleNoCollection.
@Test
public void createTopLevelFactModelTreeSimpleNoCollection() throws WrongDMNTypeException {
// Single property retrieve
DMNType simpleString = getSimpleNoCollection();
FactModelTree retrieved = dmnTypeServiceImpl.createTopLevelFactModelTree("testPath", IMPORTED_PREFIX, simpleString, new TreeMap<>(), FactModelTree.Type.INPUT);
assertNotNull(retrieved);
assertEquals("testPath", retrieved.getFactName());
assertEquals(1, retrieved.getSimpleProperties().size());
assertTrue(retrieved.getSimpleProperties().containsKey(VALUE));
assertEquals(simpleString.getName(), retrieved.getSimpleProperties().get(VALUE).getTypeName());
assertFalse(retrieved.getSimpleProperties().get(VALUE).getBaseTypeName().isPresent());
assertEquals(simpleString.getName(), retrieved.getSimpleProperties().get(VALUE).getPropertyTypeNameToVisualize());
assertTrue(retrieved.getExpandableProperties().isEmpty());
assertTrue(retrieved.getGenericTypesMap().isEmpty());
assertEquals(IMPORTED_PREFIX, retrieved.getImportPrefix());
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class DMNTypeServiceImplTest method createTopLevelFactModelTreeRecursiveTypes.
@Test
public void createTopLevelFactModelTreeRecursiveTypes() throws WrongDMNTypeException {
SortedMap<String, FactModelTree> hiddenFacts = new TreeMap<>();
FactModelTree person = dmnTypeServiceImpl.createTopLevelFactModelTree("person", IMPORTED_PREFIX, getRecursivePersonComposite(false), hiddenFacts, FactModelTree.Type.DECISION);
assertNotNull(person);
assertTrue(person.getExpandableProperties().containsKey("parent"));
assertEquals("tPerson", person.getExpandableProperties().get("parent"));
assertTrue(hiddenFacts.containsKey("tPerson"));
assertEquals(IMPORTED_PREFIX, person.getImportPrefix());
hiddenFacts = new TreeMap<>();
FactModelTree personCollection = dmnTypeServiceImpl.createTopLevelFactModelTree("person", IMPORTED_PREFIX, getRecursivePersonComposite(true), hiddenFacts, FactModelTree.Type.DECISION);
assertNotNull(personCollection);
assertTrue(personCollection.getGenericTypesMap().containsKey(VALUE));
assertEquals("tPerson", personCollection.getGenericTypeInfo(VALUE).get(0));
assertTrue(hiddenFacts.containsKey("tPerson"));
assertTrue(hiddenFacts.containsKey("tPersonList"));
assertEquals(IMPORTED_PREFIX, personCollection.getImportPrefix());
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class DMNTypeServiceImplTest method createTopLevelFactModelTreeCompositeNoCollection.
@Test
public void createTopLevelFactModelTreeCompositeNoCollection() throws WrongDMNTypeException {
// Single property retrieve
DMNType compositePerson = getSingleCompositeWithSimpleCollection();
FactModelTree retrieved = dmnTypeServiceImpl.createTopLevelFactModelTree("testPath", IMPORTED_PREFIX, compositePerson, new TreeMap<>(), FactModelTree.Type.INPUT);
assertNotNull(retrieved);
assertEquals("testPath", retrieved.getFactName());
assertEquals(2, retrieved.getSimpleProperties().size());
assertTrue(retrieved.getSimpleProperties().containsKey("friends"));
assertEquals("java.util.List", retrieved.getSimpleProperties().get("friends").getTypeName());
assertFalse(retrieved.getSimpleProperties().get("friends").getBaseTypeName().isPresent());
assertEquals("java.util.List", retrieved.getSimpleProperties().get("friends").getPropertyTypeNameToVisualize());
assertTrue(retrieved.getSimpleProperties().containsKey("name"));
assertEquals(SIMPLE_TYPE_NAME, retrieved.getSimpleProperties().get("name").getTypeName());
assertFalse(retrieved.getSimpleProperties().get("name").getBaseTypeName().isPresent());
assertEquals(SIMPLE_TYPE_NAME, retrieved.getSimpleProperties().get("name").getPropertyTypeNameToVisualize());
//
assertEquals(1, retrieved.getGenericTypesMap().size());
assertTrue(retrieved.getGenericTypesMap().containsKey("friends"));
assertEquals(compositePerson.getFields().get("friends").getName(), retrieved.getGenericTypesMap().get("friends").get(0));
//
assertEquals(2, retrieved.getExpandableProperties().size());
assertTrue(retrieved.getExpandableProperties().containsKey(EXPANDABLE_PROPERTY_PHONENUMBERS));
assertEquals("tPhoneNumber", retrieved.getExpandableProperties().get(EXPANDABLE_PROPERTY_PHONENUMBERS));
assertTrue(retrieved.getExpandableProperties().containsKey(EXPANDABLE_PROPERTY_DETAILS));
assertEquals("tDetails", retrieved.getExpandableProperties().get(EXPANDABLE_PROPERTY_DETAILS));
assertEquals(IMPORTED_PREFIX, retrieved.getImportPrefix());
}
Aggregations