Get rules stored in Business Central

104 views
Skip to first unread message

maitreya bhatnagar

unread,
Apr 15, 2021, 7:28:27 AM4/15/21
to drools...@googlegroups.com
Hi,

I want to retrieve all the rules stored in my Business Central and return the data as as API .I have gotten far till here.Also below is the stackoverflow question link for further details.


I have this code : 
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 Kicontainer object from this to get all the rules.Below is the code.


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

Luca Molteni

unread,
Apr 15, 2021, 8:38:13 AM4/15/21
to drools...@googlegroups.com


> On 15 Apr 2021, at 13:28, maitreya bhatnagar <maitreya...@gmail.com> wrote:
>
> Hi,
>
> I want to retrieve all the rules stored in my Business Central and return the data as as API .I have gotten far till here.Also below is the stackoverflow question link for further details.
>
> URL: https://stackoverflow.com/questions/67057246/how-to-get-rule-data-from-business-central-drools

Hi maitreya

I see Esteban already answered you here https://stackoverflow.com/a/67062272/4206

Is there something specifically not clear?

Thank you

Luca

maitreya bhatnagar

unread,
Apr 16, 2021, 3:18:20 AM4/16/21
to Drools Setup
Hi,

 I looked into the KIE Server REST APIs but there is no way I could find here where I could get the rules, is there anything I am missing.
I checked the answer given by Esteban but could not find anything to get the rules in my .drl file in Business Central.
If you could help.

Thanks,
Maitreya

Michael Anstis

unread,
Apr 16, 2021, 3:29:22 AM4/16/21
to drools...@googlegroups.com
As Esteban wrote:

"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"

So, once you have the Git URL of the project you need to use a Git Client (API) not access the project content and hence rules etc.

There are numerous Git Client libraries available. For example, https://www.eclipse.org/jgit/

On Fri, 16 Apr 2021 at 08:18, maitreya bhatnagar <maitreya...@gmail.com> wrote:
Hi,

 I looked into the KIE Server REST APIs but there is no way I could find here where I could get the rules, is there anything I am missing.
I checked the answer given by Esteban but could not find anything to get the rules in my .drl file in Business Central.
If you could help.

Thanks,
Maitreya

On Thursday, 15 April 2021 at 18:08:13 UTC+5:30 lmol...@redhat.com wrote:


> On 15 Apr 2021, at 13:28, maitreya bhatnagar <maitreya...@gmail.com> wrote:
>
> Hi,
>
> I want to retrieve all the rules stored in my Business Central and return the data as as API .I have gotten far till here.Also below is the stackoverflow question link for further details.
>
> URL: https://stackoverflow.com/questions/67057246/how-to-get-rule-data-from-business-central-drools

Hi maitreya

I see Esteban already answered you here https://stackoverflow.com/a/67062272/4206

Is there something specifically not clear?

Thank you

Luca

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/892b93ef-28d4-4370-97fa-fc92cd7e03c1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages