Re: [rules-users] RE: Is the future avail in 4.0

2007-10-06 Thread Mark Proctor

Sikkandar Nawabjan wrote:

Hi,
I have couple of questions
 
1) I want to validate a Object and based upon certain condition set the flag and that flag available in my working memory context so that all the rules will execute based on the value of this flag. Is there any way to set the Global variable in working memory environment and use it in predicate logic.

I beleive passing Global variable using setGLobal() is possible but we can't 
use it in predicate logic.
  
globals can be used in evals, however they should be considered 
immutable if you do that and should be set before you assert any working 
memory data.
 
2) my second quetion is i have 2 classes say
 
Public class B extends Class A{
 
private boolean  flag;
 
 
}
 
 
am validating my rule using of type B.

 But i want to assert object of class A. in normal java we do downcasting  B b 
= (B)obj;
if i don't do that will downcast will happen at the working memory side 
automatically??
  

If you assert A and there is a pattern on B, A will be matched against it.
 
 
Basha
 
 
  



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] RE: Is the future avail in 4.0

2007-10-06 Thread Michael Anstis
(1) Theres nothing stopping you using a singleton to hold state, so this
provides what you want:-

rule 1
when
$o : AnObject( someField == someCriteria )
then
boolean someFlag = true;
insert(new State( someFlag ) );
end

rule 2
when
State (someFlag == true )
$o : AnotherObject ( )
then
//something else
end

You could also have the first check activate another AgendaGroup, for
example:-

rule 1
when
$o : AnObject( someField == someCriteria )
then
drools.setFocus(SomeOtherGroup);
end

rule 2
agenda-group SomeOtherGroup
when
$o : AnotherObject ( )
then
 //something else
end

(2) I believe the ObjectTypeNode filters based on Class.isInstance() and
therefore you should be able to code rules based upon the sub-class and
insert super-classes.

With kind regards,

Mike


On 06/10/2007, Sikkandar Nawabjan [EMAIL PROTECTED] wrote:

 Hi,
 I have couple of questions

 1) I want to validate a Object and based upon certain condition set the
 flag and that flag available in my working memory context so that all the
 rules will execute based on the value of this flag. Is there any way to set
 the Global variable in working memory environment and use it in predicate
 logic.
 I beleive passing Global variable using setGLobal() is possible but we
 can't use it in predicate logic.

 2) my second quetion is i have 2 classes say

 Public class B extends Class A{

 private boolean  flag;


 }


 am validating my rule using of type B.
 But i want to assert object of class A. in normal java we do
 downcasting  B b = (B)obj;
 if i don't do that will downcast will happen at the working memory side
 automatically??


 Basha



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RE: Is the future avail in 4.0

2007-10-05 Thread Sikkandar Nawabjan
Hi,
I have couple of questions
 
1) I want to validate a Object and based upon certain condition set the flag 
and that flag available in my working memory context so that all the rules will 
execute based on the value of this flag. Is there any way to set the Global 
variable in working memory environment and use it in predicate logic.
I beleive passing Global variable using setGLobal() is possible but we can't 
use it in predicate logic.
 
2) my second quetion is i have 2 classes say
 
Public class B extends Class A{
 
private boolean  flag;
 
 
}
 
 
am validating my rule using of type B.
 But i want to assert object of class A. in normal java we do downcasting  B b 
= (B)obj;
if i don't do that will downcast will happen at the working memory side 
automatically??
 
 
Basha
 
 
winmail.dat___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users