站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

KnowledgeHelper (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.spi
Interface KnowledgeHelper

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultKnowledgeHelper

public interface KnowledgeHelper
extends 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 modifyObject 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.

Author:
bob mcwhirter , mark proctor

Method Summary
 void assertLogicalObject(Object object)
           
 void assertLogicalObject(Object object, boolean dynamic)
           
 void assertObject(Object object)
          Asserts an object, notice that it does not return the FactHandle
 void assertObject(Object object, boolean dynamic)
          Asserts an object specifying that it implement the onPropertyChange listener, notice that it does not return the FactHandle.
 void clearAgenda()
          Clears the agenda causing all existing Activations to fire ActivationCancelled events.
 void clearAgendaGroup(String group)
           
 Object get(Declaration declaration)
           
 Activation getActivation()
           
 Declaration getDeclaration(String identifier)
           
 AgendaGroup getFocus()
           
 List getObjects()
           
 List getObjects(Class objectClass)
          Retruns a List of Objects that match the given Class in the paremeter.
 QueryResults getQueryResults(String query)
           
 Rule getRule()
           
 Tuple getTuple()
           
 WorkingMemory getWorkingMemory()
           
 void modifyObject(FactHandle handle, Object newObject)
           
 void retractObject(FactHandle handle)
           
 void setFocus(AgendaGroup focus)
           
 void setFocus(String focus)
           
 

Method Detail

assertObject

void assertObject(Object object)
                  throws FactException
Asserts an object, notice that it does not return the FactHandle

Parameters:
object - - the object to be asserted
Throws:
FactException - - Exceptions can be thrown by conditions which are wrapped and returned as a FactException

assertObject

void assertObject(Object object,
                  boolean dynamic)
                  throws FactException
Asserts an object specifying that it implement the onPropertyChange listener, notice that it does not return the FactHandle.

Parameters:
object - - the object to be asserted
dynamic - - specifies the object implements onPropertyChangeListener
Throws:
FactException - - Exceptions can be thrown by conditions which are wrapped and returned as a FactException

assertLogicalObject

void assertLogicalObject(Object object)
                         throws FactException
Throws:
FactException

assertLogicalObject

void assertLogicalObject(Object object,
                         boolean dynamic)
                         throws FactException
Throws:
FactException

modifyObject

void modifyObject(FactHandle handle,
                  Object newObject)
                  throws FactException
Throws:
FactException

retractObject

void retractObject(FactHandle handle)
                   throws FactException
Throws:
FactException

get

Object get(Declaration declaration)

getRule

Rule getRule()
Returns:
- The rule name

getTuple

Tuple getTuple()

getActivation

Activation getActivation()

getWorkingMemory

WorkingMemory getWorkingMemory()

getObjects

List getObjects()
Returns:
- A List of the objects in the WorkingMemory

getObjects

List getObjects(Class objectClass)
Retruns a List of Objects that match the given Class in the paremeter.

Parameters:
objectClass - - The Class to filter by
Returns:
- All the Objects in the WorkingMemory that match the given Class filter

getQueryResults

QueryResults getQueryResults(String query)

clearAgenda

void clearAgenda()
Clears the agenda causing all existing Activations to fire ActivationCancelled events.


clearAgendaGroup

void clearAgendaGroup(String group)

getFocus

AgendaGroup getFocus()

setFocus

void setFocus(String focus)

setFocus

void setFocus(AgendaGroup focus)

getDeclaration

Declaration getDeclaration(String identifier)


Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.