KiePMMLModelRetriever { public static Optional<KiePMMLModel> getFromCommonDataAndTransformationDictionaryAndModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final Model model, final Object kBuilder) { logger.trace("getFromCommonDataAndTransformationDictionaryAndModel {}", model); final PMML_MODEL pmmlMODEL = PMML_MODEL.byName(model.getClass().getSimpleName()); logger.debug("pmmlModelType {}", pmmlMODEL); return getModelImplementationProviderStream(model) .map(implementation -> implementation.getKiePMMLModel(dataDictionary, transformationDictionary, model, kBuilder)) .findFirst(); } private  KiePMMLModelRetriever(); static Optional<KiePMMLModel> getFromCommonDataAndTransformationDictionaryAndModel(final DataDictionary dataDictionary,
                                                                                              final TransformationDictionary transformationDictionary,
                                                                                              final Model model,
                                                                                              final Object kBuilder); static Optional<KiePMMLModel> getFromCommonDataAndTransformationDictionaryAndModelFromPlugin(final String packageName,
                                                                                                        final DataDictionary dataDictionary,
                                                                                                        final TransformationDictionary transformationDictionary,
                                                                                                        final Model model,
                                                                                                        final Object kBuilder);  }
@Test public void getFromCommonDataAndTransformationDictionaryAndModelWithProvider() throws Exception { pmmlModel = KiePMMLUtil.load(getFileInputStream(MULTIPLE_TARGETS_SOURCE), MULTIPLE_TARGETS_SOURCE); final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModel(pmmlModel.getDataDictionary(), pmmlModel.getTransformationDictionary(), pmmlModel.getModels().get(0), null); assertNotNull(retrieved); }
@Test public void getFromCommonDataAndTransformationDictionaryAndModelWithoutProvider() throws Exception { pmmlModel = KiePMMLUtil.load(getFileInputStream(ONE_MINING_TARGET_SOURCE), ONE_MINING_TARGET_SOURCE); final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModel(pmmlModel.getDataDictionary(), pmmlModel.getTransformationDictionary(), pmmlModel.getModels().get(0), null); assertNotNull(retrieved); assertFalse(retrieved.isPresent()); }