KiePMMLScorecardModelFactory { public static KiePMMLScorecardModel getKiePMMLScorecardModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final Scorecard model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap) throws IllegalAccessException, InstantiationException { logger.trace("getKiePMMLScorecardModel {}", model); String className = getSanitizedClassName(model.getModelName()); String packageName = getSanitizedPackageName(className); Map<String, String> sourcesMap = getKiePMMLScorecardModelSourcesMap(dataDictionary, transformationDictionary, model, fieldTypeMap, packageName); String fullClassName = packageName + "." + className; final Map<String, Class<?>> compiledClasses = KieMemoryCompiler.compile(sourcesMap, Thread.currentThread().getContextClassLoader()); return (KiePMMLScorecardModel) compiledClasses.get(fullClassName).newInstance(); } private  KiePMMLScorecardModelFactory(); static KiePMMLScorecardModel getKiePMMLScorecardModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final Scorecard model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap); static Map<String, String> getKiePMMLScorecardModelSourcesMap(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final Scorecard model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final String packageName); static KiePMMLDroolsAST getKiePMMLDroolsAST(final DataDictionary dataDictionary,
                                                       final Scorecard model,
                                                       final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                       final List<KiePMMLDroolsType> types);  }
@Test public void getKiePMMLScorecardModel() throws Exception { final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(pmml.getDataDictionary(), pmml.getTransformationDictionary(), scorecardModel.getLocalTransformations()); KiePMMLScorecardModel retrieved = KiePMMLScorecardModelFactory.getKiePMMLScorecardModel(pmml.getDataDictionary(), pmml.getTransformationDictionary(), scorecardModel, fieldTypeMap); assertNotNull(retrieved); assertEquals(scorecardModel.getModelName(), retrieved.getName()); assertEquals(TARGET_FIELD, retrieved.getTargetField()); }