// null,
// source.getOuterDeclarations(),
// null,
// context );
MVELCompilationUnit unit = dialect.getMVELCompilationUnit( (String) accumDescr.getExpression(),
analysis,
previousDeclarations,
(Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[source.getOuterDeclarations().size()] ),
null,
context );
AccumulateFunction function = context.getConfiguration().getAccumulateFunction( accumDescr.getFunctionIdentifier() );
accumulator = new MVELAccumulatorFunctionExecutor( unit,
function );
} else {
// it is a custom accumulate
final MVELAnalysisResult initCodeAnalysis = (MVELAnalysisResult) dialect.analyzeBlock( context,
accumDescr,
accumDescr.getInitCode(),
new Set[]{context.getDeclarationResolver().getDeclarations(context.getRule()).keySet(), context.getPkg().getGlobals().keySet()} );
final MVELAnalysisResult actionCodeAnalysis = (MVELAnalysisResult) dialect.analyzeBlock( context,
accumDescr,
null,
accumDescr.getActionCode(),
new Set[]{context.getDeclarationResolver().getDeclarations(context.getRule()).keySet(), context.getPkg().getGlobals().keySet()},
initCodeAnalysis.getMvelVariables() );
final MVELAnalysisResult resultCodeAnalysis = (MVELAnalysisResult) dialect.analyzeExpression( context,
accumDescr,
accumDescr.getResultCode(),
new Set[]{context.getDeclarationResolver().getDeclarations(context.getRule()).keySet(), context.getPkg().getGlobals().keySet()},
initCodeAnalysis.getMvelVariables() );
Dialect.AnalysisResult reverseCodeAnalysis = null;
if ( accumDescr.getReverseCode() != null ) {
reverseCodeAnalysis = context.getDialect().analyzeBlock( context,
accumDescr,
accumDescr.getActionCode(),
new Set[]{context.getDeclarationResolver().getDeclarations(context.getRule()).keySet(), context.getPkg().getGlobals().keySet()} );
}
MVELCompilationUnit initUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getInitCode(),
initCodeAnalysis,
previousDeclarations,
(Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[source.getOuterDeclarations().size()] ),
null,
context );
// final Serializable init = dialect.compile( (String) accumDescr.getInitCode(),
// initCodeAnalysis,
// null,
// source.getOuterDeclarations(),
// null,
// context );
MVELCompilationUnit actionUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getActionCode(),
actionCodeAnalysis,
previousDeclarations,
(Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[source.getOuterDeclarations().size()] ),
initCodeAnalysis.getMvelVariables(),
context );
// final Serializable action = dialect.compile( (String) accumDescr.getActionCode(),
// actionCodeAnalysis,
// null,
// source.getOuterDeclarations(),
// initCodeAnalysis.getMvelVariables(),
// context );
// Serializable reverse = null;
MVELCompilationUnit reverseUnit = null;
if ( accumDescr.getReverseCode() != null ) {
reverseUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getReverseCode(),
resultCodeAnalysis,
previousDeclarations,
(Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[source.getOuterDeclarations().size()] ),
initCodeAnalysis.getMvelVariables(),
context );
// reverse = dialect.compile( (String) accumDescr.getReverseCode(),
// resultCodeAnalysis,
// null,
// source.getOuterDeclarations(),
// initCodeAnalysis.getMvelVariables(),
// context );
}
MVELCompilationUnit resultUnit = dialect.getMVELCompilationUnit( (String) accumDescr.getResultCode(),
resultCodeAnalysis,
previousDeclarations,
(Declaration[]) source.getOuterDeclarations().values().toArray( new Declaration[source.getOuterDeclarations().size()] ),
initCodeAnalysis.getMvelVariables(),
context );