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


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

       
        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

                                      ProtobufMessages.BeliefSet _beliefSet) throws IOException,
                                                                            ClassNotFoundException {
        InternalFactHandle handle = (InternalFactHandle) context.handles.get( _beliefSet.getHandleId() );
        for ( ProtobufMessages.LogicalDependency _logicalDependency : _beliefSet.getLogicalDependencyList() ) {
            ProtobufMessages.Activation _activation = _logicalDependency.getActivation();
            Activation activation = (Activation) context.filter.getTuplesCache().get(
                                                                                      PersisterHelper.createActivationKey( _activation.getPackageName(),
                                                                                                                           _activation.getRuleName(),
                                                                                                                           _activation.getTuple() ) ).getObject();

            Object object = null;
            ObjectMarshallingStrategy strategy = null;
            if ( _logicalDependency.hasObjectStrategyIndex() ) {
                strategy = context.usedStrategies.get( _logicalDependency.getObjectStrategyIndex() );
                object = strategy.unmarshal( context.strategyContexts.get( strategy ),
                                             context,
                                             _logicalDependency.getObject().toByteArray(),
                                             (context.ruleBase == null) ? null : context.ruleBase.getRootClassLoader() );
            }

            Object value = null;
            if ( _logicalDependency.hasValueStrategyIndex() ) {
                strategy = context.usedStrategies.get( _logicalDependency.getValueStrategyIndex() );
                value = strategy.unmarshal( context.strategyContexts.get( strategy ),
                                            context,
                                            _logicalDependency.getValue().toByteArray(),
                                            (context.ruleBase == null) ? null : context.ruleBase.getRootClassLoader() );
            }

            ObjectTypeConf typeConf = context.wm.getObjectTypeConfigurationRegistry().getObjectTypeConf( ((NamedEntryPoint) handle.getEntryPoint()).getEntryPoint(),
                                                                                                         handle.getObject() );
            tms.readLogicalDependency( handle,
                                       object,
                                       value,
                                       activation,
                                       activation.getPropagationContext(),
                                       activation.getRule(),
                                       typeConf );
        }
    }
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

        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

        list.add( new LinkedListEntry<Activation>( activation ) );
    }

    public Activation getNext() {
        Activation activation = null;
        while ( this.index <= lastIndex ) {
            LinkedList<LinkedListEntry<Activation>> list = this.array[this.index];
            if ( list != null ) {
                activation = list.removeFirst().getObject();
                if ( list.isEmpty()) {
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.