I am trying to add a non-existing method to a Java bean, compile it and use the newly added method in Drools rules. Via a custom class loader. I am using CompilerUtils to bind newly modified class to the custom ClassLoader as follows: And this is where I give access to drools my classloader This is how I fire rules
Tag: drools
How to compare nested JsonNode field values with Java object parameter values in DROOLS?
I’ve been trying to execute a set of rules on a request object on the basis of some set of configuration value. Below is the example on what I am trying to do: Configuration: config.json Request Class Object: policyDataToBeVerified I converted the config.json into a JsonNode object:configJson and passed both policyDataToBeVerified and configJson to drools working memory. Below are the
How do I give Drools access to dynamically loaded classes?
I am trying to use a ClassLoader to load classes from .class files at runtime and use them in Drools rules (Drools 7.52.0). I am using this custom ClassLoader which reads from a file and uses ClassLoader.defineClass() to load a class. It’s similar to a URLClassLoader: I can use the ClassLoader to load a class, construct an instance, and access
DRools: no-loop true attribute not working with update() method inference
I have a simple DRools package with a single rule whose DRL source is the following: Then, in my Java EJB I execute rules like the following: ruleListener is a vlass which implements AgendaEventListener interface and in implementation of method beforeActivationFired I count how many rules are activated and fired for each single fact. In fact, in my EJB, after
Checking flag value before inserting flag in drools
I’ve produced a rule and it inserts a question in session. If the question is true, it inserts a FLAG and if the question is not true, it deletes the question and doesn’t update the flag. I need to check the value of the flag before inserting the question in the session. I have tried several ways to do this
Sum with Integer object if not null
I do not know if it is possible in Java but I need a method to do a special “add function”. Let me explain, SHORT VERSION: Is it possible to add an int with an Integer object? I need a method to check if that integer object exists, and add 0 if the object is null, add the correct value