}
return null;
}
MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
expr = new MVELDumper().dump( result,
mvelCtx );
arguments.set( arg.getPosition(), MVEL.eval( expr )); // for now we just work with literals
}
}
// now do the slotted, all of which should be done via : bindings
for ( BindingDescr binding : patternDescr.getBindings() ) {
// if left is for existing binding, we need to actual execute as an input var
Declaration declr = context.getDeclarationResolver().getDeclaration( context.getRule(), binding.getVariable() );
if ( declr != null ) {
// check right maps to a slot, otherwise we can't reverse this and should error
int pos = getPos( binding.getExpression().trim(), params );
if ( pos >= 0 ) {
// slot exist, reverse and continue
String slot = binding.getExpression().trim();
String var = binding.getVariable().trim();
binding.setVariable( slot );
binding.setExpression( var );
} else {
// else error, we cannot find the slot to unify against
}
}
// left does not already exist, is it a slot?
int pos = getPos( binding.getVariable(), params );
if ( pos >= 0 ) {
// it's an input on a slot, is the input using bindings?
declr = context.getDeclarationResolver().getDeclaration( context.getRule(), binding.getExpression() );
if ( declr != null ) {
arguments.set( pos, declr );
declrIndexes.add( pos );
requiredDeclarations.add( declr );
} else {
// it must be a literal/expression
// it's an expression and thus an input
DrlExprParser parser = new DrlExprParser();
ConstraintConnectiveDescr result = parser.parse( binding.getExpression() );
if ( parser.hasErrors() ) {
for ( DroolsParserException error : parser.getErrors() ) {
context.getErrors().add( new DescrBuildError( context.getParentDescr(),
descr,
null,
"Unable to parser pattern expression:\n" + error.getMessage() ) );
}
return null;
}
MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
String expr = new MVELDumper().dump( result,
mvelCtx );
Object o = MVEL.eval( expr );
arguments.set( pos, o ); // for now we just work with literals
}
} else {