Interface WorkingMemory

    • Method Detail

      • getAgenda

        org.kie.api.runtime.rule.Agenda getAgenda()
        Returns the Agenda for this WorkingMemory. While the WorkingMemory interface is considered public, the Agenda interface is more subject to change.
        Returns:
        the Agenda
      • setGlobal

        void setGlobal​(java.lang.String identifier,
                       java.lang.Object value)
        Set a specific instance as a global in this working memory. Null values will return doing nothing. The global identifier and its type must be declared in the drl.
        Specified by:
        setGlobal in interface ReteEvaluator
        Parameters:
        identifier - the identifier under which to populate the data
        value - the global value, cannot be null
      • getEnvironment

        org.kie.api.runtime.Environment getEnvironment()
      • setGlobalResolver

        void setGlobalResolver​(GlobalResolver globalResolver)
        Sets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver. Typcicaly a delegating GlobalResolver is created that first gets a reference to the current GlobalResolver, for delegating
        Parameters:
        globalResolver -
      • fireAllRules

        int fireAllRules()
        Fire all items on the agenda until empty.
        Specified by:
        fireAllRules in interface ReteEvaluator
      • fireAllRules

        int fireAllRules​(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
        Fire all items on the agenda until empty, using the given AgendaFiler
        Specified by:
        fireAllRules in interface ReteEvaluator
      • fireAllRules

        int fireAllRules​(int fireLimit)
        Fire all items on the agenda until empty or at most 'fireLimit' rules have fired
        Specified by:
        fireAllRules in interface ReteEvaluator
      • fireAllRules

        int fireAllRules​(org.kie.api.runtime.rule.AgendaFilter agendaFilter,
                         int fireLimit)
        Fire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have fired
        Specified by:
        fireAllRules in interface ReteEvaluator
      • iterateObjects

        java.util.Iterator<?> iterateObjects()
        Returns an Iterator for the Objects in the Working Memory. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.
        Returns:
        the Iterator
      • iterateObjects

        java.util.Iterator<?> iterateObjects​(org.kie.api.runtime.ObjectFilter filter)
        Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out any objects that the ObjectFilter does not accept. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.
        Parameters:
        filter -
        Returns:
        the Iterator
      • iterateFactHandles

        java.util.Iterator<InternalFactHandle> iterateFactHandles()
        Returns an Iterator for the FactHandles in the Working Memory. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.
        Returns:
        the Iterator
      • iterateFactHandles

        java.util.Iterator<InternalFactHandle> iterateFactHandles​(org.kie.api.runtime.ObjectFilter filter)
        Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out any objects that the ObjectFilter does not accept. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.
        Parameters:
        filter -
        Returns:
        the Iterator
      • setFocus

        void setFocus​(java.lang.String focus)
        Set the focus to the specified AgendaGroup
        Parameters:
        focus -
      • getQueryResults

        org.kie.api.runtime.rule.QueryResults getQueryResults​(java.lang.String query,
                                                              java.lang.Object... arguments)
        Retrieve the QueryResults of the specified query and arguments
        Specified by:
        getQueryResults in interface ReteEvaluator
        Parameters:
        query - The name of the query.
        arguments - The arguments used for the query
        Returns:
        The QueryResults of the specified query. If no results match the query it is empty.
        Throws:
        java.lang.IllegalArgumentException - if no query named "query" is found in the rulebase
      • clearAgenda

        void clearAgenda()
        Clear the Agenda. Iterates over each AgendaGroup cancalling all Activations.
      • clearAgendaGroup

        void clearAgendaGroup​(java.lang.String group)
        Clear the Agenda Group, cancelling all its Activations.
      • clearActivationGroup

        void clearActivationGroup​(java.lang.String group)
        Clears the Activation Group, cancellings all its Activations
        Parameters:
        group -
      • clearRuleFlowGroup

        void clearRuleFlowGroup​(java.lang.String group)
        Clears the RuleFlow group, cancelling all its Activations
        Parameters:
        group -
      • startProcess

        org.kie.api.runtime.process.ProcessInstance startProcess​(java.lang.String processId)
        Starts a new process instance for the process with the given id.
      • startProcess

        org.kie.api.runtime.process.ProcessInstance startProcess​(java.lang.String processId,
                                                                 java.util.Map<java.lang.String,​java.lang.Object> parameters)
        Starts a new process instance for the process with the given id.
      • getProcessInstances

        java.util.Collection<org.kie.api.runtime.process.ProcessInstance> getProcessInstances()
        Returns the list of process instances of this working memory. This list is unmodifiable.
        Returns:
        the list of process instances
      • getProcessInstance

        org.kie.api.runtime.process.ProcessInstance getProcessInstance​(java.lang.String id)
        Returns the process instance with the given id.
        Returns:
        the process instance with the given id
      • getProcessInstance

        org.kie.api.runtime.process.ProcessInstance getProcessInstance​(java.lang.String id,
                                                                       boolean readOnly)
      • getWorkItemManager

        org.kie.api.runtime.process.WorkItemManager getWorkItemManager()
      • halt

        void halt()
        Stops rule firing after the current rule finishes executing