• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Question about Drools accessing a global HashMap and comparing it to an object value

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MyObj is a Java object that contains:

myObjList is an ArrayList<MyObj> containing from 2 to 20,000 objects

state2CodeMap is a HashMap<String, ArrayList<String>> containing an entry for each US state. The associated ArrayList contains a minimum of 1 entry, up to 200 entries.

I need to create a rule that checks all of the MyObj objects in myObjList, gets the appropriate ArrayList from state2CodeMap based on myObj.state and then if myObj.code not memberOf $codeList, run the "then" portion of the rule.

I have created about 60 fairly simple rules, that are working just fine, but this one is a little too complex for me to userstand how to write it in Drools. Looking at this page (http://blog.athico.com/2007/06/chained-from-accumulate-collect.html), I can see that nested "from" seems to be supported, but the page seems to be for Drools 4. Plus, I have had to teach myself Drools in the past week. I could really use some help with this. Any assistance is greatly appreciated!

Mike V.

Squanch that. And squanch this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!