📄 troubleticket.drl
字号:
package org.drools.examples
import org.drools.examples.TroubleTicketExample.Customer;
import org.drools.examples.TroubleTicketExample.Ticket;
rule "New Ticket"
salience 10
when
customer : Customer( )
ticket : Ticket( customer == customer, status == "New" )
then
System.out.println( "New : " + ticket );
end
rule "Silver Priority"
duration 3000
when
customer : Customer( subscription == "Silver" )
ticket : Ticket( customer == customer, status == "New" )
then
ticket.setStatus( "Escalate" );
modify( ticket );
end
rule "Gold Priority"
duration 1000
when
customer : Customer( subscription == "Gold" )
ticket : Ticket( customer == customer, status == "New" )
then
ticket.setStatus( "Escalate" );
modify( ticket );
end
rule "Platinum Priority"
when
customer : Customer( subscription == "Platinum" )
ticket : Ticket( customer == customer, status == "New" )
then;
ticket.setStatus( "Escalate" );
modify( ticket );
end
rule "Escalate"
when
customer : Customer( )
ticket : Ticket( customer == customer, status == "Escalate" )
then
sendEscalationEmail( customer, ticket );
end
rule "Done"
when
customer : Customer( )
ticket : Ticket( customer == customer, status == "Done" )
then
System.out.println( "Done : " + ticket );
end
function void sendEscalationEmail( Customer customer, Ticket ticket ) {
System.out.println( "Email : " + ticket );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -