com.ibm.policy.manager
Class MapRequestContext

java.lang.Object
  extended by com.ibm.policy.manager.MapRequestContext
All Implemented Interfaces:
RuleContext

public class MapRequestContext
extends java.lang.Object
implements RuleContext

Public implementation of RuleContext representing a generic Map Request. This is used to set up data for the underlying rule engine. This Map represents KEYWORD/OBJECT pairs that are understood by the rule engine. The OBJECT is the entity that is used to provide the data that the RULE (represented by the KEYWORD) requires.
There is also an Id that will be used as the basis for caching this instance. The cache will search for this Id, and if it exists, it will return the results that are cached. If the Id is different on every invocation of the policy call, then the cached value will never be used.

Since:
6.01

Field Summary
static java.lang.String UNIQUE_TARGET_IDENTIFIER
           
 
Constructor Summary
MapRequestContext(java.util.Map<java.lang.String,? extends java.lang.Object> map)
          Add a Rule context based on an Mapping of KEYWORD of rule with OBJECT .
 
Method Summary
 java.util.Collection getContext()
          Retrieve the collection of rules engine objects in this RuleContext.
 java.lang.String getId()
          Retrieve a unique identifier for the session if one is available.
 java.lang.String setId(java.lang.String value)
          Set the unique identifier after the fact.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNIQUE_TARGET_IDENTIFIER

public static final java.lang.String UNIQUE_TARGET_IDENTIFIER
See Also:
Constant Field Values
Constructor Detail

MapRequestContext

public MapRequestContext(java.util.Map<java.lang.String,? extends java.lang.Object> map)
Add a Rule context based on an Mapping of KEYWORD of rule with OBJECT .

Parameters:
Map - map to be used
Method Detail

getContext

public java.util.Collection getContext()
Description copied from interface: RuleContext
Retrieve the collection of rules engine objects in this RuleContext. The rules engine must be aware of the contents of the returned collection.

An example implementation class named FooRuleContext, contains a single attribute named foo with a value of either:

. The rules engine is configured to return a classification based on the value of the foo attribute.

Specified by:
getContext in interface RuleContext
Returns:
Collection of rule objects to be used in the execution of a rule

getId

public java.lang.String getId()
Description copied from interface: RuleContext
Retrieve a unique identifier for the session if one is available. Return null if not available.

Specified by:
getId in interface RuleContext
Returns:
the _uniqueTargetIdentifier_ that was passed in with the Map or that was set later, if one is available, and null otherwise.

setId

public java.lang.String setId(java.lang.String value)
Set the unique identifier after the fact. Returns the old value of the unique identifier. Not part of RequestContext interface, just used for this class.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object