accumDescr,
func.getParams()[0],
boundIds );
MVELCompilationUnit unit = dialect.getMVELCompilationUnit( func.getParams()[0],
analysis,
getUsedDeclarations( decls, analysis ),
getUsedDeclarations( sourceOuterDeclr, analysis ),
null,
context,
"drools",
KnowledgeHelper.class );
accumulator = new MVELAccumulatorFunctionExecutor( unit,
function );
} else {
// it is a custom accumulate
final MVELAnalysisResult initCodeAnalysis = (MVELAnalysisResult) dialect.analyzeBlock( context,
accumDescr,
accumDescr.getInitCode(),
boundIds);
// need to copy boundIds, as this as a "this" object.
final MVELAnalysisResult actionCodeAnalysis = (MVELAnalysisResult) dialect.analyzeBlock( context,
accumDescr,
null,
accumDescr.getActionCode(),
boundIds,
initCodeAnalysis.getMvelVariables(),
"drools",
KnowledgeHelper.class );
final MVELAnalysisResult resultCodeAnalysis = (MVELAnalysisResult) dialect.analyzeExpression( context,
accumDescr,
accumDescr.getResultCode(),
boundIds,
initCodeAnalysis.getMvelVariables() );
AnalysisResult reverseCodeAnalysis = null;
if ( accumDescr.getReverseCode() != null ) {
reverseCodeAnalysis = dialect.analyzeBlock( context,
accumDescr,
null,
accumDescr.getActionCode(),
boundIds,
initCodeAnalysis.getMvelVariables(),
"drools",
KnowledgeHelper.class );
}
MVELCompilationUnit initUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getInitCode(),
initCodeAnalysis,
getUsedDeclarations( decls, initCodeAnalysis ),
getUsedDeclarations( sourceOuterDeclr, initCodeAnalysis ),
initCodeAnalysis.getMvelVariables(),
context,
"drools",
KnowledgeHelper.class );
MVELCompilationUnit actionUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getActionCode(),
actionCodeAnalysis,
getUsedDeclarations( decls, actionCodeAnalysis ),
getUsedDeclarations( sourceOuterDeclr, actionCodeAnalysis ),
initCodeAnalysis.getMvelVariables(),
context,
"drools",
KnowledgeHelper.class );
MVELCompilationUnit reverseUnit = null;
if ( accumDescr.getReverseCode() != null ) {
reverseUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getReverseCode(),
reverseCodeAnalysis,
getUsedDeclarations( decls, reverseCodeAnalysis ),
getUsedDeclarations( sourceOuterDeclr, reverseCodeAnalysis ),
initCodeAnalysis.getMvelVariables(),
context,
"drools",
KnowledgeHelper.class );
}
MVELCompilationUnit resultUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getResultCode(),
resultCodeAnalysis,
getUsedDeclarations( decls, resultCodeAnalysis ),
getUsedDeclarations( sourceOuterDeclr, resultCodeAnalysis ),
initCodeAnalysis.getMvelVariables(),
context,