Samples > Starter stores > Starter store enhancements > IBM Gift Center for the Madisons starter store > Work with the sample store pages > Create a custom business validation rule


IBM Gift Center for Madisons: Registering the new business validation rule

Register your new rule in the rule validator extension configuration file, wc-GiftList-RuleValidator-ext.xml. This file is provided for customization to map business validation rules in the GRREGRULE table to the correct validator class.

Do not modify the base rule validator configuration file, wc-GiftList-RuleValidator.xml. This file registers all the existing Gift Center business validation rules, and any changes you make to this file can be overwritten with WebSphere Commerce server updates.


Procedure

  1. Edit the wc-GiftList-RuleValidator-ext.xml file at this path:

    WC_EAR/xml/config/com.ibm.commerce.giftcenter/wc-GiftList-RuleValidator-ext.xml.

  2. Beneath the <Rules> element, add a mapping that uses the same syntax as the following example:

    <Rule name="7001"
          validatorImpl="com.ibm.commerce.sample.giftcenter.rules.validation.ExtExceedMaxRegistriesPerEventRuleValidator"
          validateEvent="create" />
    

    Where:

    name

    The number representing the name of this rule. This number must match the NAME value for this rule that you added to the GRREGRULE table.

    validatorImpl

    The full path of the validator class you created for the rule.

    validateEvent

    The action or actions on which this validation occurs, according to the logic in the validator class. Valid actions are:

    • create

    • update

    • delete

    To specify more than one action, use this syntax:

    validateEvent="create, update"
    

  3. Save and close the file.

  4. Build the workspace.

  5. Restart the WebSphere Commerce test server to make the new configuration available.


What to do next

  1. Test the customization on the gift registry storefront.

  2. Deploy your changes to the production environment.


Previous topic: IBM Gift Center for Madisons: Creating a new validator class for the business validation rule


+

Search Tips   |   Advanced Search