public class RuleSetEvaluator extends GenericService
ruleSetService
property. The testTarget
method can be used to test if a specific target object satisfies
the rules.
For example, suppose that we use a RuleSetService
configured with the following rule set, which is meant to describe
a subset of the user population:
<ruleset>The
<accepts>
<rule op=eq>
<valueof target="gender">
<valueof constant="male">
</rule>
<rule op=lt>
<valueof target="age">
<valueof constant="30">
</rule>
</accepts>
</ruleset>
testTarget
method can then be used to test if
various users are males under the age of 30. The target object
tested against can be any bean which has the properties occuring in
the target
expressions in the rules - in this case,
"gender" and "age." Typically, the target object will represent a
DPS user, and will be either a
atg.userprofiling.Profile
or a
atg.repository.RepositoryItem
.
The optional sourceMap
property, if provided, is
used to resolve any bean
expressions in the rules. If
no such expressions occur in the rules, this property can be left
null.
RuleSetService
,
TargetingSourceMap
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
RuleSetEvaluator() |
Modifier and Type | Method and Description |
---|---|
atg.targeting.RuleSetService |
getRuleSetService()
Returns the RuleSetService containing the rules to be evaluated.
|
TargetingSourceMap |
getSourceMap()
Returns the TargetingSourceMap to use when evaluating rules.
|
void |
setRuleSetService(atg.targeting.RuleSetService pRuleSetService)
Sets the RuleSetService containing the rules to be evaluated.
|
void |
setSourceMap(TargetingSourceMap pSourceMap)
Sets the TargetingSourceMap to use when evaluating rules.
|
boolean |
testTarget(java.lang.Object pTarget)
Evaluates the rules specified via the
ruleSetService
property against the target object. |
boolean |
testTarget(java.lang.Object pTarget,
NameResolver pNameResolver)
Evaluates the rules specified via the
ruleSetService
property against the target object. |
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public atg.targeting.RuleSetService getRuleSetService()
public void setRuleSetService(atg.targeting.RuleSetService pRuleSetService)
public TargetingSourceMap getSourceMap()
public void setSourceMap(TargetingSourceMap pSourceMap)
public boolean testTarget(java.lang.Object pTarget) throws atg.targeting.rules.RuleSetException
ruleSetService
property against the target object. Returns true if the target
object satisfies the rules, false otherwise.atg.targeting.rules.RuleSetException
- if an error is encountered while
evaluating the rulespublic boolean testTarget(java.lang.Object pTarget, NameResolver pNameResolver) throws atg.targeting.rules.RuleSetException
ruleSetService
property against the target object. Returns true if the target
object satisfies the rules, false otherwise.pTarget
- pNameResolver
- name resolver to use if source map does not
specify oneatg.targeting.rules.RuleSetException
- if an error is encountered while
evaluating the rules