Package 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
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
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description InternalFactHandle
bolster(Object object)
InternalFactHandle
bolster(Object object, Object value)
void
cancelRemainingPreviousLogicalDependencies()
void
delete(Object handle)
void
delete(Object object, org.kie.api.runtime.rule.FactHandle.State fhState)
void
delete(org.kie.api.runtime.rule.FactHandle handle)
void
delete(org.kie.api.runtime.rule.FactHandle handle, org.kie.api.runtime.rule.FactHandle.State fhState)
<T,K>
Tdon(K core, Class<T> trait)
<T,K>
Tdon(K core, Class<T> trait, boolean logical)
<T,K>
Tdon(K core, Class<T> trait, org.kie.api.internal.runtime.beliefs.Mode... modes)
<T,K>
Tdon(K core, Collection<Class<? extends Thing>> trait)
<T,K>
Tdon(K core, Collection<Class<? extends Thing>> trait, boolean logical)
<T,K>
Tdon(K core, Collection<Class<? extends Thing>> trait, org.kie.api.internal.runtime.beliefs.Mode... modes)
<T,K>
Tdon(Thing<K> core, Class<T> trait)
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.EntryPoint
getEntryPoint(String id)
InternalFactHandle
getFactHandle(Object object)
InternalFactHandle
getFactHandle(InternalFactHandle handle)
Activation
getMatch()
ClassLoader
getProjectClassLoader()
RuleImpl
getRule()
Tuple
getTuple()
WorkingMemory
getWorkingMemory()
default void
guard(Class<?> ruleUnitClass)
default void
guard(Object ruleUnit)
void
halt()
InternalFactHandle
insert(Object object)
Asserts an objectInternalFactHandle
insert(Object object, boolean dynamic)
Asserts an object specifying that it implement the onPropertyChange listenerorg.kie.api.runtime.rule.FactHandle
insertAsync(Object object)
InternalFactHandle
insertLogical(Object object)
InternalFactHandle
insertLogical(Object object, boolean dynamic)
InternalFactHandle
insertLogical(Object object, org.kie.api.internal.runtime.beliefs.Mode belief)
InternalFactHandle
insertLogical(Object object, org.kie.api.internal.runtime.beliefs.Mode... beliefs)
void
reset()
void
retract(Object handle)
Deprecated.Use deletevoid
retract(org.kie.api.runtime.rule.FactHandle handle)
Deprecated.Use deletedefault void
run(Class<?> ruleUnitClass)
default void
run(Object ruleUnit)
default void
run(String ruleUnitName)
void
setActivation(Activation agendaItem)
void
setFocus(String focus)
<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(Object newObject)
void
update(Object newObject, BitMask mask, Class<?> modifiedClass)
void
update(org.kie.api.runtime.rule.FactHandle newObject)
void
update(org.kie.api.runtime.rule.FactHandle handle, Object newObject)
void
update(org.kie.api.runtime.rule.FactHandle newObject, BitMask mask, Class<?> modifiedClass)
-
-
-
Method Detail
-
setActivation
void setActivation(Activation agendaItem)
-
reset
void reset()
-
insert
InternalFactHandle insert(Object object)
Asserts an object- Parameters:
object
- - the object to be asserted
-
insertAsync
org.kie.api.runtime.rule.FactHandle insertAsync(Object object)
-
insert
InternalFactHandle insert(Object object, boolean dynamic)
Asserts an object specifying that it implement the onPropertyChange listener- Parameters:
object
- - the object to be asserteddynamic
- - specifies the object implements onPropertyChangeListener
-
insertLogical
InternalFactHandle insertLogical(Object object)
- Specified by:
insertLogical
in interfaceorg.kie.api.runtime.rule.RuleContext
-
insertLogical
InternalFactHandle insertLogical(Object object, boolean dynamic)
-
insertLogical
InternalFactHandle insertLogical(Object object, org.kie.api.internal.runtime.beliefs.Mode belief)
-
insertLogical
InternalFactHandle insertLogical(Object object, org.kie.api.internal.runtime.beliefs.Mode... beliefs)
-
cancelRemainingPreviousLogicalDependencies
void cancelRemainingPreviousLogicalDependencies()
-
getFactHandle
InternalFactHandle getFactHandle(Object object)
-
getFactHandle
InternalFactHandle getFactHandle(InternalFactHandle handle)
-
update
void update(org.kie.api.runtime.rule.FactHandle handle, Object newObject)
-
update
void update(org.kie.api.runtime.rule.FactHandle newObject)
-
update
void update(org.kie.api.runtime.rule.FactHandle newObject, BitMask mask, Class<?> modifiedClass)
-
update
void update(Object newObject)
-
retract
void retract(org.kie.api.runtime.rule.FactHandle handle)
Deprecated.Use delete
-
retract
void retract(Object handle)
Deprecated.Use delete
-
delete
void delete(Object handle)
-
delete
void delete(Object object, org.kie.api.runtime.rule.FactHandle.State fhState)
-
delete
void delete(org.kie.api.runtime.rule.FactHandle handle)
-
delete
void delete(org.kie.api.runtime.rule.FactHandle handle, org.kie.api.runtime.rule.FactHandle.State fhState)
-
get
Object get(Declaration declaration)
-
getRule
RuleImpl getRule()
- Specified by:
getRule
in interfaceorg.kie.api.runtime.rule.RuleContext
- Returns:
- - The rule name
-
getTuple
Tuple getTuple()
-
getMatch
Activation getMatch()
- Specified by:
getMatch
in interfaceorg.kie.api.runtime.rule.RuleContext
-
getWorkingMemory
WorkingMemory getWorkingMemory()
-
getEntryPoint
org.kie.api.runtime.rule.EntryPoint getEntryPoint(String id)
-
getChannel
org.kie.api.runtime.Channel getChannel(String id)
-
setFocus
void setFocus(String focus)
-
getDeclaration
Declaration getDeclaration(String identifier)
-
halt
void halt()
-
getContext
<T> T getContext(Class<T> contextClass)
-
don
<T,K> T don(K core, Class<T> trait, boolean logical)
-
don
<T,K> T don(K core, Class<T> trait, org.kie.api.internal.runtime.beliefs.Mode... modes)
-
don
<T,K> T don(K core, Class<T> trait)
-
don
<T,K> T don(K core, Collection<Class<? extends Thing>> trait, boolean logical)
-
don
<T,K> T don(K core, Collection<Class<? extends Thing>> trait, org.kie.api.internal.runtime.beliefs.Mode... modes)
-
don
<T,K> T don(K core, Collection<Class<? extends Thing>> trait)
-
shed
<T,K,X extends TraitableBean> Thing<K> shed(TraitableBean<K,X> core, Class<T> trait)
-
bolster
InternalFactHandle bolster(Object object)
-
bolster
InternalFactHandle bolster(Object object, Object value)
-
getProjectClassLoader
ClassLoader getProjectClassLoader()
-
run
default void run(String ruleUnitName)
-
run
default void run(Object ruleUnit)
-
run
default void run(Class<?> ruleUnitClass)
-
guard
default void guard(Object ruleUnit)
-
guard
default void guard(Class<?> ruleUnitClass)
-
-