Package org.drools.spi

Examples of org.drools.spi.Activation


       
        for( ProtobufMessages.Justification _justification : _tms.getJustificationList() ) {
            InternalFactHandle handle = (InternalFactHandle) context.handles.get( _justification.getHandleId() );
           
            for( ProtobufMessages.Activation _activation : _justification.getActivationList() ) {
                Activation activation = (Activation) context.filter.getTuplesCache().get(
                              PersisterHelper.createActivationKey( _activation.getPackageName(),
                                                                   _activation.getRuleName(),
                                                                   _activation.getTuple() ) ).getObject();
                PropagationContext pc = activation.getPropagationContext();
                tms.addLogicalDependency( handle,
                                          activation,
                                          pc,
                                          activation.getRule() );
            }
        }
    }
View Full Code Here


    public void clearAndCancelActivationGroup(final ActivationGroup activationGroup) {
        final EventSupport eventsupport = (EventSupport) this.workingMemory;

        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

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

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

        activation.setMatched( false );
       
        final 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,
                                                                                                ActivationCancelledCause.CLEAR );
            }
View Full Code Here

            // AgendaGroup is active
            // we must check the context to determine if its a new tuple or an
            // exist re-activated tuple as part of the retract
            if ( activation.getPropagationContext().getType() == PropagationContext.MODIFICATION ) {
                if ( activation.getRule().isLockOnActive() && agendaGroup.isActive() ) {
                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
                                                                                                    (LeftTuple) activation.getTuple() );

                    if ( justifier == null ) {
                        // This rule is locked and active, do not allow new
                        // tuples to activate
                        return false;
                    } else if ( activation.getRule().hasLogicalDependency() ) {
                        copyLogicalDependencies( activation.getPropagationContext(),
                                                 workingMemory,
                                                 activation,
                                                 justifier );
                    }
                } else if ( activation.getRule().hasLogicalDependency() ) {
                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
                                                                                                    (LeftTuple) activation.getTuple() );
                    copyLogicalDependencies( activation.getPropagationContext(),
                                             workingMemory,
                                             activation,
                                             justifier );
                }
            } else if ( activation.getRule().isLockOnActive() && agendaGroup.isActive() ) {
                return false;
            }

            agendaGroup.add( activation );
        } else {
            // There is a RuleFlowNode so add it there, instead of the Agenda
            InternalRuleFlowGroup rfg = (InternalRuleFlowGroup) this.getRuleFlowGroup( activation.getRule().getRuleFlowGroup() );

            // do not add the activation if the rule is "lock-on-active" and the
            // RuleFlowGroup is active
            // we must check the context to determine if its a new tuple or an
            // exist re-activated tuple as part of the retract
            if ( activation.getPropagationContext().getType() == PropagationContext.MODIFICATION ) {
                if ( activation.getRule().isLockOnActive() && rfg.isActive() ) {
                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
                                                                                                    (LeftTuple) activation.getTuple() );
                    if ( justifier == null ) {
                        // This rule is locked and active, do not allow new
                        // tuples to activate
                        return false;
                    } else if ( activation.getRule().hasLogicalDependency() ) {
                        copyLogicalDependencies( activation.getPropagationContext(),
                                                 workingMemory,
                                                 activation,
                                                 justifier );
                    }
                } else if ( activation.getRule().hasLogicalDependency() ) {
                    Activation justifier = activation.getPropagationContext().removeRetractedTuple( activation.getRule(),
                                                                                                    (LeftTuple) activation.getTuple() );
                    copyLogicalDependencies( activation.getPropagationContext(),
                                             workingMemory,
                                             activation,
                                             justifier );
View Full Code Here

    public void clearAndCancelActivationGroup(final ActivationGroup activationGroup) {
        final EventSupport eventsupport = (EventSupport) this.workingMemory;

        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.getRuleFlowGroupNode() != null ) {
                    final InternalRuleFlowGroup ruleFlowGroup = activation.getRuleFlowGroupNode().getRuleFlowGroup();
                    ruleFlowGroup.removeActivation( activation );
                }

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

                                               long processInstanceId) {

        RuleFlowGroup systemRuleFlowGroup = this.getRuleFlowGroup( ruleflowGroupName );

        for ( Iterator<RuleFlowGroupNode> activations = systemRuleFlowGroup.iterator(); activations.hasNext(); ) {
            Activation activation = activations.next().getActivation();
            if ( ruleName.equals( activation.getRule().getName() ) ) {
                if ( checkProcessInstance( activation,
                                           processInstanceId ) ) {
                    return true;
                }
            }
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,
                                                                                                ActivationCancelledCause.CLEAR );
            }
View Full Code Here

TOP

Related Classes of org.drools.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.