Configuring Sun Master Indexes (Repository)

Defining Custom Field Validations for the Master Index (Repository)

By default, the Field Validation file defines one validation rule named “validate-local-id”. This rule defines certain validations to perform against local ID and system fields before they are entered into the database. The local ID validator verifies that the system code is valid, the local ID format is correct, the local ID is the correct length, and that neither field is null.

You can define additional validations for your data by creating the Java class and appropriate methods. Create the custom class using the Custom Plug-ins module of the master index project so you can include the custom validation rule in the master index application code package. The custom validation classes must implement com.stc.eindex.objects.validation.ObjectValidator. The exception thrown is com.stc.eindex.objects.validation.exception.ValidationException.

ProcedureTo Implement a Validation Rule

  1. Create the custom validation rules using the Custom Plug-in feature.

  2. In the Projects window, expand the Configuration node in the project you want to modify, and then double-click the Field Validation file.

    The file opens in the NetBeans XML editor.

  3. Create a new rule element in the rules element.

  4. In the new rule element, create the following attributes:

    • name – A unique name for the validation rule.

    • object-name – The name of the master index Java class that defines the object to which the validation rule is applied, such as SystemObject or Parent_NameObject (where Parent_Name is the name of the parent object in the object definition)

    • class – The complete path of the Java class to call for the validation rule.

      For example:


      <ValidationConfig module-name="Validation" parser-class= 
       "com.stc.eindex.configurator.impl.validation.ValidationConfiguration"
         <rules>
            <rule name="validate-auxiliary-id" object-name="PersonObject"
             class="com.stc.eindex.user.AuxiliaryId"/>
            <rule name="validate-birth-date" object-name="PersonObject"
             class="com.stc.eindex.user.BirthDate"/>
         </rules>
      </ValidationConfig>
  5. Save and close the file.