use of org.kie.pmml.models.tree.model.KiePMMLNode in project drools by kiegroup.
the class KiePMMLNodeFactoryTest method getKiePMMLNode.
@Test
public void getKiePMMLNode() {
final KiePMMLNode retrieved = KiePMMLNodeFactory.getKiePMMLNode(node1, getFieldsFromDataDictionaryAndDerivedFields(dataDictionary1, derivedFields1), PACKAGE_NAME, 1.0, new HasClassLoaderMock());
assertNotNull(retrieved);
commonVerifyNode(retrieved, node1);
}
use of org.kie.pmml.models.tree.model.KiePMMLNode in project drools by kiegroup.
the class KiePMMLNodeFactory method getKiePMMLNode.
public static KiePMMLNode getKiePMMLNode(final Node node, final List<Field<?>> fields, final String packageName, final Double missingValuePenalty, final HasClassLoader hasClassLoader) {
logger.trace("getKiePMMLTreeNode {} {}", packageName, node);
final KiePMMLNodeFactory.NodeNamesDTO nodeNamesDTO = new KiePMMLNodeFactory.NodeNamesDTO(node, createNodeClassName(), null, missingValuePenalty);
final Map<String, String> sourcesMap = getKiePMMLNodeSourcesMap(nodeNamesDTO, fields, packageName);
String fullClassName = packageName + "." + nodeNamesDTO.nodeClassName;
try {
Class<?> kiePMMLNodeClass = hasClassLoader.compileAndLoadClass(sourcesMap, fullClassName);
return (KiePMMLNode) kiePMMLNodeClass.newInstance();
} catch (Exception e) {
throw new KiePMMLException(e);
}
}
Aggregations