Hi,

I have read around for an entire day but still can not figure out how to
write the following in DRL syntax:

"When a person has a an advanced degree, print 'person is educated'"

A person has many degrees.  So, I have a Person POJO and a Degree POJO.
A Person object has a field callled "degrees", which is nothing more than an
ArrayList<Degree>.
A degree has nothing but a name field, which is a String.

In regular java, it would be:

for (Degree d : person.getDegrees() {
   
  if (d == "phd" || d == "ms" || d == "jd" || d == "md") {
      System.out.println("person is highly educated");
  }

}

I can not do this in the Guvnor either.

I've tried using a contains keyword but I just can't my rule to fire. 
Simple rules otherwise fire just fine ,so my plumbing is all wired up
correctly.  





--
View this message in context: 
http://drools.46999.n3.nabble.com/Example-code-to-test-an-object-that-contains-a-collection-of-other-objects-tp4023010.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to