public void setOutIdentifier(String outIdentifier) {
this.outIdentifier = outIdentifier;
}
public Integer execute(Context context) {
KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
int fired;
if ( max != -1 && agendaFilter != null ) {
fired = ((StatefulKnowledgeSessionImpl) ksession).session.fireAllRules( new StatefulKnowledgeSessionImpl.AgendaFilterWrapper( agendaFilter ), max );
} else if ( max != -1 ) {
fired = ksession.fireAllRules( max );
} else if ( agendaFilter != null ) {
fired = ((StatefulKnowledgeSessionImpl) ksession).session.fireAllRules( new StatefulKnowledgeSessionImpl.AgendaFilterWrapper( agendaFilter ) );
} else {
fired = ksession.fireAllRules();
}
if ( this.outIdentifier != null ) {
ExecutionResultImpl results = ((StatefulKnowledgeSessionImpl)ksession).session.getExecutionResult();
results.getResults().put(this.outIdentifier, fired);