Package org.mvel2.integration

Examples of org.mvel2.integration.VariableResolverFactory


        if (compilationUnit == null) {
            Map<String, Object> vars = valuesAsMap(object, workingMemory, leftTuple, declarations);
            return evaluate(statement, object, vars);
        }

        VariableResolverFactory factory = compilationUnit.createFactory();
        compilationUnit.updateFactory( null, null, object,
                                       leftTuple, null, workingMemory,
                                       workingMemory.getGlobalResolver(),
                                       factory );

        org.drools.rule.Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData("mvel");
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return (Boolean) MVEL.executeExpression( statement, object, factory );
    }
View Full Code Here


    }

    public int getValue(final KnowledgeHelper khelper,
                        final Rule rule,
                        final WorkingMemory workingMemory) {
        VariableResolverFactory factory = unit.getFactory( khelper,  ((AgendaItem)khelper.getMatch()).getTerminalNode().getSalienceDeclarations(),
                                                           rule, null, (LeftTuple) khelper.getMatch().getTuple(), null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver() );
       
        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return ((Number) MVEL.executeExpression( this.expr,
                                                 factory )).intValue();
    }
View Full Code Here

    public Object getValue(final Activation item,
                           final Declaration[] declrs,
                           final Rule rule,
                           final WorkingMemory workingMemory) {
        VariableResolverFactory factory = unit.getFactory( null, declrs,
                                                           rule, null, (LeftTuple)item.getTuple(), null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver() );
       
        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return MVEL.executeExpression(this.expr,
                                      factory);
    }
View Full Code Here

    }
   
    public VariableResolverFactory createFactory() {
        Object[] vals = new Object[inputIdentifiers.length];

        VariableResolverFactory factory = varModel.createFactory( vals );
        DroolsVarFactory df = new  DroolsVarFactory();
        factory.setNextFactory( df );      
        return factory;
    }
View Full Code Here

                                              final Object rightObject,
                                              final LeftTuple tuples,
                                              final Object[] otherVars,
                                              final InternalWorkingMemory workingMemory,
                                              final GlobalResolver globals) {
        VariableResolverFactory factory = createFactory();
        updateFactory(knowledgeHelper, prevDecl, rule, rightObject, tuples, otherVars, workingMemory, globals, factory);
        return factory;
    }
View Full Code Here

    }

    public int getValue(final KnowledgeHelper khelper,
                        final Rule rule,
                        final WorkingMemory workingMemory) {
        VariableResolverFactory factory = unit.getFactory( khelper,  ((AgendaItem)khelper.getActivation()).getRuleTerminalNode().getSalienceDeclarations(),
                                                           rule, null, (LeftTuple) khelper.getActivation().getTuple(), null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver() );
       
        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return ((Number) MVEL.executeExpression( this.expr,
                                                 factory )).intValue();
    }
View Full Code Here

                            final Tuple tuple,
                            final Declaration[] previousDeclarations,
                            final Declaration[] requiredDeclarations,
                            final WorkingMemory workingMemory,
                            final Object context ) throws Exception {
        VariableResolverFactory factory = unit.getFactory( null,
                                                           null,
                                                           object,
                                                           (LeftTuple) tuple,
                                                           null,
                                                           (InternalWorkingMemory) workingMemory,
                                                           workingMemory.getGlobalResolver() );

        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        final Boolean result = (Boolean) MVEL.executeExpression( this.expr,
                                                                 object,
                                                                 factory );
View Full Code Here

                vals[i++] = o;
            }
        }
        int otherVarsLength = i - otherVarsPos;

        VariableResolverFactory locals = new CachingMapVariableResolverFactory(new HashMap<String, Object>());
        DroolsMVELIndexedFactory factory =  new DroolsMVELIndexedFactory(inputIdentifiers, vals, locals);
        factory.setOtherVarsPos( otherVarsPos );
        factory.setOtherVarsLength( otherVarsLength );
       
        if ( knowledgeHelper != null && knowledgeHelper instanceof KnowledgeHelper ) {
View Full Code Here

                           InternalFactHandle handle,
                           Declaration[] declarations,
                           Declaration[] innerDeclarations,
                           WorkingMemory workingMemory) throws Exception {
       
        VariableResolverFactory factory = unit.getFactory( null, null, handle.getObject(), (LeftTuple) leftTuple, null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver()  );
       
        final Object value = MVEL.executeExpression( this.expression,
                                                     handle.getObject(),
                                                     factory );
        if ( this.function.supportsReverse() ) {
View Full Code Here

                               final Tuple tuple,
                               final Declaration[] previousDeclarations,
                               final Declaration[] requiredDeclarations,
                               final WorkingMemory workingMemory,
                               final Object ctx) throws Exception {
        VariableResolverFactory factory = unit.getFactory( null, null, object, (LeftTuple) tuple, null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver()  );
       
        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return org.drools.base.FieldFactory.getFieldValue( MVEL.executeExpression( this.expr,
                                                                                   object,
                                                                                   factory ) );
View Full Code Here

TOP

Related Classes of org.mvel2.integration.VariableResolverFactory

Copyright © 2018 www.massapicom. 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.