<drools:resource id="GroupUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/GroupUnit.drl" />
<drools:resource id="GradeUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/GradeUnit.drl"" />
<drools:resource id="EvaluateUnit" type="DRL"
source="file:/Users/drools/drools-spring-test/src/Rules/drls/EvaluateUnit.drl"" />
<drools:grid-node id="node1" />
<drools:kbase id="kbase1" node="node1">
<drools:resources>
<drools:resource ref="GroupUnit" />
<drools:resource ref="GradeUnit" />
<drools:resource ref="EvaluateUnit" />
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession" type="stateful" kbase="kbase1"
node="node1" />
@Controller
@RequestMapping( value = "foo" )
final class FooController{
@Autowired
StatefulKnowledgeSession ksession;
@RequestMapping( method = RequestMethod.GET )
@ResponseBody
public String evaluateUnit() {
Unit unit = new Unit("030", "502", "C", "9484", "45", new String[] {},
null);
if (ksession != null) {
ksession.fireAllRules();
ksession.insert(unit);
ksession.fireAllRules();
return "<UnitCategory>" + unit.getUnitCategory() + "</UnitCategory>";
}
else
return "<message> stateful session is null</message>";
}