Outreach Campaign Rulesets

Outreach is built on top of Advisor infrastructure, and the CoreCitizenCampaignRuleset which all Outreach campaigns should extend in turn inherits from the CoreAdvisorRuleset. The CoreCitizenCampaignRuleset is located at /EJBServer/components/citizenworkspace/CREOLE_Rule_Sets.

The CoreCitizenCampaignRuleset defines two rule classes that are used to drive Outreach campaigns:

CitizenCampaignAdmin rule class

This is a CER rules representation of a CitizenCampaign administration record. The name, expiry date time and image reference for a campaign are propagated. A rule object of this class exists for each active Outreach campaign in the system. These are managed internally by the Outreach infrastructure.

AbstractCampaignAdviceItem rule class

This class extends AbstractAdviceItem (see Advisor documentation). This is the class that concrete Outreach campaign rule classes must extend. Concrete Outreach campaign rules classes must specify the following attributes that are inherited form this rule class:

The AbstractCampaignAdviceItem class sets the "showAdvice" attribute of its parent based on whether a CitizenCampaignAdmin rule object exists for the campaign in question (i.e. is the campaign active in Administration) and based on the value of the "campaignShowAdvice" attribute.

By default, the expiry date time of a campaign is taken from the Outreach campaign administration record. This allows administrators to configure the expiry of campaigns. However, it is also possible to determine the expiry date time based on business logic or other rules if they so wish, by overriding the "expiryDateTime" attribute of the AbstractCampaignAdviceItem class in their child implementation of this class.

Concrete campaign rule classes must also declare a class that extends the Advisor AbstractAdviceContext. Please see the Advisor documentation and the following sample campaign rule set for more information.

<RuleSet name="SampleCampaignRuleSet">
 
 <!-- This class is infrastructure used by Advisor, 
   please refer to the Advisor documentation for more
   information. -->
         
 <Class extends="AbstractAdviceContext" 
   extendsRuleSet="CoreAdvisorRuleSet" 
     name="SampleCampaignContext">
 
   <!-- populated by advisor propagator -->
   <Attribute name="concernRoleID">
     <type>
       <ruleclass name="NumberParameter" 
         ruleset="CoreAdvisorRuleSet"/>
     </type>
     <derivation>
       <specified/>
     </derivation>
   </Attribute>
 
   <!-- populated by advisor propagator -->
   <Attribute name="adviceContextID">
     <type>
       <javaclass name="Number"/>
     </type>
     <derivation>
       <specified/>
     </derivation>
   </Attribute>
 
   <Attribute name="advice">
     <type>
       <javaclass name="List">
         <ruleclass name="AbstractCampaignAdviceItem" 
           ruleset="CoreCitizenCampaignRuleset"/>
       </javaclass>
     </type>
     <derivation>
       <fixedlist>
         <listof>
           <ruleclass name="AbstractCampaignAdviceItem" 
             ruleset="CoreCitizenCampaignRuleset"/>
         </listof>
         <members>
         <!-- This list of members must include the custom rule  
                 class that extends AbstractCampaignAdviceItem -->
           <create ruleclass="SampleCampaign">
             <this/>
           </create>
         </members>
       </fixedlist>
     </derivation>
   </Attribute>
 </Class>
 
 <!-- Concrete Campaign / Advisor class that extends 
         AbstractCampaignAdviceItem -->
 <Class extends="AbstractCampaignAdviceItem" 
   extendsRuleSet="CoreCitizenCampaignRuleset" 
     name="SampleCampaign">
 
   <!-- initialise the Advisor context. Please see Advisor  
           documentation for more information -->
   <Initialization>
     <Attribute name="sampleCampaignContext">
       <type>
         <ruleclass name="SampleCampaignContext"/>
       </type>
     </Attribute>
   </Initialization>
 
   <!-- This is a reference to the campaign text stored in the
           resource store. Please see the Advisor documentation
           for more information. -->
   <Attribute name="adviceText">
     <type>
       <javaclass name="String"/>
     </type>
     <derivation>
       <String value="propertyName"/>
     </derivation>
   </Attribute>
 
   <!-- This is a reference to the advice context ID. 
        Please see the Advisor documentation for more 
        information. -->
   <Attribute name="adviceContext">
     <type>
       <javaclass name="Number"/>
     </type>
     <derivation>
       <reference attribute="adviceContextID">
         <reference attribute="sampleCampaignContext"/>
       </reference>
     </derivation>
   </Attribute>
 
   <!-- This is used by the parent abstract class to read the
        campaign rule object. This name must be identical to
        the name given to the Outreach campaign in
        Administration -->
   <Attribute name="citizenCampaignName">
     <type>
       <javaclass name="String"/>
     </type>
     <derivation>
       <String value="SampleCampaign"/>
     </derivation>
   </Attribute>
 
   <!-- Whether or not to display the campaign for the given  
           participant (provided the campaign is Active) -->
   <Attribute name="campaignShowAdvice">
     <type>
       <javaclass name="Boolean"/>
     </type>
     <derivation>
       <!-- business logic for campaign goes here. -->
       <true/>
     </derivation>
   </Attribute>
 </Class>
</RuleSet>