@Test public void loadPMMLRuleMappersNotEmpty() { final KnowledgeBuilderImpl kbuilderImpl = new KnowledgeBuilderImpl(); assertTrue(kbuilderImpl.getPackageNames().isEmpty()); assertNull(kbuilderImpl.getPackage(PACKAGE_NAME)); final List<PMMLRuleMapper> pmmlRuleMappers = getPMMLRuleMappers(); PMMLLoaderService.loadPMMLRuleMappers(kbuilderImpl, pmmlRuleMappers); assertEquals(1, kbuilderImpl.getPackageNames().size()); assertNotNull(kbuilderImpl.getPackage(PACKAGE_NAME)); }
static void loadPMMLRuleMappers(final KnowledgeBuilderImpl kbuilderImpl, final List<PMMLRuleMapper> pmmlRuleMappers) { if (!pmmlRuleMappers.isEmpty()) { List<Model> models = pmmlRuleMappers.stream() .map(PMMLRuleMapper::getModel) .collect(Collectors.toList()); KnowledgeBuilderImpl temp = new KnowledgeBuilderImpl(KieBaseBuilder.createKieBaseFromModel(models)); for (KiePackage kiePackage : temp.getKnowledgeBase().getKiePackages()) { kbuilderImpl.addPackage((InternalKnowledgePackage) kiePackage); } } }
PMMLLoaderService { static void loadPMMLRuleMappers(final KnowledgeBuilderImpl kbuilderImpl, final List<PMMLRuleMapper> pmmlRuleMappers) { if (!pmmlRuleMappers.isEmpty()) { List<Model> models = pmmlRuleMappers.stream() .map(PMMLRuleMapper::getModel) .collect(Collectors.toList()); KnowledgeBuilderImpl temp = new KnowledgeBuilderImpl(KieBaseBuilder.createKieBaseFromModel(models)); for (KiePackage kiePackage : temp.getKnowledgeBase().getKiePackages()) { kbuilderImpl.addPackage((InternalKnowledgePackage) kiePackage); } } } }
PMMLLoaderService { static void loadPMMLRuleMappers(final KnowledgeBuilderImpl kbuilderImpl, final List<PMMLRuleMapper> pmmlRuleMappers) { if (!pmmlRuleMappers.isEmpty()) { List<Model> models = pmmlRuleMappers.stream() .map(PMMLRuleMapper::getModel) .collect(Collectors.toList()); KnowledgeBuilderImpl temp = new KnowledgeBuilderImpl(KieBaseBuilder.createKieBaseFromModel(models)); for (KiePackage kiePackage : temp.getKnowledgeBase().getKiePackages()) { kbuilderImpl.addPackage((InternalKnowledgePackage) kiePackage); } } } private  PMMLLoaderService(); }
PMMLLoaderService { static void loadPMMLRuleMappers(final KnowledgeBuilderImpl kbuilderImpl, final List<PMMLRuleMapper> pmmlRuleMappers) { if (!pmmlRuleMappers.isEmpty()) { List<Model> models = pmmlRuleMappers.stream() .map(PMMLRuleMapper::getModel) .collect(Collectors.toList()); KnowledgeBuilderImpl temp = new KnowledgeBuilderImpl(KieBaseBuilder.createKieBaseFromModel(models)); for (KiePackage kiePackage : temp.getKnowledgeBase().getKiePackages()) { kbuilderImpl.addPackage((InternalKnowledgePackage) kiePackage); } } } private  PMMLLoaderService(); static List<KiePMMLModel> getKiePMMLModelsLoadedFromResourcesWithConfigurations(KnowledgeBuilderImpl kbuilderImpl, Collection<ResourceWithConfiguration> resourceWithConfigurations); static List<KiePMMLModel> getKiePMMLModelsLoadedFromResource(final KnowledgeBuilderImpl kbuilderImpl,
                                                                        final Resource resource); }
PMMLLoaderService { static void loadPMMLRuleMappers(final KnowledgeBuilderImpl kbuilderImpl, final List<PMMLRuleMapper> pmmlRuleMappers) { if (!pmmlRuleMappers.isEmpty()) { List<Model> models = pmmlRuleMappers.stream() .map(PMMLRuleMapper::getModel) .collect(Collectors.toList()); KnowledgeBuilderImpl temp = new KnowledgeBuilderImpl(KieBaseBuilder.createKieBaseFromModel(models)); for (KiePackage kiePackage : temp.getKnowledgeBase().getKiePackages()) { kbuilderImpl.addPackage((InternalKnowledgePackage) kiePackage); } } } private  PMMLLoaderService(); static List<KiePMMLModel> getKiePMMLModelsLoadedFromResourcesWithConfigurations(KnowledgeBuilderImpl kbuilderImpl, Collection<ResourceWithConfiguration> resourceWithConfigurations); static List<KiePMMLModel> getKiePMMLModelsLoadedFromResource(final KnowledgeBuilderImpl kbuilderImpl,
                                                                        final Resource resource);  }