Author: mic...@jb... Date: 2006-05-23 20:45:28 -0400 (Tue, 23 May 2006) New Revision: 4388 Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt Log: more changes Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt 2006-05-24 00:45:28 UTC (rev 4388) @@ -40,7 +40,9 @@ the latest (of course, if you change it to load direct from a file system, not the classpath, then you won't need to do this). + DSLs: + Step 11: Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,19 @@ +package org.acme.insurance; + +public class Rejection { + + private String reason; + + public Rejection(String reason) { + this.reason = reason; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + +} Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,4 @@ +#place your comments here - this is just a description for your own purposes. +[when]There is a Person with name of "{name}"=Person(name=="{name}") +[when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") +[then]Log "{message}"=System.out.println("{message}"); Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,23 @@ +#created on: 23/05/2006 +package org.acme.insurance + +expander acme_insure.dsl + + +rule "Your First Rule" + + when + #conditions + then + #actions + +end + +rule "Your Second Rule" + #include attributes such as "salience" here... + when + #conditions + then + #actions + +end Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,67 @@ +#created on: 23/05/2006 +package org.acme.insurance + + +rule "Driver underage" + + when + Driver(age < 18) + then + assert(new Rejection("Driver is underage")); + +end + +rule "Driver in margina age bracket" + when + Driver(age > 18, age < 25, priorClaims > 1) + Policy(type == "COMPREHENSIVE") + then + assert(new Rejection("No accidents accepted if in marginal age group")); +end + +rule "Driver unsafe" + when + Driver(priorClaims > 3) + then + assert(new Rejection("Too many accidents")); +end + +rule "Driver in unsafe area for comprehensive" + when + Policy(type == "COMPREHENSIVE") + Driver(locationRiskProfile == "HIGH") + or + Driver(locationRiskProfile == "MED", priorClaims > 2) + + then + assert(new Rejection("Driver in that area is too risky")); +end + +rule "Driver unsafe for third party" + when + Policy(type == "THIRD_PARTY") + Driver(priorClaims > 2) + then + assert(new Rejection("Too many priors for third party")); +end + +rule "Driver in bad area for theft" + + when + Policy(type == "FIRE_THEFT") + d : Driver(locationRiskProfile == "HIGH") + then + assert(new Rejection("Unsafe area for theft")); +end + +rule "Handle Reject of application" + + when + r : Rejection() + d : Driver() + then + #may also notify at this point, send an email etc + retract(d); + #call some utility or a method on "d" +end + Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl ___________________________________________________________________ Name: svn:eol-style + native |