To set up a RuleSetService for your rule set, create an atg.targeting.RuleSetService component. This component can reference a rules file, or it can itself include your targeting rules as a property. Give the component a name that helps you link it with the rules file. Suppose you have created a rules file that contains rules to target content for New England snowboarders called NewEnglandSnowboarders.rules in the directory <ATG10dir>/home/targeting/rulesets. Set up the Rule Set Service for this rules file by creating a component you could name NewEnglandSnowboardersRuleSet. A Rule Set Service component has the following properties:

rulesFilePath

If your Rule Set Service refers to a rules file, set this property to the file path of the rules file. This path can be an absolute path or a relative path starting from your <ATG10dir>/home directory.

ruleSet

If you want to include your rules as a property of the component, set this property to the value of your targeting rules. The syntax for rules defined in this property is the same as for rules defined in a rules file, except that you must indicate new lines with the backslash (\) character. (The backslash must be the last character in the line; additional spaces after the backslash will prevent the rule set from working properly.) For example:

ruleSet=<ruleset> \
           <accepts> \
            <rule op=and> \
             <rule op=eq name="Rubber sector"> \
               <valueof target="industry sector"> \
               <valueof constant="rubber"> \
             </rule> \
             <rule op=includes name="Rubber analysts"> \
               <valueof bean="Profile.sectorsCovered"> \
               <valueof constant="rubber"> \
             </rule> \
           </accepts> \
           <sortby> \
             <sortbyvalue value="company" dir=ascending> \
           </sortby> \
           </ruleset>

Do not use both the rulesFilePath property and the ruleSet property in the same Rule Set Service. If you want to combine rules set in your properties file with the ruleSet property with rules defined in a rules file, use the includes tag or the src attribute to incorporate the rules defined in the rules file into the rules defined in the ruleSet property.

When you create rules using the Business Control Center or the ACC, the system creates a Rule Set Service using the rulesets property to define the rule, rather than pointing to a separate rules file with the rulesFilePath property. Rule Set Service components created by the UIs are instances of atg.targeting.DynamicContentTargeter and are saved in the /atg/registry/RepositoryTargeters folder.

useTranslatedPath

This property is set to false by default. If you use the rulesFilePath property to specify a path to a rules file, and the path includes the system property atg.dynamo.root, as shown in the example below, you must set the useTranslatedPath property to true so that the path can be parsed correctly:

rulesFilePath={atg.dynamo.root}/...

For more information on using the atg.dynamo.root system property to access files from application module code, refer to the ATG Installation and Configuration Guide.

updatesEnabled

This property is set to true by default. This setting instructs the system to check the rules file for changes, at an interval set by the rulesFileCheckSeconds property.

rulesFileCheckSeconds

If the updatesEnabled property is set to true (as it is by default), this property sets the time interval after which to check whether the rules file has changed; if 0, the check will be performed on each request.

Example

Here is an example of a RuleSetService properties file for our NewEnglandSnowboarders.rules rules file.

$class=atg.targeting.RuleSetService

# Path of the rules file
rulesFilePath=targeting/rulesets/NewEnglandSnowboarders.rules

# Should we check whether the rules file has changed?
updatesEnabled=true

# Time interval after which to check whether the rules file has
# changed; if 0, the check will be performed on each request.
rulesFileCheckSeconds=0

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices