[jboss-svn-commits] JBL Code SVN: r14269 - labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 15 18:36:48 EDT 2007
Author: mark.proctor at jboss.com
Date: 2007-08-15 18:36:48 -0400 (Wed, 15 Aug 2007)
New Revision: 14269
Added:
labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.dslr
Removed:
labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.drl
Modified:
labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/NumberGuess.drl
Log:
Updated examples
-TroubleTicketDSL was renamed to the .dslr extension
-Updated NumberGuess to use the modify keyword
Modified: labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/NumberGuess.drl
===================================================================
--- labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/NumberGuess.drl 2007-08-15 21:47:28 UTC (rev 14268)
+++ labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/NumberGuess.drl 2007-08-15 22:36:48 UTC (rev 14269)
@@ -21,8 +21,7 @@
then
System.out.println( "You have " + ( rules.allowedGuesses - game.guessCount ) + " out of " + rules.allowedGuesses + " guesses left.\nPlease enter your guess from 0 to " + rules.maxRange );
br = new BufferedReader( new InputStreamReader( System.in ) );
- with ( game ) { guessCount = game.guessCount + 1 }
- update ( game );
+ modify ( game ) { guessCount = game.guessCount + 1 }
i = br.readLine();
insert( new Guess( i ) );
end
@@ -34,8 +33,7 @@
game : Game( biggestGuess : biggest )
Guess( $value : value > biggestGuess )
then
- with ( game ) { biggest = $value };
- update ( game );
+ modify ( game ) { biggest = $value };
end
rule "Notify too high"
@@ -53,8 +51,7 @@
Game( smallestGuess : smallest )
Guess( $value : value < smallestGuess )
then
- with ( game ) { smallest = $value };
- update ( game );
+ modify ( game ) { smallest = $value };
end
rule "Notify too low"
Deleted: labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.drl
===================================================================
--- labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.drl 2007-08-15 21:47:28 UTC (rev 14268)
+++ labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.drl 2007-08-15 22:36:48 UTC (rev 14269)
@@ -1,62 +0,0 @@
-package org.drools.examples
-expander ticketing.dsl
-
-
-rule "New Ticket"
- salience 10
- when
-
- then
- Log "New"
-end
-
-rule "Silver Priorty"
- #if after a certain time, we still have an issue, then escalate
- duration 3000
- when
- There is a "Silver" customer with a ticket status of "New"
-
- then
- Escalate the ticket
-end
-
-rule "Gold Priority"
- duration 1000
- when
- There is a "Gold" customer with a ticket status of "New"
- then
- Escalate the ticket
-end
-
-rule "Platinum Priority"
- #we don't want to make the high rollers wait !
- when
- There is a "Platinum" customer with a ticket status of "New"
- then
- Escalate the ticket
-end
-
-
-
-rule "Escalate"
- when
- There is a customer ticket with status of "Escalate"
- then
- Send escalation email
-end
-
-rule "Done"
- when
- There is a customer ticket with status of "Done"
- then
- Log "Done"
-end
-
-# This is the same as the non DSL version. This could be kept in another file of course.
-function void sendEscalationEmail( Customer customer, Ticket ticket ) {
- System.out.println( "Email : " + ticket );
-}
-
-#hey, the imports can appear anywhere !
-import org.drools.examples.TroubleTicketExampleWithDSL.Customer;
-import org.drools.examples.TroubleTicketExampleWithDSL.Ticket;
Copied: labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.dslr (from rev 14261, labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.drl)
===================================================================
--- labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.dslr (rev 0)
+++ labs/jbossrules/trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.dslr 2007-08-15 22:36:48 UTC (rev 14269)
@@ -0,0 +1,62 @@
+package org.drools.examples
+expander ticketing.dsl
+
+
+rule "New Ticket"
+ salience 10
+ when
+
+ then
+ Log "New"
+end
+
+rule "Silver Priorty"
+ #if after a certain time, we still have an issue, then escalate
+ duration 3000
+ when
+ There is a "Silver" customer with a ticket status of "New"
+
+ then
+ Escalate the ticket
+end
+
+rule "Gold Priority"
+ duration 1000
+ when
+ There is a "Gold" customer with a ticket status of "New"
+ then
+ Escalate the ticket
+end
+
+rule "Platinum Priority"
+ #we don't want to make the high rollers wait !
+ when
+ There is a "Platinum" customer with a ticket status of "New"
+ then
+ Escalate the ticket
+end
+
+
+
+rule "Escalate"
+ when
+ There is a customer ticket with status of "Escalate"
+ then
+ Send escalation email
+end
+
+rule "Done"
+ when
+ There is a customer ticket with status of "Done"
+ then
+ Log "Done"
+end
+
+# This is the same as the non DSL version. This could be kept in another file of course.
+function void sendEscalationEmail( Customer customer, Ticket ticket ) {
+ System.out.println( "Email : " + ticket );
+}
+
+#hey, the imports can appear anywhere !
+import org.drools.examples.TroubleTicketExampleWithDSL.Customer;
+import org.drools.examples.TroubleTicketExampleWithDSL.Ticket;
More information about the jboss-svn-commits
mailing list