troubleticketwithdsl.drl

来自「jboss规则引擎」· DRL 代码 · 共 62 行

DRL
62
字号
package org.drools.examples
expander ticketing.dsl


rule "New Ticket"
	salience 10
	when		
		There is a customer ticket with status of "New"
	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;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?