@Test public void getKiePMMLModelFromPlugin() throws Exception { final PMML pmml = TestUtils.loadFromFile(SOURCE_1); assertNotNull(pmml); assertEquals(1, pmml.getModels().size()); assertTrue(pmml.getModels().get(0) instanceof RegressionModel); final String packageName = "packagename"; final KiePMMLRegressionModel retrieved = PROVIDER.getKiePMMLModelFromPlugin( packageName, pmml.getDataDictionary(), pmml.getTransformationDictionary(), (RegressionModel) pmml.getModels().get(0), RELEASE_ID); assertNotNull(retrieved); assertTrue(retrieved instanceof KiePMMLRegressionModelWithSources); KiePMMLRegressionModelWithSources retrievedWithSources = (KiePMMLRegressionModelWithSources) retrieved; final Map<String, String> sourcesMap = retrievedWithSources.getSourcesMap(); assertNotNull(sourcesMap); assertFalse(sourcesMap.isEmpty()); KieMemoryCompiler.compile(sourcesMap, Thread.currentThread().getContextClassLoader()); }
@Override public KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder) { logger.trace("getKiePMMLModelFromPlugin {} {} {}", dataDictionary, model, kBuilder); try { final Map<String, String> sourcesMap = KiePMMLRegressionModelFactory.getKiePMMLRegressionModelSourcesMap(dataDictionary, transformationDictionary, model, packageName); return new KiePMMLRegressionModelWithSources(model.getModelName(), packageName, sourcesMap); } catch (IOException e) { throw new KiePMMLException(e); } }
RegressionModelImplementationProvider implements ModelImplementationProvider<RegressionModel, KiePMMLRegressionModel> { @Override public KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder) { logger.trace("getKiePMMLModelFromPlugin {} {} {}", dataDictionary, model, kBuilder); try { final Map<String, String> sourcesMap = KiePMMLRegressionModelFactory.getKiePMMLRegressionModelSourcesMap(dataDictionary, transformationDictionary, model, packageName); return new KiePMMLRegressionModelWithSources(model.getModelName(), packageName, sourcesMap); } catch (IOException e) { throw new KiePMMLException(e); } } }
RegressionModelImplementationProvider implements ModelImplementationProvider<RegressionModel, KiePMMLRegressionModel> { @Override public KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder) { logger.trace("getKiePMMLModelFromPlugin {} {} {}", dataDictionary, model, kBuilder); try { final Map<String, String> sourcesMap = KiePMMLRegressionModelFactory.getKiePMMLRegressionModelSourcesMap(dataDictionary, transformationDictionary, model, packageName); return new KiePMMLRegressionModelWithSources(model.getModelName(), packageName, sourcesMap); } catch (IOException e) { throw new KiePMMLException(e); } }  }
RegressionModelImplementationProvider implements ModelImplementationProvider<RegressionModel, KiePMMLRegressionModel> { @Override public KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder) { logger.trace("getKiePMMLModelFromPlugin {} {} {}", dataDictionary, model, kBuilder); try { final Map<String, String> sourcesMap = KiePMMLRegressionModelFactory.getKiePMMLRegressionModelSourcesMap(dataDictionary, transformationDictionary, model, packageName); return new KiePMMLRegressionModelWithSources(model.getModelName(), packageName, sourcesMap); } catch (IOException e) { throw new KiePMMLException(e); } }  @Override PMML_MODEL getPMMLModelType(); @Override KiePMMLRegressionModel getKiePMMLModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder); @Override KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder); }
RegressionModelImplementationProvider implements ModelImplementationProvider<RegressionModel, KiePMMLRegressionModel> { @Override public KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder) { logger.trace("getKiePMMLModelFromPlugin {} {} {}", dataDictionary, model, kBuilder); try { final Map<String, String> sourcesMap = KiePMMLRegressionModelFactory.getKiePMMLRegressionModelSourcesMap(dataDictionary, transformationDictionary, model, packageName); return new KiePMMLRegressionModelWithSources(model.getModelName(), packageName, sourcesMap); } catch (IOException e) { throw new KiePMMLException(e); } }  @Override PMML_MODEL getPMMLModelType(); @Override KiePMMLRegressionModel getKiePMMLModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder); @Override KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder);  }