blob: 5b139f27002a452ef22a83afe6b0bbbeeb7ec8f0 [file] [log] [blame]
jimmydot3982f4f2017-05-07 14:58:24 -04001package org.openecomp.portalsdk.core.drools;
2global String age
3
4rule "Default"
5when
6$droolsRuleService : DroolsRuleServiceImpl( state != null )
7then
8System.out.println($droolsRuleService.accessLabel() +" "+ $droolsRuleService.getState() +" state legal age is " + getDefaultIfNull(age));
9$droolsRuleService.setResultsString($droolsRuleService.getState()+" state legal age is " + getDefaultIfNull(age));
10end
11
12rule "Drools NJ"
13when
14$droolsRuleService : DroolsRuleServiceImpl( state == "NJ" )
15then
16System.out.println($droolsRuleService.accessLabel() +" "+ "NJ state legal age is " + getDefaultIfNull(age));
17$droolsRuleService.setResultsString("NJ state legal age is " + getDefaultIfNull(age));
18end
19
20rule "Drools KY"
21when
22$droolsRuleService : DroolsRuleServiceImpl( state == "KY" )
23then
24System.out.println($droolsRuleService.accessLabel() +" "+ "KY state legal age is " + getDefaultIfNull("20"));
25$droolsRuleService.setResultsString("KY state legal age is " + getDefaultIfNull("20"));
26end
27
28rule "Drools NY"
29when
30$droolsRuleService : DroolsRuleServiceImpl( state == "NY" )
31then
32System.out.println($droolsRuleService.accessLabel() +" "+ "NY state legal age is " + getDefaultIfNull("21"));
33$droolsRuleService.setResultsString("NY state legal age is " + getDefaultIfNull("21"));
34end
35
36function String getDefaultIfNull(String age) {
37return age == null ? "18" : age;
38}