Drools Flow - Wait State - How to use ruleflow variables in the constraint?
by Anderson Neves
Hi everybody.
I am using Drools 5.1.1 with persistence support. In the Wait State node I
only have the option to write a constraint in the rule way, and I have not
discovered how to use a variable of the ruleflow in it. Please, see the
hypothetical scenario below:
variable - a variable of the ruleflow that has the same attribute as the
class of the example
attribute - an atribute of the class of the example
Type - the class of the example
Constraint with mvel dialect:
Type(attribute == variable.attribute)
The error is something like there is no getVariable() in the class Type.
Thank you very much for the help
Regards,
Anderson
13 years, 6 months
FW: Basic rules question
by Abhay B. Chaware
Wendy,
Thanks for helping me out so far.
I have another question. What if I have all my "RAM" objects inserted into working memory. How should I write my rule's "when" portion to get a collection of all the RAM objects matching type "DDR" ? In other words, can I get collection of facts assigned to a variable and use it in the "then" part ?
Thanks
Abhay
==================================
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Wendy Mungovan
Sent: Friday, May 06, 2011 5:47 PM
To: Rules Users List
Subject: Re: [rules-users] Basic rules question
Q2:
So the rule would be something like:
rule "RAM type"
when
$product: Product(type == "laptop");
then
//you are looking for the best way to set valid RAM types in the then part of the rule?
$product.setRamType("DDR");
//or
$product.setValidRamOptions( getValidRamOptions("DDR"));
end
where getValidRamOptions would be a custom function included through 'import function' so you can then load the choices from some where else. Or if RamOptions were an object in memory you could have a rule like:
rule "RAM type"
when
$product: Product(type == "laptop");
$ramOptions: RAMOptions(type == "DDR");
then
$product.setValidRamOptions( $ramOptions.getList());
end
Wendy
==================================
Regards,
Abhay Chaware
Sr. Designer | KPIT Cummins Infosystems Ltd | Board: +91 020 6652 5000 | Extn: 2989 | abhay.chaware(a)kpitcummins.com |www.kpitcummins.com
P Please consider the environment before printing this e-mail
________________________________
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Wendy Mungovan
Sent: Friday, May 06, 2011 5:47 PM
To: Rules Users List
Subject: Re: [rules-users] Basic rules question
Abhay,
Q1: I think that this will depend on how many different products you have. If there is a small number it is more straight forward to have a rule for each one (so the 2nd option). This allows all you logic to be in one place. If there are a large number of products and writing a rule for each one is intractable you probably would want to look into some generalizations of the rules. Is that helpful?
Q2: I'm not quite sure what you are getting at in Q2. Are you trying to write validation rules or rules that are modifying the facts?
Wendy
________________________________
From: Abhay B. Chaware <Abhay.Chaware(a)kpitcummins.com>
To: "rules-users(a)lists.jboss.org" <rules-users(a)lists.jboss.org>
Sent: Fri, May 6, 2011 4:59:46 AM
Subject: [rules-users] Basic rules question
Hi
I am a newbie to rule based applications and trying to get the concept of rules. I have couple of questions about rules to start with, not specifically about Drools though.
Q1 - Should rules be data/model specific or can/should they be generic or both
==========================================================
e.g.
If selected product "TYPE" is "laptop", then category "RAM" should have all "DDR" type items compatible ( selecting items matching certain property )
OR
If selected product is "IBM T42", then category "RAM" should have "512MB DDR" , "1024MB DDR", "2048MB DDR" compatible. ( assigning individual items in rules )
OR
Combination of both
Q2 - How should be the data modeled in above case
==========================================================
e.g.
in product master, each item ( e.g. T40, T42 ) should have a "TYPE" ( e.g. desktop or laptop ) , all items in category "RAM" should have a "TYPE" ( e.g. DDR ) and then control the assignment of RAM options to the PRODUCT through Rule using "DDR" type ?
OR
in product master, each item ( e.g. T40, T42 ) should have a "TYPE" ( e.g. desktop or laptop ) , all items in category "RAM" should have a "compatibleProduct" column ( e.g. desktop or laptop ) and control the assignment of RAM to PRODUCT through "dynamic" rules by selecting all the RAMs by passing the "TYPE" of the product to the database handler.
Am I making my point clear ?
Thanks
Abhay
This message contains information that may be privileged or confidential and is the property of the KPIT Cummins Infosystems Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Cummins Infosystems Ltd. does not accept any liability for virus infected mails.
13 years, 6 months
SPREADSHEET DECISION TABLE: Can I use functions into CONDITIONS?
by zeta
HI!, I need to check if a given date is between two dates. So, I would like
to call a function that calculates if the given date is between other
two(specifically, between current date and current date plus some months,
and the variable "months" changes dynamically). I tried to write a
function(inside spreadsheet) that receives the date and the variable months
but does not compile. I have found not samples about functions used into
condition part so I am wondering if that is the problem. If it is the case,
what can i do?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/SPREADSHEET-DECISION-TABLE-Can-I-use-fu...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 6 months
Guvnor 5.2.0.M2 and User Permissions
by Dean Whisnant
I've downloaded 5.2.0.M2 to test out known issues we were having in 5.1.1 and many of them appear to have been resolved. One thing I noticed in 5.2.0.M2 is that when I import my exported 5.1.1 repository, the User Permissions tab appears to have lost any permissions I had setup under 5.1.1, including the administrator permissions for the admin user.
When I modify the components.xml to say true for role based permissions, I can no longer login to guvnor, I just keep getting user does not have permissions, never seeing the login prompt.
I have then gone back out and changed the components.xml to false, stopped and restarted Tomcat and Guvnor, logged in, added admin as an administrator, changed the roles based flag, stopped and restarted things, and get the same message that the user has no permissions. This comes up without any login window asking for a user name.
Is there something about importing a 5.1.1 repository that is giving me issues here? Is it Tomcat as the app server? Or are there known issues with roles based still and I should wait for CR1?
On another note, I love how snappy it feels in Safari. Things look much more crisp overall.
Thank you!
Dean
13 years, 6 months
Firing the rule at the basis of time
by saurabh maheshwari
Hi ,
how i can put a filter in the rule for particular time of the day
Suppose fire the rule at 23:10 to 1:20
I have the one timestamp field in the class.
can we put such a filter in rule or i 'll have to inside the code for each
rule since each rule has different timer. ?
Thanks ,
Saurabh
13 years, 6 months
Missing results with multiple time rules
by wendy
Hi,
I'm having an issue trying to run multiple time window patterns at the
same time. If I run them separately they produce the correct results but
when I load them both rules into working memory I only get results for the
second one. If I remove the 'over window:time(7200000ms)' aspect from both
rules I do get results for both as expected.
The rules right now are very similar (I'm trying to test out how we write
drl files) I'm not sure if that has something to do with it or not. In one
rule I'm trying to find 3 or more objects that match my constraints over the
time window and in the other between 3 and 5 objects.
I'm using drools 5.2.0 from last Tuesday droolsjbpm-drools-20c84a4.
Any help you can provide would be appreciated,
Wendy
--
View this message in context: http://drools.46999.n3.nabble.com/Missing-results-with-multiple-time-rule...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 6 months
Basic rules question
by Abhay B. Chaware
Hi
I am a newbie to rule based applications and trying to get the concept of rules. I have couple of questions about rules to start with, not specifically about Drools though.
Q1 - Should rules be data/model specific or can/should they be generic or both
==========================================================
e.g.
If selected product "TYPE" is "laptop", then category "RAM" should have all "DDR" type items compatible ( selecting items matching certain property )
OR
If selected product is "IBM T42", then category "RAM" should have "512MB DDR" , "1024MB DDR", "2048MB DDR" compatible. ( assigning individual items in rules )
OR
Combination of both
Q2 - How should be the data modeled in above case
==========================================================
e.g.
in product master, each item ( e.g. T40, T42 ) should have a "TYPE" ( e.g. desktop or laptop ) , all items in category "RAM" should have a "TYPE" ( e.g. DDR ) and then control the assignment of RAM options to the PRODUCT through Rule using "DDR" type ?
OR
in product master, each item ( e.g. T40, T42 ) should have a "TYPE" ( e.g. desktop or laptop ) , all items in category "RAM" should have a "compatibleProduct" column ( e.g. desktop or laptop ) and control the assignment of RAM to PRODUCT through "dynamic" rules by selecting all the RAMs by passing the "TYPE" of the product to the database handler.
Am I making my point clear ?
Thanks
Abhay
13 years, 6 months