Drools :: Core 6.0.0.Beta5

org.drools.core.spi
Interface KnowledgeHelper

All Superinterfaces:
org.kie.api.runtime.KieContext, org.kie.api.runtime.rule.RuleContext, Serializable
All Known Implementing Classes:
DefaultKnowledgeHelper, SequentialKnowledgeHelper

public interface KnowledgeHelper
extends org.kie.api.runtime.rule.RuleContext, Serializable

KnowledgeHelper implementation types are injected into consequenses instrumented at compile time and instances passed at runtime. It provides convenience methods for users to interact with the WorkingMemory.

Of particular interest is the update method as it allows an object to be modified without having to specify the facthandle, because they are not passed to the consequence at runtime. To achieve this the implementation will need to lookup the fact handle of the object form the WorkingMemory.


Method Summary
 void cancelRemainingPreviousLogicalDependencies()
           
<T,K> T
don(K core, Class<T> trait)
           
<T,K> T
don(K core, Class<T> trait, boolean logical)
           
<T,K> T
don(Thing<K> core, Class<T> trait)
           
<T,K> T
don(Thing<K> core, Class<T> trait, boolean logical)
           
 Object get(Declaration declaration)
           
 org.kie.api.runtime.Channel getChannel(String id)
           
 Map<String,org.kie.api.runtime.Channel> getChannels()
           
<T> T
getContext(Class<T> contextClass)
           
 Declaration getDeclaration(String identifier)
           
 org.kie.api.runtime.rule.SessionEntryPoint getEntryPoint(String id)
           
 Map<String,org.kie.api.runtime.rule.SessionEntryPoint> getEntryPoints()
           
 FactHandle getFactHandle(FactHandle handle)
           
 FactHandle getFactHandle(Object object)
           
 IdentityHashMap<Object,FactHandle> getIdentityMap()
           
 Activation getMatch()
           
 Rule getRule()
           
 Tuple getTuple()
           
 WorkingMemory getWorkingMemory()
           
 void halt()
           
 FactHandle insert(Object object)
          Asserts an object
 FactHandle insert(Object object, boolean dynamic)
          Asserts an object specifying that it implement the onPropertyChange listener
 void insertLogical(Object object)
           
 void insertLogical(Object object, boolean dynamic)
           
 void modify(Object newObject)
           
 void reset()
           
 void retract(FactHandle handle)
           
 void retract(Object handle)
           
 void setActivation(Activation agendaItem)
           
 void setFocus(String focus)
           
 void setIdentityMap(IdentityHashMap<Object,FactHandle> identityMap)
           
<T,K> Thing<K>
shed(Thing<K> thing, Class<T> trait)
           
<T,K,X extends TraitableBean>
Thing<K>
shed(TraitableBean<K,X> core, Class<T> trait)
           
 void update(FactHandle newObject)
           
 void update(FactHandle newObject, long mask, Class<?> modifiedClass)
           
 void update(FactHandle handle, Object newObject)
           
 void update(Object newObject)
           
 void update(Object newObject, long mask, Class<?> modifiedClass)
           
 
Methods inherited from interface org.kie.api.runtime.rule.RuleContext
blockMatch, cancelMatch, insertLogical, unblockAllMatches
 
Methods inherited from interface org.kie.api.runtime.KieContext
getKieRuntime, getKnowledgeRuntime
 

Method Detail

setActivation

void setActivation(Activation agendaItem)

reset

void reset()

insert

FactHandle insert(Object object)
Asserts an object

Parameters:
object - - the object to be asserted

insert

FactHandle insert(Object object,
                  boolean dynamic)
Asserts an object specifying that it implement the onPropertyChange listener

Parameters:
object - - the object to be asserted
dynamic - - specifies the object implements onPropertyChangeListener

insertLogical

void insertLogical(Object object)
Specified by:
insertLogical in interface org.kie.api.runtime.rule.RuleContext

insertLogical

void insertLogical(Object object,
                   boolean dynamic)

cancelRemainingPreviousLogicalDependencies

void cancelRemainingPreviousLogicalDependencies()

getFactHandle

FactHandle getFactHandle(Object object)

getFactHandle

FactHandle getFactHandle(FactHandle handle)

update

void update(FactHandle handle,
            Object newObject)

update

void update(FactHandle newObject)

update

void update(FactHandle newObject,
            long mask,
            Class<?> modifiedClass)

update

void update(Object newObject)

update

void update(Object newObject,
            long mask,
            Class<?> modifiedClass)

modify

void modify(Object newObject)

retract

void retract(FactHandle handle)

retract

void retract(Object handle)

get

Object get(Declaration declaration)

getRule

Rule getRule()
Specified by:
getRule in interface org.kie.api.runtime.rule.RuleContext
Returns:
- The rule name

getTuple

Tuple getTuple()

getMatch

Activation getMatch()
Specified by:
getMatch in interface org.kie.api.runtime.rule.RuleContext

getWorkingMemory

WorkingMemory getWorkingMemory()

getEntryPoint

org.kie.api.runtime.rule.SessionEntryPoint getEntryPoint(String id)

getEntryPoints

Map<String,org.kie.api.runtime.rule.SessionEntryPoint> getEntryPoints()

getChannel

org.kie.api.runtime.Channel getChannel(String id)

getChannels

Map<String,org.kie.api.runtime.Channel> getChannels()

setFocus

void setFocus(String focus)

getDeclaration

Declaration getDeclaration(String identifier)

halt

void halt()

getIdentityMap

IdentityHashMap<Object,FactHandle> getIdentityMap()

setIdentityMap

void setIdentityMap(IdentityHashMap<Object,FactHandle> identityMap)

getContext

<T> T getContext(Class<T> contextClass)

don

<T,K> T don(K core,
            Class<T> trait,
            boolean logical)

don

<T,K> T don(Thing<K> core,
            Class<T> trait,
            boolean logical)

don

<T,K> T don(K core,
            Class<T> trait)

don

<T,K> T don(Thing<K> core,
            Class<T> trait)

shed

<T,K> Thing<K> shed(Thing<K> thing,
                    Class<T> trait)

shed

<T,K,X extends TraitableBean> Thing<K> shed(TraitableBean<K,X> core,
                                            Class<T> trait)

Drools :: Core 6.0.0.Beta5

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.