Sun Identity Manager Deployment Reference

What is a Rule?

A rule is an object in the Identity Manager repository that contains a function written in the XPRESS, XML Object, or JavaScript languages. Within Identity Manager, rules provide a mechanism for storing and executing frequently used programming logic or static variables for reuse. Rules are semantically similar to a programming subroutine or function. A rule can take input parameters, execute some logic, and return a value to a caller.

You can pass arguments to a rule to control its behavior, and a rule can reference and modify variables maintained by a form or workflow.

Rules are primarily referenced within forms and workflows, but you can also reference rules in other user-data related areas, such as


Note –

Because the XPRESS and XML Object languages are both written in XML, the XPRESS and XML Object code examples used in this chapter are similar.

For information about writing rules in JavaScript, see Writing Rules in JavaScript.


The following example shows how to use the <Rule> element to define a basic rule expression, in which the rule definition name is getApprover, the rule argument name is department, the argument’s default value is Tampa, and the rule body returns the Sales Manager or HR Manager string values.


Example 4–1 Example XML Rule


<Rule name=’getApprover’>
   <Comments> This rule determines the appropriate approver for a 
              particular department.</Comment> 
   <RuleArgument name=’department’/> 
   <RuleArgument name=’location’ value=’Tampa’/>
   <cond> 
      <eq><ref>department</ref><String>sales</String></eq>   
      <cond> 
         <eq><ref>location</ref><String>Tampa</String></eq> 
         <String>Tampa Sales Manager</String> 
         <String>Sales Manager</String> 
      </cond> 
      <String>HR Manager</String> 
   </cond> 
   <MemberObjectGroups> ObjectRef type=’ObjectGroup’ name=ExampleChoc’/> 
   </MemberObjectGroups> 
</Rule>

When defining a rule, use the <Rule> element with an uppercase R as in <Rule name=rulename>. When calling a rule, use the XPRESS <rule> element with lowercase r, as in <rule name=rulename>.