Sun Identity Manager Deployment Reference

Rules with Side Effects

Rules typically return a single value, but in some cases you may want a rule to return several values or to take an action other than returning a value. You can use the following XPRESS expressions in a rule to assign values to external variables:

The following example shows how the rule tests the value of external variable named department and assigns values to two other variables.


Example 4–15 Testing the department Variable and Assigning Other Variables


<Rule name=’Check Department’> 
   <switch> 
      <ref>global.department</ref> 
      <case> 
         <s>Engineering</s> 
         <block> 
            <setvar name=’global.location’> 
               <s>Building 1</s> 
            </setvar> 
            <setvar name=’global.mailServer’> 
               <s>mailserver.somecompany.com</s> 
            </setvar> 
         </block> 
      </case> 
      <case> 
         <s>Marketing</s> 
         <block> 
            <setvar name=’global.location’> 
               <s>Building 2</s> 
            </setvar> 
            <setvar name=’global.mailServer’> 
               <s>mailserver2.somecompany.com</s> 
            </setvar> 
         </block> 
      </case> 
   </switch> 
</Rule>

In the preceding example, the variables global.location and global.mailServer are both set according to the value of the variable department. In this case, the return value of the rule is ignored, and the rule is called only for its side effects.