如何从Business Central Drools获取规则数据 [英] How to get Rule Data from Business Central Drools
问题描述
我正在使用商务中心和Drools 7.49.我已经通过Business Central配置了规则,并且能够触发规则并成功获得结果.现在,我需要的是一个API,最好返回一个JSON,其中包含所有规则描述,因为我想在Business Central中显示我的空间,项目和包装中设置的规则.
I am using business central and Drools 7.49. I have configured my rules through Business Central and I am able to fire the rules and get the result successfully. Now what I need is an API preferably returning a JSON containing all the rules description as I want to show the rules set in Business Central my space, project and package.
有没有一种方法可以获取已配置的规则详细信息.
Is there a way I could get the rules details that I have configured.
请告知我是否需要其他信息.这是我的项目详细信息.空间:物联网平台空间项目:物联网温度服务容器:IOTTreeContainer
Do let me know if any additional information is required. Here is my project details. Space: iot-platform-space Project: iot-temperature-service Container: IOTTreeContainer
下面是我必须连接到Business Central的代码
Below is the code I am having to connect to Business Central
URL = http://x.x.x.x:8080/kie-server/services/rest/server
KieServicesConfiguration conf = KieServicesFactory.newRestConfiguration(URL, USER, PASSWORD);
KieServicesClient kieServicesClient = KieServicesFactory.newKieServicesClient(conf);
我想要一个KieContainer对象来获取所有规则.
I want an object of KieContainer from this to get all the rules.
这是获取规则的代码.
KieBase kieBase = kieContainer.getKieBase();
Collection<KiePackage> kiePackages = kieBase.getKiePackages();
List<Rule> ruleList = kiePackages.stream().flatMap(kiePackage -> kiePackage.getRules().stream()).collect(Collectors.toList());
如何从kieServiceClient获取KieContainer对象或通过其他任何方式获取它.
How to get KieContainer object from kieServiceClient or any other way to get it.
推荐答案
使用此API,您可以获取您的项目以及每个项目的git URL.如果需要,可以使用git客户端访问项目资产.
With this API you can get your projects and the git URL of each of them. If you want, you can then use a git client to access the project assets.
Another possibility is to use the KIE Server REST APIs, but I never used them before. The documentation mentions a Swagger endpoint that you can use to see what information is available through these endpoints.
这篇关于如何从Business Central Drools获取规则数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!