AINAE, but it could be as simple as 'replacing' condition with when and consequence with then, but I'll let the experts tell me.
Ronald 2006/4/13, Dmitry Goldenberg <[EMAIL PROTECTED]>: > > I don't understand the relationship between the XML-based DRL notation and > this new lingo with "when" / "then". > > With the DRL notation, my understanding is that you write an XML structure > like the one I'm including below. How does this change with the when/then > notation? Thanks. > > > <?xml version="1.0"?> > > <rule-set name="SamplePolicyRuleSet" > > xmlns="http://drools.org/rules" > > xmlns:java="http://drools.org/semantics/java" > > xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" > > xs:schemaLocation="http://drools.org/rules rules.xsd > http://drools.org/semantics/java java.xsd"> > > > > <!-- Imports --> > > <java:import>java.lang.Object</java:import> > > <java:import>java.lang.String</java:import> > > <!-- Utility functions --> > > <java:functions> > > public boolean f1(com.weblayers.platform.rule.PolicyExecContextcontext) > > { > > return ...; > > } > > public boolean f2(com.weblayers.platform.rule.PolicyExecContextcontext) > > { > > return ...; > > } > > </java:functions> > > > > <!-First Rule: IF (P1 AND P2) THEN RETURN OK --> > > <rule name="First Rule"> > > <!-- Rule parameters --> > > <parameter identifier="context"> > > <class>MyContext</class> > > </parameter> > > > > <!-- Rule Conditions --> > > <java:condition> > > f1() && f2() > > </java:condition> > > > > <!-- Rule Consequences --> > > <java:consequence> > > context.setReturn(Constants.OK); > > </java:consequence> > > </rule> > > > > <!-Second Rule: IF (!(P1 AND P2)) THEN RETURN FAILURE --> > > <rule name="Second Rule"> > > <!-- Rule parameters --> > > <parameter identifier="context"> > > <class>MyContext</class> > > </parameter> > > > > <!-- Rule Conditions --> > > <java:condition> > > !(f1() && f2()) > > </java:condition> > > > > <!-- Rule Consequences --> > > <java:consequence> > > context.setVerdict(Constants.FAIL); > > </java:consequence> > > </rule> > > > > </rule-set> > > > > >
