use of org.drools.core.time.impl.BaseTimer in project drools by kiegroup.
the class TimerBuilder method build.
public void build(final BuildContext context, final BuildUtils utils, final RuleConditionElement rce) {
final Timer timer = (Timer) rce;
context.pushRuleComponent(timer);
Declaration[][] declrs = timer instanceof BaseTimer ? ((BaseTimer) timer).getTimerDeclarations(context.getSubRule().getOuterDeclarations()) : null;
context.setTupleSource(utils.attachNode(context, context.getComponentFactory().getNodeFactoryService().buildTimerNode(context.getNextId(), timer, context.getRule().getCalendars(), declrs, context.getTupleSource(), context)));
context.setAlphaConstraints(null);
context.setBetaconstraints(null);
context.popRuleComponent();
}
use of org.drools.core.time.impl.BaseTimer in project drools by kiegroup.
the class RuleTerminalNode method setDeclarations.
public void setDeclarations(Map<String, Declaration> decls) {
if (rule.getSalience() instanceof MVELSalienceExpression) {
MVELSalienceExpression expr = (MVELSalienceExpression) rule.getSalience();
Declaration[] declrs = expr.getMVELCompilationUnit().getPreviousDeclarations();
this.salienceDeclarations = new Declaration[declrs.length];
int i = 0;
for (Declaration declr : declrs) {
this.salienceDeclarations[i++] = decls.get(declr.getIdentifier());
}
Arrays.sort(this.salienceDeclarations, SortDeclarations.instance);
}
if (rule.getEnabled() instanceof MVELEnabledExpression) {
MVELEnabledExpression expr = (MVELEnabledExpression) rule.getEnabled();
Declaration[] declrs = expr.getMVELCompilationUnit().getPreviousDeclarations();
this.enabledDeclarations = new Declaration[declrs.length];
int i = 0;
for (Declaration declr : declrs) {
this.enabledDeclarations[i++] = decls.get(declr.getIdentifier());
}
Arrays.sort(this.enabledDeclarations, SortDeclarations.instance);
}
if (rule.getTimer() instanceof BaseTimer) {
this.timerDeclarations = ((BaseTimer) rule.getTimer()).getTimerDeclarations(decls);
}
}
Aggregations