Oracle Waveset 8.1.1 Deployment Reference

Using Rule Argument Declarations

Best Practice:

You are not required to include explicit declarations for all arguments that can be referenced by a rule within the rule definition, but it is considered a best practice to do so.

Using argument declarations offers the following advantages:

For example, you could rewrite the generateEmail rule as follows:


Example 4–22 Rewriting the generateEmail Rule


<Rule name=’generateEmail’ localScope=’true’> 
   <RuleArgument name=’firstname’> 
      <Comments>The first name of a user</Comments> 
   </RuleArgument> 
   <RuleArgument name=’lastname’> 
      <Comments>The last name of a user</Comments> 
   </RuleArgument> 
   <RuleArgument name=’domain’ value=’example.com’> 
      <Comments>The corporate domain name</Comments> 
   </RuleArgument> 
   <concat> 
      <ref>firstname</ref> 
      <s>.</s> 
      <ref>lastname</ref> 
      <s>@</s> 
      <ref>domain</ref> 
   </concat> 
</Rule>

The Comments element can contain any amount of text that might be useful to someone examining the rule.

In this example, the rule was modified to define another argument named domain, which was given a default value of example.com. This rule uses the default value unless the caller passes an explicit argument named domain.

The next example shows a call that produces the john.smith@example.com string:


Example 4–23 Producing john.smith@example.com String


<rule name=’generateEmail’> 
   <argument name=’firstname’ value=’john’/> 
   <argument name=’lastname’ value=’smith’/> 
</rule>

The next example shows a call that produces the john.smith@yourcompany.com string:


Example 4–24 Producing john.smith@yourcompany.com String


<rule name=’generateEmail’> 
   <argument name=’firstname’ value=’john’/> 
   <argument name=’lastname’ value=’smith’/> 
   <argument name=’domain’ value=’yourcompany.com’/> 
</rule>

This example shows a call that produces the john.smith@ string:


Example 4–25 Producing john.smith@ String


<rule name=’generateEmail’> 
   <argument name=’firstname’ value=’john’/> 
   <argument name=’lastname’ value=’smith’/> 
   <argument name=’domain’/> 
</rule>

In the previous example, a null value is passed for the domain argument, but the default value is not used. If you specify an explicit argument in the call, that value is used even if it is null.