use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class AbstractTestToolsTest method getSimpleJavaTypeFieldsMap.
protected SortedMap<String, FactModelTree> getSimpleJavaTypeFieldsMap() {
SortedMap<String, FactModelTree> toReturn = new TreeMap<>();
for (String key : DataManagementStrategy.SIMPLE_CLASSES_MAP.keySet()) {
Map<String, FactModelTree.PropertyTypeName> simpleProperties = new HashMap<>();
FactModelTree.PropertyTypeName fullName = new FactModelTree.PropertyTypeName(DataManagementStrategy.SIMPLE_CLASSES_MAP.get(key).getCanonicalName());
simpleProperties.put(LOWER_CASE_VALUE, fullName);
String packageName = fullName.getTypeName().substring(0, fullName.getTypeName().lastIndexOf("."));
FactModelTree value = new FactModelTree(key, packageName, simpleProperties, new HashMap<>());
toReturn.put(key, value);
}
return toReturn;
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class AbstractDMNDataManagementStrategyTest method isADataType.
@Test
public void isADataType() {
visibleFactsLocal.clear();
hiddenFactsLocal.clear();
commonIsADataType("TEST", false);
visibleFactsLocal.put("TEST", new FactModelTree());
commonIsADataType("TOAST", false);
commonIsADataType("TEST", true);
visibleFactsLocal.clear();
hiddenFactsLocal.put("TEST", new FactModelTree());
commonIsADataType("TOAST", false);
commonIsADataType("TEST", true);
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class AbstractDataManagementStrategyTest method getSimpleClassFactModelTree.
@Test
public void getSimpleClassFactModelTree() {
Class[] expectedClazzes = { String.class, Boolean.class, Integer.class, Double.class, Number.class };
for (Class expectedClazz : expectedClazzes) {
final FactModelTree retrieved = AbstractDataManagementStrategy.getSimpleClassFactModelTree(expectedClazz.getSimpleName(), expectedClazz.getCanonicalName());
assertNotNull(retrieved);
String key = expectedClazz.getSimpleName();
assertEquals(key, retrieved.getFactName());
String fullName = expectedClazz.getCanonicalName();
String packageName = fullName.substring(0, fullName.lastIndexOf("."));
assertEquals(packageName, retrieved.getFullPackage());
Map<String, FactModelTree.PropertyTypeName> simpleProperties = retrieved.getSimpleProperties();
assertNotNull(simpleProperties);
assertEquals(1, simpleProperties.size());
assertTrue(simpleProperties.containsKey(TestProperties.LOWER_CASE_VALUE));
FactModelTree.PropertyTypeName simplePropertyValue = simpleProperties.get(TestProperties.LOWER_CASE_VALUE);
assertNotNull(simplePropertyValue);
assertEquals(fullName, simplePropertyValue.getTypeName());
assertEquals(fullName, simplePropertyValue.getPropertyTypeNameToVisualize());
assertFalse(simplePropertyValue.getBaseTypeName().isPresent());
}
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class AbstractDataManagementStrategyTest method getSourceMap.
private SortedMap<String, FactModelTree> getSourceMap() {
SortedMap<String, FactModelTree> toReturn = new TreeMap<>();
FactModelTree toPut = new FactModelTree("Void", "package", new HashMap<>(), new HashMap<>());
toReturn.put("Void", toPut);
return toReturn;
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class TestToolsPresenter method onModifyColumn.
@Override
public void onModifyColumn() {
if (editingColumnEnabled) {
if (selectedListGroupItemView != null) {
String className = selectedListGroupItemView.getActualClassName();
getFactModelTreeFromMaps(className).ifPresent(factModelTree -> eventBus.fireEvent(new SetPropertyHeaderEvent(gridWidget, factModelTree.getFullPackage(), factModelTree.getTypeName(), Collections.unmodifiableList(Arrays.asList(className)), factModelTree.getFullTypeName(), FactMappingValueType.EXPRESSION, factModelTree.getImportPrefix())));
} else if (selectedFieldItemView != null) {
String baseClass = selectedFieldItemView.getFullPath().get(0);
List<String> propertyNameElements = new ArrayList<>(selectedFieldItemView.getFullPath());
if (!isSimple(baseClass)) {
propertyNameElements.add(selectedFieldItemView.getFieldName());
}
getFactModelTreeFromMaps(baseClass).ifPresent(factModelTree -> eventBus.fireEvent(new SetPropertyHeaderEvent(gridWidget, factModelTree.getFullPackage(), factModelTree.getTypeName(), Collections.unmodifiableList(propertyNameElements), selectedFieldItemView.getClassName(), FactMappingValueType.NOT_EXPRESSION, factModelTree.getImportPrefix())));
}
}
}
Aggregations