Examples of MVELDumper


Examples of org.drools.lang.MVELDumper

        mvelDialect.setStrictMode( false );

        context.setDialect( mvelDialect );

        PredicateDescr predicateDescr = new PredicateDescr();
        MVELDumper dumper = new MVELDumper();
        predicateDescr.setContent( dumper.dump( fieldConstraintDescr ) );

        build( context,
               pattern,
               predicateDescr,
               container );
View Full Code Here

Examples of org.drools.lang.MVELDumper

        mvelDialect.setStrictMode( false );

        context.setDialect( mvelDialect );

        PredicateDescr predicateDescr = new PredicateDescr();
        MVELDumper dumper = new MVELDumper();
        predicateDescr.setContent( dumper.dump( fieldConstraintDescr ) );

        build( context,
               pattern,
               predicateDescr,
               container );
View Full Code Here

Examples of org.drools.lang.MVELDumper

                buildRuleBindings( context, patternDescr, pattern, (BindingDescr) d );
                continue;
            }

            MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
            String expr = new MVELDumper().dump( d, mvelCtx );
            Map<String, OperatorDescr> aliases = mvelCtx.getAliases();

            // create bindings
            for ( BindingDescr bind : mvelCtx.getBindings() ) {
                buildRuleBindings( context, patternDescr, pattern, bind );
View Full Code Here

Examples of org.drools.lang.MVELDumper

        // analyze field type:
        Class resultType = getFieldReturnType( pattern,
                                               fieldConstraintDescr );
       
        PredicateDescr predicateDescr = new PredicateDescr();
        MVELDumper dumper = new MVELDumper();
        predicateDescr.setContent( dumper.dump( fieldConstraintDescr, Date.class.isAssignableFrom( resultType ) ) );

        build( context,
               pattern,
               predicateDescr,
               container );
View Full Code Here

Examples of org.drools.lang.MVELDumper

            BaseDescr d = it.next();


            boolean simple = false;
            MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
            String expr = new MVELDumper().dump( d,
                                                 mvelCtx );
            Map<String, OperatorDescr> aliases = mvelCtx.getAliases();
            RelationalExprDescr relDescr = null;
            if ( d instanceof RelationalExprDescr ) {
                relDescr = (RelationalExprDescr) d;
View Full Code Here

Examples of org.drools.lang.MVELDumper

             
//              if ( !isAtomic( result ) ) {
//
//              }
              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;
                    }
                   
//                    if ( !isAtomic( result ) ) {
//
//                    }
                    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 {
View Full Code Here

Examples of org.drools.lang.MVELDumper

                continue;
            }

            boolean simple = false;
            MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
            String expr = new MVELDumper().dump( d,
                                                 mvelCtx );
            Map<String, OperatorDescr> aliases = mvelCtx.getAliases();

            // create bindings
            for ( BindingDescr bind : mvelCtx.getBindings() ) {
View Full Code Here

Examples of org.drools.lang.MVELDumper

        // analyze field type:
        Class resultType = getFieldReturnType( pattern,
                                               fieldConstraintDescr );

        PredicateDescr predicateDescr = new PredicateDescr();
        MVELDumper dumper = new MVELDumper();
        predicateDescr.setContent( dumper.dump( fieldConstraintDescr,
                                                Date.class.isAssignableFrom( resultType ) ) );

        build( context,
               pattern,
               predicateDescr,
View Full Code Here

Examples of org.drools.lang.MVELDumper

                continue;
            }

            boolean simple = false;
            MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
            String expr = new MVELDumper().dump( d,
                                                 mvelCtx );
            Map<String, OperatorDescr> aliases = mvelCtx.getAliases();

            // create bindings
            for ( BindingDescr bind : mvelCtx.getBindings() ) {
View Full Code Here

Examples of org.drools.lang.MVELDumper

                    }
                    return;
                }

                MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
                String expr = new MVELDumper().dump( bresult,
                                                     mvelCtx );
                try {
                Object o = MVEL.eval( expr );
                arguments.set( pos,
                               o ); // for now we just work with literals
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.