[rules-users] Map using from constraint

Paul Ryan pryan at infotrustgroup.com
Wed Jul 16 18:14:05 EDT 2008


Hi all,

Is there a way using the 'from' constraint to get the values of a map(the implementations of java.lang.Map eg HashMap, TreeMap, etc) into a constraint parameter, and if so can someone please give an example. Below is the way I've been trying, without success, to get a value based on a key.

import my.package.MyFact
import java.util.Map.Entry
rule "Find with map"
                when
                                $fact : MyFact($paramMap : paramMap)
                                $myValue : Entry(key == "mykey1") from $paramMap
                Then
// Sudo code...
                                <use $myValue.getValue()>
end

Paul Ryan
Software Architect
Product Engineering
InfoTrust Group, Inc.

[cid:image001.jpg at 01C8E75E.F8448000]
500 Discovery Parkway, Suite 200
Superior, CO 80027
Office (303) 627-6528
Fax (303) 666-6711
Email pryan at infotrustgroup.com<mailto:pryan at infotrustgroup.com>
WEB www.infotrustgroup.com<http://www.infotrustgroup.com/>

This e-mail and all information included herein do not constitute a legal agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.  All legal agreements must be formulated in writing by a legal representative of INFOTRUST GROUP. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.  If you have received this e-mail by mistake, please inform us and destroy this e-mail and any documents it might contain.  Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.  Thank you for your cooperation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080716/7027ca16/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 2764 bytes
Desc: image001.jpg
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20080716/7027ca16/attachment.jpg 


More information about the rules-users mailing list