KiePMMLTreeModelFactory { public static Map<String, String> getKiePMMLTreeModelSourcesMap(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final TreeModel model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final String packageName) { logger.trace("getKiePMMLTreeModelSourcesMap {} {} {}", dataDictionary, model, packageName); CompilationUnit cloneCU = getKiePMMLModelCompilationUnit(dataDictionary, model, fieldTypeMap, packageName, KIE_PMML_TREE_MODEL_TEMPLATE_JAVA, KIE_PMML_TREE_MODEL_TEMPLATE); String className = getSanitizedClassName(model.getModelName()); ClassOrInterfaceDeclaration modelTemplate = cloneCU.getClassByName(className) .orElseThrow(() -> new KiePMMLException(MAIN_CLASS_NOT_FOUND + ": " + className)); final ConstructorDeclaration constructorDeclaration = modelTemplate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_DEFAULT_CONSTRUCTOR, modelTemplate.getName()))); setConstructor(model, constructorDeclaration, modelTemplate.getName()); addTransformationsInClassOrInterfaceDeclaration(modelTemplate, transformationDictionary, model.getLocalTransformations()); Map<String, String> toReturn = new HashMap<>(); String fullClassName = packageName + "." + className; toReturn.put(fullClassName, cloneCU.toString()); return toReturn; } private  KiePMMLTreeModelFactory(); static KiePMMLTreeModel getKiePMMLTreeModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final TreeModel model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap); static Map<String, String> getKiePMMLTreeModelSourcesMap(final DataDictionary dataDictionary,
                                                                    final TransformationDictionary transformationDictionary,
                                                                    final TreeModel model,
                                                                    final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                                    final String packageName); static KiePMMLDroolsAST getKiePMMLDroolsAST(final DataDictionary dataDictionary,
                                                       final TreeModel model,
                                                       final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                       final List<KiePMMLDroolsType> types);  }
@Test public void getKiePMMLScorecardModelSourcesMap() { final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(pmml.getDataDictionary(), pmml.getTransformationDictionary(), treeModel.getLocalTransformations()); Map<String, String> retrieved = KiePMMLTreeModelFactory.getKiePMMLTreeModelSourcesMap(pmml.getDataDictionary(), pmml.getTransformationDictionary(), treeModel, fieldTypeMap, PACKAGE_NAME); assertNotNull(retrieved); assertEquals(1, retrieved.size()); }