简体   繁体   中英

How to get Rule Data from Business Central Drools

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.

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

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);

I want an object of KieContainer from this to get all the rules.

Here is the code to get the rules.

KieBase kieBase = kieContainer.getKieBase();
        Collection<KiePackage> kiePackages = kieBase.getKiePackages();
List<Rule> ruleList = kiePackages.stream().flatMap(kiePackage -> kiePackage.getRules().stream()).collect(Collectors.toList());

How to get KieContainer object from kieServiceClient or any other way to get it.

The Business Central REST API is what you are looking for.

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.

facing the same issue. " How to get KieContainer object from kieServiceClient or any other way to get it."

any solutions you have found? Pls share

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM