Package org.drools.core.spi

Examples of org.drools.core.spi.Activation


        return new ActivationIterator( ((InternalWorkingMemoryEntryPoint) ksession).getInternalWorkingMemory(),
                                       ksession.getKieBase() );
    }

    public Object next() {
        Activation acc = null;
        if ( this.currentLeftTuple != null ) {
            Object obj = currentLeftTuple.getObject();
            acc = obj == Boolean.TRUE ? null : (Activation)obj;
            currentLeftTuple = ( LeftTuple ) leftTupleIter.next();
View Full Code Here


        wm.fireAllRules();

        assertEquals( 3, created.size() );
        assertEquals( 0, cancelled.size() );

        final Activation item = ((ActivationCreatedEvent) created.get( 2 ))
                .getActivation();

        // simulate a modify inside a consequence
        wm.update( stiltonHandle, stilton, Long.MAX_VALUE, Object.class, item );
View Full Code Here

        if ( activations == null ) {
            return null;
        }
       
        if ( pos < activations.length ) {
            Activation act = activations[pos++];
            return act;
        } else {
            if (group == AGENDA_GROUPS ) {
                InternalAgendaGroup agendaGroup = null;
                for ( ; groupsIter.hasNext();) {
                    agendaGroup = (InternalAgendaGroup) groupsIter.next() ;
                    if ( !agendaGroup.isEmpty() ) {
                        activations = (Activation[]) agendaGroup.getActivations();
                        pos = 0;                       
                        Activation act = activations[pos++];                       
                        return act;
                    }
                }
                groupsIter = agenda.getRuleFlowGroupsMap().values().iterator();
                group = RULEFLOW_GROUPS;               
            }           

            RuleFlowGroupImpl ruleflowGroup = null;
            for ( ; groupsIter.hasNext();) {
                ruleflowGroup = (RuleFlowGroupImpl) groupsIter.next() ;
                if ( !ruleflowGroup.isEmpty() ) {
                    activations = (Activation[]) ruleflowGroup.getActivations();
                    pos = 0;
                    Activation act = activations[pos++];
                    return act;
                }
            }             
        }
       
View Full Code Here

            ((EventSupport) this.workingMemory).getAgendaEventSupport().fireBeforeRuleFlowGroupDeactivated( this,
                                                                                                            this.workingMemory );
           
            FastIterator it = list.fastIterator();
            for ( ActivationNode entry =  list.getFirst(); entry != null; entry = (ActivationNode) it.next( entry ) ) {
                final Activation activation = entry.getActivation();
                activation.remove();
                if ( activation.getActivationGroupNode() != null ) {
                    activation.getActivationGroupNode().getActivationGroup().removeActivation( activation );
                }               
            }

            nodeInstances.clear();
            notifyRuleFlowGroupListeners();
View Full Code Here

    private void triggerActivations() {
       
        // iterate all activations adding them to their AgendaGroups       
        FastIterator it = list.fastIterator();
        for ( ActivationNode entry =  list.getFirst(); entry != null; entry = (ActivationNode) it.next( entry ) ) {  
            final Activation activation = entry.getActivation();
            ((InternalAgendaGroup) activation.getAgendaGroup()).add( activation );           
        }
       
        // making sure we re-evaluate agenda in case we are waiting for activations
        ((InternalAgenda) workingMemory.getAgenda()).notifyHalt();
    }
View Full Code Here

        // or could be true due to lock-on-active blocking activation creation
        if ( obj == null || obj == Boolean.TRUE) {
            return;
        }

        Activation activation = (Activation) obj;
        activation.setMatched( false );
       
        InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();

        agenda.cancelActivation( leftTuple,
                                 context,
View Full Code Here

                            final InternalWorkingMemory workingMemory) {
            if ( leftTuple.getLeftTupleSink() != node ) {
                return;
            }

            final Activation activation = (Activation) leftTuple.getObject();

            // this is to catch a race condition as activations are activated and unactivated on timers
            if ( activation instanceof ScheduledAgendaItem ) {
                ScheduledAgendaItem scheduled = (ScheduledAgendaItem) activation;
                workingMemory.getTimerService().removeJob( scheduled.getJobHandle() );
                scheduled.getJobHandle().setCancel( true );
            }

            if ( activation.isActivated() ) {
                activation.remove();
                ((EventSupport) workingMemory).getAgendaEventSupport().fireActivationCancelled( activation,
                                                                                                workingMemory,
                                                                                                MatchCancelledCause.CLEAR );
            }
View Full Code Here

       
        activationGroup.setTriggeredForRecency( this.workingMemory.getFactHandleFactory().getRecency() );

        for ( final Iterator it = activationGroup.iterator(); it.hasNext(); ) {
            final ActivationGroupNode node = (ActivationGroupNode) it.next();
            final Activation activation = node.getActivation();
            activation.setActivationGroupNode( null );

            if ( activation.isActivated() ) {
                activation.setActivated( false );
                activation.remove();

                if ( activation.getActivationNode() != null ) {
                    final InternalRuleFlowGroup ruleFlowGroup = (InternalRuleFlowGroup) activation.getActivationNode().getParentContainer();
                    ruleFlowGroup.removeActivation( activation );
                }

                eventsupport.getAgendaEventSupport().fireActivationCancelled( activation,
                                                                              this.workingMemory,
View Full Code Here

                                               long processInstanceId) {

        RuleFlowGroup systemRuleFlowGroup = this.getRuleFlowGroup( ruleflowGroupName );

        for (ActivationNode aSystemRuleFlowGroup : systemRuleFlowGroup) {
            Activation activation = aSystemRuleFlowGroup.getActivation();
            if (ruleName.equals(activation.getRule().getName())) {
                if (checkProcessInstance(activation, processInstanceId)) {
                    return true;
                }
            }
        }
View Full Code Here

        if ( activations == null ) {
            return null;
        }
       
        if ( pos < activations.length ) {
            Activation act = activations[pos++];
            return act;
        } else {
            if (group == AGENDA_GROUPS ) {
                InternalAgendaGroup agendaGroup = null;
                for ( ; groupsIter.hasNext();) {
                    agendaGroup = (InternalAgendaGroup) groupsIter.next() ;
                    if ( !agendaGroup.isEmpty() ) {
                        activations = (Activation[]) agendaGroup.getActivations();
                        pos = 0;                       
                        Activation act = activations[pos++];                       
                        return act;
                    }
                }
            }           

            RuleFlowGroupImpl ruleflowGroup = null;
            for ( ; groupsIter.hasNext();) {
                ruleflowGroup = (RuleFlowGroupImpl) groupsIter.next() ;
                if ( !ruleflowGroup.isEmpty() ) {
                    activations = (Activation[]) ruleflowGroup.getActivations();
                    pos = 0;
                    Activation act = activations[pos++];
                    return act;
                }
            }             
        }
       
View Full Code Here

TOP

Related Classes of org.drools.core.spi.Activation

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.