Not knowing the XML schema or the generated Java classes I can only outline
the general principle.
if Request contains elist List<Enrollments>, write a rule that matches the
Request object and inserts:
rule "extractFromRequest"
when
r : Request()
then
for( Enrollments e: r.getElist() ){
insert( e );
}
end
If there is only one enrollment Enrollments within each request, it's just
insert r.getEnrollments()
If you can conveniently write your rules against Enrollments objects, that's
it. Otherwise, you might do the same, over again, at the Enrollments level.
(It'll become a problem if children of some element ought to be related to
each other but this is only provided by them being children of the same
parent. In this case, you won't be able to use the JAXB generated classes as
WME classes.)
-W
On Fri, Apr 23, 2010 at 5:16 PM, mikexr <mike(a)bigfatnuthin.com> wrote:
Thanks that makes sense.
How do i get to elements that are beans below Enrollments? This doesnt
seem
to work?
rule "EnrollmentsfromEnrollmentRequest"
when
EnrollmentRequest( $es: enrollments )
$e : Enrollments( enrollmentType == "NewEnrollment") from $es
then
System.out.println("Found Subscriber
"+$e.EnrollmentPolicy.Person.getName()) ;
System.out.println("for GroupID " +
$e.GroupIdentifier.getGroupId()) ;
System.out.println("Setting Source Name to Mike");
$e.setSourceName("Mike") ;
end
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name='EnrollmentsfromEnrollmentRequest']
com/regence/edi/rules/Rule_EnrollmentsfromEnrollmentRequest_0.java
(7:641)
: $e.EnrollmentPolicy cannot be resolved or is not a field
com/regence/edi/rules/Rule_EnrollmentsfromEnrollmentRequest_0.java
(8:720)
: $e.GroupIdentifier cannot be resolved or is not a field
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Rules-Not-executing-t...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users