accumulate Functions with self coded classes as result type
by Andre
i implemented an accumulate function which uses Datatypes, which i coded my
self , see example
the function return a list of ResourceMatch Objects, but when i try access
that objects i get an NullPointerrException (nothing more) (yes i imported
that class in the DRL)
so it seems that there has to be some kind of registration, so drools, can
handle these objectsm right ?
or what did i forget?
rule "Request counting analysed Resources By Id"
when
$list: List()
from accumulate($neu : RequestCtx() over
window:time(1m),countMatchingAnalysedResourcesInRequest($neu) )
ResourceMatch( $id: uri.toString(), count > 1 ) from $list
then
System.out.println( "Id " + $id + ": " );
System.out.println("Request counting Resources By Id Rule Workss");
channels["AuthZBlocking"].send(new ItemCacheEntry(new Item((String)$id),
new Date(System.currentTimeMillis()+ 8000)));
end
--
View this message in context: http://drools.46999.n3.nabble.com/accumulate-Functions-with-self-coded-cl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Any suggestions to implement exclusions and avoid update
by Wishing Carebear
Hi,
Below are 2 rules, rule1 has higher precedence than rule2. Rule2 should not
execute if Rule 1 executes.
1) One way to get this working is to check the null value.
2) If the update is not called, the Rule2 gets executed using the previous
null value of potentialTheftRating.
Is there any other way to implement this requirement.
rule "Rule 1 PotentialTheft0"
ruleflow-group "TheftRating0"
salience 10
no-loop
lock-on-active
when
$client : Client()
$policy : Service(productType == "Vehicle Insurance") from
$client.service
$car : Vehicle(potentialTheftRating == null, vehicleType ==
vehicleTypeType.CAR, convertible == Boolean.TRUE) from $policy.vehicle
then
modify ($car) {
setPotentialTheftRating( potentialTheftRatingType.HIGH )
}
update($client);
end
rule "Rule2 PotentialTheft0"
ruleflow-group "TheftRating0"
no-loop
lock-on-active
when
$client : Client()
$policy : Service(productType == "Vehicle Insurance") from
$client.service
$car : Vehicle(potentialTheftRating == null,vehicleType ==
vehicleTypeType.CAR, price >= 20000, price <= 45000, highTheftProbabilty ==
Boolean.FALSE ) from $policy.vehicle
then
modify ($car) {
setPotentialTheftRating( potentialTheftRatingType.MODERATE )
}
update($client);
end
13 years, 4 months
Writting a fusion query with specific time intervals
by Amila Suriarachchi
As I understood Drools fusion supports sliding windows which can either time
based on message length based. But can I write a query with specific time
intervals?
For an example Lets say my CEP engine recive events which has order value.
Now I want to fire an event if the orders within 8.00 am to 9.00 am have
less than $40000. In generally firing an event if there are less that $40000
total order value within any working hour (i.e 8.00 am 5.00 pm)
is it possible to do this?
--
View this message in context: http://drools.46999.n3.nabble.com/Writting-a-fusion-query-with-specific-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Starting Guvnor in Eclipse
by Justin Case
Hi all,
any Eclipse users around here?
I have followed the instructions here:
https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/blob/master/READ...
for Eclipse Helios+EGit+m2eclipse.
I downloaded 5.2.0.Final from https://github.com/droolsjbpm/guvnor.git, imported
all Maven projects it could find in the directory (except guvnor-docs which
misses something and I didn't care).
The Guvnor application will start in development mode, but:
- Firefox is causing often 100% CPU with it (might be the development mode)
- Eclipse Development Mode view shows LOTS of errors like this:
[ERROR] [org.drools.guvnor.Guvnor] - Errors in
'file:/C:/PocDev/GitHome/git/guvnor/droolsjbpm-ide-common/src/test/java/org/drools/ide/common/client/modeldriven/SuggestionCompletionEngineTest.java'
[ERROR] [org.drools.guvnor.Guvnor] - Line 47: No source code is
available for type
org.drools.ide.common.server.rules.SuggestionCompletionLoader; did you forget to
inherit a required module?
[ERROR] [org.drools.guvnor.Guvnor] - Line 49: No source code is
available for type java.util.jar.JarInputStream; did you forget to inherit a
required module?
Again, one can work also like this but seeing hundreds of errors is not helping
at all when I try to tinker with something somewhere. Plus there's the 100% CPU
thing... where and what should I inherit more than Maven is configured already
to inherit?
Tinkering around:
- I set all other projects as dependencies
- I set to export all sources from all projects (but there it bitches also about
missing java.util sources, who cares about these?)...
- added all these sources to the run configuration
nothing changed, I still have the above errors from both system libraries AND
project dependencies.
Or do I experience the problem mentioned in this message?
http://markmail.org/message/h52xvo4j52msambe#query:+page:1+mid:lg4mlgiof4...
Thanks for any hints,
JC
13 years, 4 months
AgendaGroup and AgendaFilter
by Saleem Lakhani
Hi,
Previous Code from drools 3.x:
Below is an example of overridden method in a class that implemented
org.drools.spi.AgendaFilter
public boolean accept(Activation activation) {
boolean evaluateRule = false;
String agendaGroup = activation.getRule().getAgendaGroup();
if (functionalArea.equalsIgnoreCase(agendaGroup) {
evaluateRule = true;
}
return evaluateRule;
}
Drools 5.x
Now I have changed the implementation to
org.drools.runtime.rule.AgendaFilter
How do I re-write the bold-italic line inside the method when variable
activation is now an instance of org.drools.runtime.rule.Activation;
It doesn't support activation.getRule().getAgendaGroup();
Thanks,
saleem
13 years, 4 months