rule does not fire at first event
by ukriegel
Hi there,
we use drools fusion 5.3. Final.
In a drl-file, a fact and an event and the following rules are declared
package ... etc
declare ActivityState
@role(fact)
state : StateType
end
rule "set initial state"
dialect "java"
salience 100
when not (exists KFActivityState())
then
ActivityState $actState = new ActivityState();
$actState.setState(StateType.STANDBY);
insert($actState);
System.out.println("ActivityState inserted "+ new Date());
end
declare Command
@role (event)
end
rule "request information"
dialect "java"
when Command(commandType == CommandType.REQUEST_INFORMATION) from
entry-point "XXX"
$s: ActivityState(state == ComponentStateType.ACTIVE||state ==
ComponentStateType.PASSIVE||state == ComponentStateType.STANDBY)
then
System.out.println("Send Report");
end
The rule request information doesn't fire with the first command event, but
from the second one it fires always.
What's wrong with my code?
Thanks in advance
Ulrich
--
View this message in context: http://drools.46999.n3.nabble.com/rule-does-not-fire-at-first-event-tp349...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Re: [rules-users] Where in DB does Guvnor store "description" of rules?
by GPatel@tsys.com
Take a look at the guvnor rest api
----- Original Message -----
From: Praveen [praveen.sanju(a)gmail.com]
Sent: 11/08/2011 02:11 AM PST
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Where in DB does Guvnor store "description" of rules?
Hi,
Our application expects rule name and its description to be displayed in the
UI and both of
these are to be retrieved from DB.
We are aware that Guvnor stores rules in DB, not sure of the description
part.
If someone could throw light on how to get description/comments (that was
entered through Guvnor)
in UI would be great.
Initially we had the idea of parsing comments in drl.
However we saw that the description entered through Guvnor while writing a
rule does not show up in the generated source code.
TIA.
Regards,
Praveen.
--
View this message in context: http://drools.46999.n3.nabble.com/Where-in-DB-does-Guvnor-store-descripti...
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
14 years, 5 months
variables confusion Java/MVEL
by elsdestickere
Hi,
I'm confused about when en where to use Java or MVEL in a rule.
In the example below I want to replace "
openRes.getMasterExemplaar().getBruikbareExemplaren()" with a variable.
RHD: works with JAva expression:
List<Exemplaar> bruikEx =
openRes.getMasterExemplaar().getBruikbareExemplaren();
but I prefer to create the variable in the LHS, but Java doesn't work here.
Should this be a MVEL expression or should JAVA allways be possible?
rule "GarandeerReservaties"
when
garRes : GarandeerReservatieTaak();
openRes : Reservatie() from
repFact.getReservatieRepository().findVandaagOpenstaandeReservaties();
List<Exemplaar> bruikEx
=openRes.getMasterExemplaar().getBruikbareExemplaren();
eval(Reservatie.getVandaagOpenstaandeReservaties().size() > 0 &&
openRes.getMasterExemplaar().getBruikbareExemplaren().size() != 0)
then
//List<Exemplaar> bruikEx =
openRes.getMasterExemplaar().getBruikbareExemplaren();
bruikEx.get(0).setStatus(ExemplaarStatus.MOMENTEEL_GERESERVEERD);
openRes.setStatus(ReservatieStatus.GEGARANDEERD);
System.out.println( "Drools "+drools.getRule().getName()+": ocr:
"+openRes.getAantalVandaagOpenstaandeConcurReservaties() + " bruikex: "
+bruikEx.size() );
end
(written in Dutch, but I think it will be ok to understand)
br,
Els
--
View this message in context: http://drools.46999.n3.nabble.com/variables-confusion-Java-MVEL-tp3493632...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Enumerations for nested classes
by gab
Hi all,
I have a problem with data enumeration for nested classes in BRLs.
I have two classes, Promotion and Program. Promotion has a property named
"program" of type Program, which has a string property called "code".
I did a couple of enumeration in this way:
[Program.code] = ['ABC=First Program','XYZ=Second Program']
[Promotion.program.code] = ['ABC=First Program','XYZ=Second Program']
With decision table they work as expected, but in BRL rules only the first
works (the one with no nested classes), while in the other case the
drop-down list doesn't appear and it's shown only a free editable field.
How can it be? Should I write something in a different way? Is it a bug?
I'm using version 5.2.
Thanks in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/Enumerations-for-nested-classes-tp34943...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
How to write Drools rule basing on a changed property?
by kapokfly
Requirement:
1)
Rule
When
Person.address.address1 is changed
THEN
2) Ideally we should have 2 objects, 1 for the old person instance, the
other for the new person instance so contextually the LHS equals to
oldPerson.address.address1 != newPerson.address.address1.
A properties change listener might not be the best solution as it might span
multiple calls and the property change could be done on the web layer which
is out of the JBoss Drools knowledge session.
Ivan
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Drools-rule-basing-on-a-ch...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
Rule Flow: Diverge/Converge Issue with one-to-many paths being exected
by dcrissman
Drools Version: 5.1 (We are looking into upgrading, but not an option at this
time)
I have need of a rule flow that will allow a diverge on one-to-many paths
and then converge and continue on only once the paths that were executed
have all finish.
Say I have path A, B, & C. The constraints on the diverge node indicate that
A & C should be executed simultaneously, but B should not. Then the converge
node should wait for A and C to finish, but not care about B as it was not
executed by the diverge.
Initial attempt was to use Diverge(OR) and Converge(AND). The problem is
that the Converge (I think) waits on B indefinitely and so the process exits
out with no error message.
It looks like n-of-m is kind of what I want, except I have no way to know
how many paths the Diverge kicked off.
Any thoughts on how this could be done?
Much Appreciated!
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-Flow-Diverge-Converge-Issue-with-o...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months
newbie: Can rules planner provide me with the "single-steps" to the optimal binpacking solution ?
by Itai Frenkel
Hello,
I would like to solve a 2D binpacking problem. I have an existing bin-packing solution and would like to make it more "optimized". Each change (movement of items between bins) has a certain cost, and I would like to have a list of the least-cost path. There is more than one solution that is optimal.
Given an existing bin-packing solution I can tell if it is the optimal solution, and if not I can have a gross estimate to the distance to the optimal solution (although it is not guaranteed to be less than the actual distance).
It sounds to me that I need something like the A-Star algorithm. Can Drools help me in solving this problem ?
Thanks,
Itai
14 years, 5 months
Drools guvnor issue
by ANJALI
Hi guys,
i have integrated drools in my application when iam trying to save
my bpnm20 file for the frist time its saving correctly but when iam doing
for the second time its showing following error can any one tell me how to
debug this error
*Unable to save this asset, as it has been recently updated by [guest]*
iam currently using guvnor 5.3.0 final version
and designer version 1.0.0.056
Thanks in advance,
Anjali
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-guvnor-issue-tp3489376p3489376.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 5 months