Package org.drools.base

Examples of org.drools.base.DroolsQuery


                           final Object object,
                           final Rule rule,
                           final Activation activation,
                           ObjectTypeConf typeConf) {
            if( object instanceof DroolsQuery ) {
                DroolsQuery query = ( DroolsQuery ) object;
                UnificationNodeViewChangedEventListener collector = ( UnificationNodeViewChangedEventListener ) query.getQueryResultCollector();
                for ( int i = 0; i < 3; i++ ) {
                    Variable[] args = query.getVariables();
                    args[0].setValue( "string_0_" + i );
                    args[2].setValue( "string_2_" + i );
                    args[5].setValue( "string_5_" + i );
                    collector.rowAdded( rule, null, null, this );
                }
View Full Code Here


            this.contextEntry.updateFromFactHandle( workingMemory, handle );
        }

        public void updateFromTuple(InternalWorkingMemory workingMemory,
                                    LeftTuple tuple) {
            DroolsQuery query = ( DroolsQuery ) tuple.get( 0 ).getObject();
            Variable v = query.getVariables()[ this.reader.getIndex() ];
            if ( v == null ) {
                // if there is no Variable, handle it as a normal constraint
                this.variable = null;
                this.contextEntry.updateFromTuple( workingMemory, tuple );
            } else {
View Full Code Here

//            context.writeInt( context.terminalTupleMap.get( this.leftTuple ) );
//            context.writeObject( node.getId() );
        }

        public void execute(InternalWorkingMemory workingMemory) {                       
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getRightTupleList();
            query.setRightTupleList( null ); // null so further operations happen on a new stack element
           
            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; rightTuple = (RightTuple) rightTuple.getNext() ) {
                for( LeftTuple childLeftTuple = rightTuple.firstChild;childLeftTuple != null; childLeftTuple = ( LeftTuple ) childLeftTuple.getRightParentNext() ) {
                  node.getSinkPropagator().doPropagateAssertLeftTuple( context,
                                                                       workingMemory,
View Full Code Here

            //
            //            context.writeObject( srcVarIndexes );
        }
       
        public void execute(InternalWorkingMemory workingMemory) {
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getRightTupleList();
            query.setRightTupleList( null ); // null so further operations happen on a new stack element
           
            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; rightTuple = (RightTuple) rightTuple.getNext() ) {
              this.node.getSinkPropagator().propagateRetractRightTuple( rightTuple,
                                                                        context,
                                                                        workingMemory );
View Full Code Here

            //
            //        context.writeObject( srcVarIndexes );
        }

        public void execute(InternalWorkingMemory workingMemory) {
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getRightTupleList();
            query.setRightTupleList( null ); // null so further operations happen on a new stack element
           
            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; rightTuple = (RightTuple) rightTuple.getNext() ) {
                this.node.getSinkPropagator().propagateModifyChildLeftTuple( rightTuple.firstChild,
                                                                             rightTuple.firstChild.getLeftParent(),
                                                                             context,
View Full Code Here

        // find the DroolsQuery object
        while ( entry.getParent() != null ) {
            entry = entry.getParent();
        }
        DroolsQuery query = (DroolsQuery) entry.getLastHandle().getObject();
        query.setQuery( this.query );

        // Add results to the adapter
        query.getQueryResultCollector().rowUpdated( this.query,
                                                    leftTuple,
                                                    context,
                                                    workingMemory );
    }
View Full Code Here

            this.lock.lock();

            this.ruleBase.executeQueuedActions();
            executeQueuedActions();

            DroolsQuery queryObject = new DroolsQuery( queryName,
                                                       arguments,
                                                       getQueryListenerInstance(),
                                                       false );

            InternalFactHandle handle = this.handleFactory.newFactHandle( queryObject,
                                                                          null,
                                                                          this,
                                                                          this );

            final PropagationContext propagationContext = new PropagationContextImpl( getNextPropagationIdCounter(),
                                                                                      PropagationContext.ASSERTION,
                                                                                      null,
                                                                                      null,
                                                                                      handle,
                                                                                      agenda.getActiveActivations(),
                                                                                      agenda.getDormantActivations(),
                                                                                      getEntryPoint() );

            getEntryPointNode().assertQuery( handle,
                                             propagationContext,
                                             this );

            propagationContext.evaluateActionQueue( this );

            this.handleFactory.destroyFactHandle( handle );

            BaseNode[] nodes = this.ruleBase.getReteooBuilder().getTerminalNodes( queryObject.getQuery() );

            List<Map<String, Declaration>> decls = new ArrayList<Map<String, Declaration>>();
            if ( nodes != null ) {
                for ( BaseNode node : nodes ) {
                    decls.add( ((QueryTerminalNode) node).getSubrule().getOuterDeclarations() );
                }
            }

            executeQueuedActions();

            return new QueryResults( (List<QueryRowWithSubruleIndex>) queryObject.getQueryResultCollector().getResults(),
                                     decls.toArray( new Map[decls.size()] ),
                                     this );
        } finally {
            this.lock.unlock();
            this.ruleBase.readUnlock();
View Full Code Here

            this.lock.lock();

            this.ruleBase.executeQueuedActions();
            executeQueuedActions();

            DroolsQuery queryObject = new DroolsQuery( query,
                                                       arguments,
                                                       new OpenQueryViewChangedEventListenerAdapter( listener ),
                                                       true );
            InternalFactHandle handle = this.handleFactory.newFactHandle( queryObject,
                                                                          null,
View Full Code Here

        while ( entry.getParent() != null ) {
            entry = entry.getParent();
        }
       
       
        DroolsQuery query = (DroolsQuery) entry.getLastHandle().getObject();
        query.setQuery( this.query );

        // Add results to the adapter
        query.getQueryResultCollector().rowAdded( this.query,
                                                  leftTuple,
                                                  context,
                                                  workingMemory );
    }
View Full Code Here

        // find the DroolsQuery object
        while ( entry.getParent() != null ) {
            entry = entry.getParent();
        }
        DroolsQuery query = (DroolsQuery) entry.getLastHandle().getObject();
        query.setQuery( this.query );

        // Add results to the adapter
        query.getQueryResultCollector().rowRemoved( this.query,
                                                    leftTuple,
                                                    context,
                                                    workingMemory );
    }
View Full Code Here

TOP

Related Classes of org.drools.base.DroolsQuery

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.