Hi, All,
     I have a similar questions to Jame's question. 
     I have a list of Strings which is wrapped in a class called Names, and 
what I want to get is to find all the elements that's equal to 
"targetStringname". 
     How do I create a rule using guided rule editor in Guvnor to create a rule 
which looks like the following? (Our system requires  users to be able to 
create their own rules and I doubt that the users will know how to write rules 
like the following).

when
   $name: Names( )
   $foundThese: ArrayList (size >0) from collect (String (this matches 
"targetname" ) from $name.names)

then
   System.out.println("something happened here");

public class Names {
      private List <String> name = new ArrayList<String>();
}

Thanks a bunch!



________________________________
From: "Nord, James" <[email protected]>
To: [email protected]
Sent: Tue, October 6, 2009 8:48:46 AM
Subject: [rules-users] Guvnor test scenarios and collections.


Hi 
all,
 
One of our facts has 
a collection which the rules add to.
 
I'm trying to write 
a test scenrio to cover the simple case where the fact with an empty collection 
runs through and ends up containing a value "default".
 
However I can't work 
out how to get Guvnor to do this.  I am presented with fact.blah and then 
"equals" or "does not equal" but no contains or does not 
contain.
I have tried the 
MVEL syntax of [default] but this complains that the expectation fails as: 
"[myFact] field [myCollection] was 
[[DEFAULT]] expected [[DEFAULT]]."
 
Is there any any way to do 
this?
 
Regards,
 
    
/James
**************************************************************************************
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
[email protected] and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**************************************************************************************


      
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to