@Test public void getFactModelTree() { Map<String, FactModelTree.PropertyTypeName> simpleProperties = getSimplePropertiesInner(); final ModelField[] modelFields = getModelFieldsInner(simpleProperties); final FactModelTree retrieved = abstractDMODataManagementStrategySpy.getFactModelTree(FACT_NAME, Collections.emptyMap(), modelFields); assertNotNull(retrieved); assertEquals(FACT_NAME, retrieved.getFactName()); assertEquals(FULL_PACKAGE, retrieved.getFullPackage()); assertFalse(retrieved.getSimpleProperties().isEmpty()); retrieved.getSimpleProperties().entrySet().forEach( entry -> { assertFalse(entry.getValue().getBaseTypeName().isPresent()); assertEquals(entry.getValue().getTypeName(), entry.getValue().getPropertyTypeNameToVisualize()); } ); }
public FactModelTree getFactModelTree(String factName, Map<String, String> superTypeMap, ModelField[] modelFields) { Map<String, FactModelTree.PropertyTypeName> simpleProperties = new HashMap<>(); Map<String, List<String>> genericTypesMap = new HashMap<>(); String factPackageName = packageName; String fullFactClassName = getFQCNByFactName(factName); if (fullFactClassName != null && fullFactClassName.contains(".")) { factPackageName = fullFactClassName.substring(0, fullFactClassName.lastIndexOf('.')); } if (ScenarioSimulationSharedUtils.isEnumCanonicalName(superTypeMap.get(factName))) { simpleProperties.put(ConstantsHolder.VALUE, new FactModelTree.PropertyTypeName(fullFactClassName)); return getSimpleClassFactModelTree(factName, fullFactClassName); } for (ModelField modelField : modelFields) { if (!modelField.getName().equals("this")) { String className = defineClassNameField(modelField.getClassName(), superTypeMap); simpleProperties.put(modelField.getName(), new FactModelTree.PropertyTypeName(className)); if (ScenarioSimulationSharedUtils.isCollection(className)) { populateGenericTypeMap(genericTypesMap, factName, modelField.getName(), ScenarioSimulationSharedUtils.isList(className)); } } } return new FactModelTree(factName, factPackageName, simpleProperties, genericTypesMap); }
AbstractDMODataManagementStrategy extends AbstractDataManagementStrategy { public FactModelTree getFactModelTree(String factName, Map<String, String> superTypeMap, ModelField[] modelFields) { Map<String, FactModelTree.PropertyTypeName> simpleProperties = new HashMap<>(); Map<String, List<String>> genericTypesMap = new HashMap<>(); String factPackageName = packageName; String fullFactClassName = getFQCNByFactName(factName); if (fullFactClassName != null && fullFactClassName.contains(".")) { factPackageName = fullFactClassName.substring(0, fullFactClassName.lastIndexOf('.')); } if (ScenarioSimulationSharedUtils.isEnumCanonicalName(superTypeMap.get(factName))) { simpleProperties.put(ConstantsHolder.VALUE, new FactModelTree.PropertyTypeName(fullFactClassName)); return getSimpleClassFactModelTree(factName, fullFactClassName); } for (ModelField modelField : modelFields) { if (!modelField.getName().equals("this")) { String className = defineClassNameField(modelField.getClassName(), superTypeMap); simpleProperties.put(modelField.getName(), new FactModelTree.PropertyTypeName(className)); if (ScenarioSimulationSharedUtils.isCollection(className)) { populateGenericTypeMap(genericTypesMap, factName, modelField.getName(), ScenarioSimulationSharedUtils.isList(className)); } } } return new FactModelTree(factName, factPackageName, simpleProperties, genericTypesMap); } }
AbstractDMODataManagementStrategy extends AbstractDataManagementStrategy { public FactModelTree getFactModelTree(String factName, Map<String, String> superTypeMap, ModelField[] modelFields) { Map<String, FactModelTree.PropertyTypeName> simpleProperties = new HashMap<>(); Map<String, List<String>> genericTypesMap = new HashMap<>(); String factPackageName = packageName; String fullFactClassName = getFQCNByFactName(factName); if (fullFactClassName != null && fullFactClassName.contains(".")) { factPackageName = fullFactClassName.substring(0, fullFactClassName.lastIndexOf('.')); } if (ScenarioSimulationSharedUtils.isEnumCanonicalName(superTypeMap.get(factName))) { simpleProperties.put(ConstantsHolder.VALUE, new FactModelTree.PropertyTypeName(fullFactClassName)); return getSimpleClassFactModelTree(factName, fullFactClassName); } for (ModelField modelField : modelFields) { if (!modelField.getName().equals("this")) { String className = defineClassNameField(modelField.getClassName(), superTypeMap); simpleProperties.put(modelField.getName(), new FactModelTree.PropertyTypeName(className)); if (ScenarioSimulationSharedUtils.isCollection(className)) { populateGenericTypeMap(genericTypesMap, factName, modelField.getName(), ScenarioSimulationSharedUtils.isList(className)); } } } return new FactModelTree(factName, factPackageName, simpleProperties, genericTypesMap); }  }
AbstractDMODataManagementStrategy extends AbstractDataManagementStrategy { public FactModelTree getFactModelTree(String factName, Map<String, String> superTypeMap, ModelField[] modelFields) { Map<String, FactModelTree.PropertyTypeName> simpleProperties = new HashMap<>(); Map<String, List<String>> genericTypesMap = new HashMap<>(); String factPackageName = packageName; String fullFactClassName = getFQCNByFactName(factName); if (fullFactClassName != null && fullFactClassName.contains(".")) { factPackageName = fullFactClassName.substring(0, fullFactClassName.lastIndexOf('.')); } if (ScenarioSimulationSharedUtils.isEnumCanonicalName(superTypeMap.get(factName))) { simpleProperties.put(ConstantsHolder.VALUE, new FactModelTree.PropertyTypeName(fullFactClassName)); return getSimpleClassFactModelTree(factName, fullFactClassName); } for (ModelField modelField : modelFields) { if (!modelField.getName().equals("this")) { String className = defineClassNameField(modelField.getClassName(), superTypeMap); simpleProperties.put(modelField.getName(), new FactModelTree.PropertyTypeName(className)); if (ScenarioSimulationSharedUtils.isCollection(className)) { populateGenericTypeMap(genericTypesMap, factName, modelField.getName(), ScenarioSimulationSharedUtils.isList(className)); } } } return new FactModelTree(factName, factPackageName, simpleProperties, genericTypesMap); }  @Override void populateTestTools(final TestToolsView.Presenter testToolsPresenter,
                                  final ScenarioSimulationContext context,
                                  final GridWidget gridWidget); FactModelTree getFactModelTree(String factName, Map<String, String> superTypeMap, ModelField[] modelFields); void populateGenericTypeMap(Map<String, List<String>> toPopulate, String factName, String propertyName, boolean isList); void aggregatorCallbackMethod(final TestToolsView.Presenter testToolsPresenter,
                                         final int expectedElements,
                                         final SortedMap<String, FactModelTree> factTypeFieldsMap,
                                         final ScenarioSimulationContext context,
                                         final FactModelTree result,
                                         final List<String> simpleJavaTypes,
                                         final GridWidget gridWidget); void populateFactModelTree(FactModelTree toPopulate, final SortedMap<String, FactModelTree> factTypeFieldsMap); }
AbstractDMODataManagementStrategy extends AbstractDataManagementStrategy { public FactModelTree getFactModelTree(String factName, Map<String, String> superTypeMap, ModelField[] modelFields) { Map<String, FactModelTree.PropertyTypeName> simpleProperties = new HashMap<>(); Map<String, List<String>> genericTypesMap = new HashMap<>(); String factPackageName = packageName; String fullFactClassName = getFQCNByFactName(factName); if (fullFactClassName != null && fullFactClassName.contains(".")) { factPackageName = fullFactClassName.substring(0, fullFactClassName.lastIndexOf('.')); } if (ScenarioSimulationSharedUtils.isEnumCanonicalName(superTypeMap.get(factName))) { simpleProperties.put(ConstantsHolder.VALUE, new FactModelTree.PropertyTypeName(fullFactClassName)); return getSimpleClassFactModelTree(factName, fullFactClassName); } for (ModelField modelField : modelFields) { if (!modelField.getName().equals("this")) { String className = defineClassNameField(modelField.getClassName(), superTypeMap); simpleProperties.put(modelField.getName(), new FactModelTree.PropertyTypeName(className)); if (ScenarioSimulationSharedUtils.isCollection(className)) { populateGenericTypeMap(genericTypesMap, factName, modelField.getName(), ScenarioSimulationSharedUtils.isList(className)); } } } return new FactModelTree(factName, factPackageName, simpleProperties, genericTypesMap); }  @Override void populateTestTools(final TestToolsView.Presenter testToolsPresenter,
                                  final ScenarioSimulationContext context,
                                  final GridWidget gridWidget); FactModelTree getFactModelTree(String factName, Map<String, String> superTypeMap, ModelField[] modelFields); void populateGenericTypeMap(Map<String, List<String>> toPopulate, String factName, String propertyName, boolean isList); void aggregatorCallbackMethod(final TestToolsView.Presenter testToolsPresenter,
                                         final int expectedElements,
                                         final SortedMap<String, FactModelTree> factTypeFieldsMap,
                                         final ScenarioSimulationContext context,
                                         final FactModelTree result,
                                         final List<String> simpleJavaTypes,
                                         final GridWidget gridWidget); void populateFactModelTree(FactModelTree toPopulate, final SortedMap<String, FactModelTree> factTypeFieldsMap);  }