Examples of DroolsQuery


Examples of org.drools.base.DroolsQuery

        // 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

Examples of org.drools.base.DroolsQuery

        // 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

Examples of org.drools.base.DroolsQuery

        public ProtobufMessages.ActionQueue.Action serialize(MarshallerWriteContext context) {
            throw new UnsupportedOperationException( "Should not be present in network on serialisation" );
        }

        public void execute(InternalWorkingMemory workingMemory) {
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getResultInsertRightTupleList();
            query.setResultInsertRightTupleList( null ); // null so further operations happen on a new stack element

            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; ) {
                RightTuple tmp = (RightTuple) rightTuple.getNext();
                rightTuples.remove( rightTuple );
                for ( LeftTuple childLeftTuple = rightTuple.firstChild; childLeftTuple != null; childLeftTuple = (LeftTuple) childLeftTuple.getRightParentNext() ) {
View Full Code Here

Examples of org.drools.base.DroolsQuery

        public ProtobufMessages.ActionQueue.Action serialize(MarshallerWriteContext context) throws IOException {
            throw new UnsupportedOperationException( "Should not be present in network on serialisation" );
        }

        public void execute(InternalWorkingMemory workingMemory) {
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getResultRetractRightTupleList();
            query.setResultRetractRightTupleList( null ); // null so further operations happen on a new stack element

            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; ) {
                RightTuple tmp = (RightTuple) rightTuple.getNext();
                rightTuples.remove( rightTuple );
                this.node.getSinkPropagator().propagateRetractRightTuple( rightTuple,
View Full Code Here

Examples of org.drools.base.DroolsQuery

        try {
            startOperation();
            this.ruleBase.readLock();
            this.lock.lock();
            DroolsQuery queryObject = new DroolsQuery( query,
                                                       arguments,
                                                       getQueryListenerInstance(),
                                                       false );
            InternalFactHandle handle = this.handleFactory.newFactHandle( queryObject,
                                                                          this.getObjectTypeConfigurationRegistry().getObjectTypeConf( EntryPoint.DEFAULT,
                                                                                                                                       queryObject ),
                                                                          this,
                                                                          this );

            insert( handle,
                    queryObject,
                    null,
                    null,
                    this.typeConfReg.getObjectTypeConf( this.entryPoint,
                                                        queryObject ) );

            this.handleFactory.destroyFactHandle( handle );

            Declaration[] declarations = new Declaration[0];
            if ( queryObject.getQuery() != null ) {
                // this is null when there are no query results, thus the query object is never set
                declarations = queryObject.getQuery().getDeclarations();
            }

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

Examples of org.drools.base.DroolsQuery

        try {
            startOperation();
            this.ruleBase.readLock();
            this.lock.lock();
            DroolsQuery queryObject = new DroolsQuery( query,
                                                       arguments,
                                                       new OpenQueryViewChangedEventListenerAdapter( listener ),
                                                       true );
            InternalFactHandle handle = this.handleFactory.newFactHandle( queryObject,
                                                                          this.getObjectTypeConfigurationRegistry().getObjectTypeConf( EntryPoint.DEFAULT,
View Full Code Here

Examples of org.drools.base.DroolsQuery

        public ProtobufMessages.ActionQueue.Action serialize(MarshallerWriteContext context) {
            throw new UnsupportedOperationException( "Should not be present in network on serialisation" );
        }

        public void execute(InternalWorkingMemory workingMemory) {
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getResultInsertRightTupleList();
            query.setResultInsertRightTupleList( null ); // null so further operations happen on a new stack element

            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; ) {
                RightTuple tmp = (RightTuple) rightTuple.getNext();
                rightTuples.remove( rightTuple );
                for ( LeftTuple childLeftTuple = rightTuple.firstChild; childLeftTuple != null; childLeftTuple = (LeftTuple) childLeftTuple.getRightParentNext() ) {
View Full Code Here

Examples of org.drools.base.DroolsQuery

        public ProtobufMessages.ActionQueue.Action serialize(MarshallerWriteContext context) throws IOException {
            throw new UnsupportedOperationException( "Should not be present in network on serialisation" );
        }

        public void execute(InternalWorkingMemory workingMemory) {
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getResultRetractRightTupleList();
            query.setResultRetractRightTupleList( null ); // null so further operations happen on a new stack element

            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; ) {
                RightTuple tmp = (RightTuple) rightTuple.getNext();
                rightTuples.remove( rightTuple );
                this.node.getSinkPropagator().propagateRetractRightTuple( rightTuple,
View Full Code Here

Examples of org.drools.base.DroolsQuery

        public ProtobufMessages.ActionQueue.Action serialize(MarshallerWriteContext context) {
            throw new UnsupportedOperationException( "Should not be present in network on serialisation" );
        }

        public void execute(InternalWorkingMemory workingMemory) {
            DroolsQuery query = (DroolsQuery) factHandle.getObject();
            RightTupleList rightTuples = query.getResultUpdateRightTupleList();
            query.setResultUpdateRightTupleList( null ); // null so further operations happen on a new stack element

            for ( RightTuple rightTuple = rightTuples.getFirst(); rightTuple != null; ) {
                RightTuple tmp = (RightTuple) rightTuple.getNext();
                rightTuples.remove( rightTuple );
                this.node.getSinkPropagator().propagateModifyChildLeftTuple( rightTuple.firstChild,
View Full Code Here

Examples of org.drools.base.DroolsQuery

            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,
                                     ( queryObject.getQuery() != null ) ? queryObject.getQuery().getParameters()  : new Declaration[0] );
        } finally {
            this.lock.unlock();
            this.ruleBase.readUnlock();
            endOperation();
        }
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.