helloworld.drl

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

DRL
30
字号
package HelloWorld
 
#we don't use the import, as class is fully qualified below 
#import org.drools.integrationtests.helloworld.Message

global java.util.List list;

rule "Hello World"
	when
		$m : org.drools.integrationtests.helloworld.Message(list contains "hello", 
					text:message == "hola", 
					number > 40, 
					birthday > "10-Jul-1974", 
					message matches ".*ho.*",
					list excludes "wax")
	then
	    // putting in a complex consequence, to make sure it picks up the variabels correctly
		if (1==1)  {
			int a = 0;
		}
		try {
			System.out.println("hello world with collections " + $m.getMessage());
	    } catch  ( Exception e ) {
	    
	    } finally {
	        list.add( $m );
	    }
		$m.setFired(true); 
end

⌨️ 快捷键说明

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