The previous chapter, Creating Rules for Targeting Content, described how to write a rule that compares properties of a user profile to a constant, or to properties of other objects, as in the following rule:
<rule op=includes name="Rubber analysts">
<valueof bean="/atg/userprofiling/Profile.sectorsCovered">
<valueof constant="rubber">
</rule>
Writing a rule in that style requires you to provide the full Nucleus path of the user profile or other source object. You can simplify your references to profiles or other source objects by using a TargetingSourceMap
service. The TargetingSourceMap
maps source names to their Nucleus paths.
The Personalization module uses, by default, a TargetingSourceMap
service that maps user profiles to the name “Profile.” Each of the targeting servlet beans described in the next chapter uses this /atg/targeting/TargetingSourceMap
by default:
$class=atg.targeting.TargetingSourceMap sourceMap+=Profile=/atg/userprofiling/Profile
The sourceMap
property is a comma-delimited list of names for source objects, with the Nucleus path of each. Now, your rule set can refer to the name property of a profile with <valueof bean="Profile.name">
instead of <valueof bean="/atg/userprofiling/Profile.name">
.
The Personalization module also uses another TargetingSourceMap
service to make available short names for the Request
object and the CurrentDate
object, at /atg/targeting/TargetingSourceMap
:
$class=atg.targeting.TargetingSourceMap sourceMap+=\ Request=/OriginatingRequest,\ Today=/atg/dynamo/service/CurrentDate