Overview of Creating Extension Rules

Use the Groovy scripting language to write your own, custom extension rule.

Consider an example where you add the zCZ_CAR4DRSDN model to a new workspace. You add features and an extension rule that allows your user to specify the list price and the discount on the car, then automatically adjust the sale price according to the discount that the user enters.

automatically adjust the sale price according to the discount that the user enters.

Here are some of the important tasks that you typically do.

Step Task Description
1 Define a method. Define a Groovy method that controls your rule's logic. For example, create a method named applyDiscount, and include arguments that you will use to store pricing details, such as p_listPrice and p_discount.
2 Define the rule's logic. Specify the calculations that your rule will do, such as using the list price and the discount to calculate the sale price, and specify the nodes in the model that are part of the calculation.
3 Bind an event to your method.

Create a relationship between your Groovy method and an event. Oracle Configurator will call the method when that event happens.

For example, if your user changes the value in a decimal node, such as the discount, then Configurator raises the postValueChange event, and will use that event to call the applyDiscount method that applies the discount.

You must bind at least one event to your rule.

4 Bind the method's arguments to a node.

Create a relationship between each argument and the source that Configurator will use to get the argument’s value.

For example, the applyDiscount discount method includes the p_discount argument. You bind p_discount to the node where the user enters the discount.

5 Test. Test your rule in a simulated run time environment before you release the rule.

This is a simple example that you can examine to help understand how to create an extension rule. Users don't typically specify pricing. Configurator usually gets pricing details from Oracle Pricing.