Drools limitations? - drools

I am exploring drools for my project I would like to know from more experienced people out there if there are any limitations on the type of rules we can create in drl, can we make an api call in a rule in drools? is it possible to pass extra data along with the pojo I want to apply rules on?

Related

can we use UI other than drools workbench to CRUD rules

There is UI already there to control rules. and perform operation like CRUD using drl file or even using dsl for easing making drl rules for nontech person for such operation. So, Is there any other way to create our own webpage to control such rules for even easy usability?
Is any way to edit source codes for available workbench UI?
Drools is open source and you can modify the UI if you want. You can also treat Drools like a component in your architecture by wrapping it in a service and calling it through your own simplified API. You can then call your API from your own web front end.

How to consume rules defined in the KIE-Workbench from the another java web application?

I don't have previous work experience for the drools and everything. But due to my project requirement I need to use drools KIE-wirkbench rules integration. I know how to define rules inside the KIE but I don't know how to consume those rules inside the other application. Please suggest me some ideas. Thanks in advance.
Take a look at https://github.com/krisv/jbpm-evaluation-examples/blob/master/kjar-from-guvnor/src/main/java/org/jbpm/evaluation/EvaluationExampleKJarFromGuvnor.java
While it's a jBPM example, the same code would work for Drools as well.

How to call Java methods from Guvnor rule wizard?

Is it possible to call to method different to GET/SET methods from Guvnor rule wizard?
I have a simple data model in Guvnor, but if I want to create more complex rules, I need to call from my rules to other different methods, that they allow me to develop other complex task. Do I need to upload a data model different to the POJO model??
Although I can write get/set methods complex. This is other possibility. I know that in the left side of a rule I have to put a statement that tell me if something is true or false. But in the right side of the rule, maybe in some case it is possible to need to do a complex action. So, it's in these cases when I need to call to other different methods to get/set methods.
Thank in advance.
The GET/SET methods are only needed for pattern matching on the Left Hand Side of the rule. On the Right Hand Side, you can call any Java code you like.
Note a limitation. You can upload facts with any methods you like. However, you do need to be careful that if by adding those methods you are adding dependencies on external libraries (maybe a method performs database access), then you need to add Jars for those external libraries to the Guvnor classpath (explode the war and copy them into WEB-INF/lib).

Live rule creation in Drools Planner

I am interested in creating rules for Drools Planner. I want that a user can create his own rules in a java app before starting the Drools Planner. Maybe a Drools-rule-file could be generated after the user has added his rules. Would this be possible or do I have to create the rule-file while developing the whole java application?
Many thanks...
Yes it's possible.
The trick is to build your own RuleBase and set it in the Planner config.
See section "5.3.4.2.2. A RuleBase (possibly defined by Guvnor)" in the manual.
You can construct a RuleBase by several, depending on how you want your user to edit his/her rules:
From a DRL file. This presumes the user knows DRL. See Drools Expert manual.
From a DSL file. This allows you to use natural language.
From the guvnor webapp. This allows you to use the tooling Guvnor, such as a guided rule editor, a decision tables spreadsheet, ... You can even use a changeset.
From guvnor in eclipse or a standalone app (under development and experimental). There's some work being in this area, but it's still young.

Using AOP or Annotations to extend a service functionality

I would like to know what is the best way in which I can extend an existing functionality (probably by using AOP or Annotations). The scenario which I am looking for is.
We have one service say DisableEmployee which uses an entity Employee which does some validation and then disables access to employee.
For certain customers I would like to extend this functionality where DisableEmployee not only disables the access but also imposes some penalty points.
One approach would be I extend the base class and then add the additional functionality.
Is it possible (or advisable) to use AOP and annotations here; where in I annotate my DisableEmployee and then at compile time I weave the additional code into the class. (using aspect) I have read about APT and Velocity which should be able to help me in achieving it.
The reason I am looking at APT because we might have to extend the entity classes also to add some new attributes.
The idea of having this approach is to see if we can classify service extension as a form of cross-cutting functionality (like traditional logging, auditing ....)
Thanks in advance
Your question is too general to get reliable answer. But at the moment I cannot see anything what cannot be implemented in AspectJ.