'from' returns previous instance in stateful session
by ismaximum
Hi
In our rule we have a code like this:
when
$r : ReferenceCode(value == "N") from
referenceCodeService.getReferenceCode("SPLIT_YN")
then
System.out.println("----> " + $r.getValue() + " - " +
referenceCodeService.getReferenceCode("IDD_YN").getValue());
Now the problem is when we fire all rules to activate this one, the print
out is like this:
N - N
N - Y
As you see the first time it's N which is correct but second time I expect
to be Y
The ReferenceCodeService is a mock service in which we defined a Map that
contains all ref codes. Now before first firing rules I set the value of
SPLIT_YN to N and then for second I set it to Y but it seems it's still
returning the previous value.
Any idea?
Thanks
Drools 5.5
--
View this message in context: http://drools.46999.n3.nabble.com/from-returns-previous-instance-in-state...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Package Snapshot question
by IPatel
Hi,
I have read several posts regarding package snapshot and still have few
questions.
The is the goal of our exercise:
Find out a solution for a <specific process> in such a way that we can
deploy any changes made with no or minimal code changes required. We are
investigating drool as POC for this process.
This is what i know about package snapshots:
it allows one to lockdown any changes made to the assests. These changes
will not affect the application. This will help us because when our business
partners are making changes to the rules or updating the exisiting one, prod
application will not be impacted.
ChangeSet.xml file will have to point this snapshot url
These are the questions i have:
I see there are 3 options when dealing with snapshot:
1)create new one: When creating a new one, i believe i will have to make
changes to the changeset.xml file everytime its creation. Can i configure
this file in way that it automatically reads the package(s) created so i
dont have keep on updating it? Under what scenarion this is a good option to
use?
2)modify/replace existing one
If i select this option , the benifit will be that i dont have to change the
xml file. However what happens if there are problems and we have to revert
back to the old package. Does the system save old version of the package
before updating it with a new one?
3) My current POC's xml file points to the LATEST. Is there a benifit in
just using this and not using snapshot? How risky this is? will i be able
to access previous version of the package/rule in case of a disaster.
You input is greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Package-Snapshot-question-tp4022679.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Planner 5.5.1 Immovable Planning entities
by duggal
I have certain planning entities that are locked and their planning variables
should not change their current values. I am implementing this using the
SelectionFilter that returns false if an entity is NOT to be moved.
However I see that the Construction Heuristic Phase (FFD) does assign a
value to the Planning Variable of that entity.
As per my understanding the construction phase should also leave the
immovable entity alone.
Am I doing something incorrect?
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-5-5-1-Immovable-Planning-entiti...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Fill dependent dropdown lists based on a web decision table
by peach_wyss
Hi
I'm using Drools and Guvnor in our project. We have the following Data Model
(simplified):
- Object C
-> has a List
-> has a List
I need to build an easy to edit web decision table in guvnor. We need the
table to fill a dropdown list (Object B) in dependency of another dropdown
list (Object A), when for example creating a new Object C on a form. The
table should look something like this:
[Object A] [Object B]
Test A1 Test B1
Test B2
Test B3
Test A2 Test B4
Test A3 Test B5
Test B6
Test A4 Test B7
Test B8
Test B9
Test B10
...so when a User creates a new Object C (Create-Form) and select on for
example "Test A3" in a dropdown list (Object A), Drools should be firing and
result "Test B5" and "Test B6", which then can be filled in the second
dropdown list (Object B).
How can I achieve such a scenario? We have already Drools Guvnor in use and
the requirement is, to have such a table to easy edit the dependencies of
this two dropdown lists.
Some thoughts:
- Is there a way to fill Objects in a List as a Action-Column in a web
decision table?
- Is there a way to add Objects to a List (global variable) in a web
decision table?
- Is there a way to achieve this with rule templates?
- Are there other ways to achieve this?
Thanks for your help.
Kind regards,
Peter
--
View this message in context: http://drools.46999.n3.nabble.com/Fill-dependent-dropdown-lists-based-on-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Can't obtain object from a FactHandle
by Wolfgang Laun
Given a
org.drools.event.rule.BeforeActivationFiredEvent,
method getActivation() returns a
org.drools.runtime.rule.Activation
and its method getFactHandles() is documented to return a List<FactHandle>.
It should be possible to retrieve the fact object using
session.getObject( factHandle ), and this succeeds in many instances,
but not reliably (5.5.0-Final).
Given facts of types One and Two a rule like
One( $list: listOFTwos )
Two(...) from $list
I find that Two facts, when matched via from, are not reported with
the proper fact handle, i.e., the one returned from the insert.
What's the point in reporting fact handles that can't be used to
retrieve a fact object?
If I want to obtain all facts that participate in an activation, is
method Activation.getObjects() more (and fully) reliable?
-W
13 years, 1 month
Drools 5.5 and Java 1.6 versus 1.7 Question
by rbiller
Does anyone know of a compatibility matrix that shows what JDK versions are
compatible with Drools 5.5? The documentation mentions at least Java 1.5 is
needed, and says some examples may need 1.6.
I have encountered a problem when classes are compiled with Java 1.7, in
that if they are referenced by a DRL file, the rules compiler gives the
error "[Class] cannot be resolved to a type" for the classes that were
compiled (actually the whole jar) with Java 1.7.
Here is my post when I was trying to resolve that compile issue:
Previous post on [Class] cannot be resolved to a type error
<http://drools.46999.n3.nabble.com/Converting-Drools-3-x-to-5-5-A-JBoss-Ru...>
The rule compiler error went away when I recompiled the classes and deployed
the jar using Java 1.6. Anyone else have an issue with 1.7, or know if
Drools 5.5 is supposed to be compatible?
Thanks,
rb
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-5-and-Java-1-6-versus-1-7-Ques...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Accumulate Over window average NullPointerException
by codemettle
Users,
I am trying to follow this example in the main drools documentation:
http://docs.jboss.org/drools/release/5.4.0.Final/drools-fusion-docs/html_...
I have a simple rule that listens for an event, and provide an average over
a 3-event sliding window. I see 2 issues.
_DRL = "rule myRule\n"
_DRL += "when\n"
_DRL += "> $avg: Number() from accumulate (\n"
_DRL += "> DatapointProxy( key == 'testUsedMemPct', $val :
valueAsDouble ) over window:length( 3 ), \n"
_DRL += "> average( $val ) )\n"
_DRL += "then\n"
_DRL += " handleRule( rule, ruleResource, userdata, $avg );\n"
_DRL += "end\n"
1) my rule evaluates try for every event, and gives me the value of the
event vs the avg. So if i send 50, 60, 70, my handleRule function is a
called 3 times with new event array(java.lang.Object, [50.0]),
array(java.lang.Object, [60.0]), array(java.lang.Object, [70.0])
2) On the 4th event, I get the following NPE (includes JSON of target
object):
Msg:
{"DatapointProxy":{"value":"80","modTime":1362148018519,"uuid":"87163fc1-b072-4311-8cb4-b604d6d874ed","ownerUUID":"90d9d3d1-dd57-42b7-beba-4927c5551409","generatorUUID":"a8dfd038-c7a6-4317-8bf5-7911d7dbb759","key":"testUsedMemPct","name":"Test
Mem Value","managerUUID":"3beb7ead-f351-42a3-a4a4-38425b061a5a"}} Error:
java.lang.NullPointerException
java.lang.NullPointerException
at
org.drools.rule.SlidingLengthWindow.assertFact(SlidingLengthWindow.java:115)
at
org.drools.rule.BehaviorManager.assertFact(BehaviorManager.java:94)
at org.drools.reteoo.WindowNode.assertObject(WindowNode.java:167)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
at
com.codemettle.sherpa.cam.jms.JMSMessageListenerForDrools.injectEvent(JMSMessageListenerForDrools.java:128)
at
com.codemettle.sherpa.cam.jms.JMSMessageListenerForDrools.onMessage(JMSMessageListenerForDrools.java:105)
at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321)
at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I would appreciate some help figuring out what the issue is. Is there
something fishy in my rule?
I thank you in advance for your consideration and help
--
View this message in context: http://drools.46999.n3.nabble.com/Accumulate-Over-window-average-NullPoin...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
NoClassDefFoundError at config file
by André Fróes
I'm importing my project to netbeans and I am having this exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/drools/compiler/DroolsParserException
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
at java.lang.Class.getDeclaredFields(Class.java:1760)
at
com.thoughtworks.xstream.mapper.AnnotationMapper.processTypes(AnnotationMapper.java:182)
Java Result: 1
it happens when I reach the line where I set the configuration file:
SolverFactory solverFactory = new
XmlSolverFactory("/com/my/proj/planner/solver/plannerSolverConfig.xml");
I'm using now drools 5.5.0.Final without the dsl file that had some issue
(see older post), I tested on eclipse with it and it worked perfectly. The
path to the file is correct.
These are the dependencies, using maven:
drools-compiler-5.5.0.Final
drools-core-5.5.0.Final
drools-planner-core-5.5.0.Final
<properties>
<org.drools.version>5.5.0.Final</org.drools.version>
</properties>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${org.drools.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${org.drools.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools.planner</groupId>
<artifactId>drools-planner-core</artifactId>
<version>${org.drools.version}</version>
</dependency>
13 years, 1 month