Legacy platform

Defining abstract validation rules

An abstract validation rule does not have inputType, inputName and uri attributes.

These attributes are provided by the validation rule extending the abstract validation rule. You can define a validation rule as an abstract validation rule by setting the value of abstract attribute to true. For example,

<ValidationRules>
   <Rule id="abstract1" ruleType="Regex" abstract="true" maxLength="10"
         minLength="0" allowNull="false" >
      <Whitelist>
         <RegularExpression ref="regex1" />
      </Whitelist>
   </Rule>
   <Rule id="abstract2" ruleType="Java" impl="com.sterling.validation.testRule"
         abstract="true">
   </Rule> 
</ValidationRules>
Note: For JSON parameter values used in XAPI inputs in the Web UI Framework based applications, framework provides an abstract rule definition with id as uifwkimpl-json-xapi-input-param-value.
For all the inputs which are in JSON format and are being used in XAPI calls in the Web UI Framework based applications, you must extend the rule definition uifwkimpl-json-xapi-input-param-value. For example:
<Rule id="sampleRule1" extends="uifwkimpl-json-xapi-input-param-value"
inputType="HTTPParameterValue" inputName="getCategoriesList"/>

The abstract rule uifwkimpl-json-xapi-input-param-value is of type Java™.

Default JSON values used in the application have already been registered with validation rules. For example, the request parameters scControllerInput, scContorllerData and wizardData are the three primarily used JSON attributes in the application. For these the java validation rule is registered in the file uifwkimpl_validationrules.xml located in the <INSTALL_DIR>/repository/eardata/platform_afc_ui_impl/war/WEB-INF/validationrules directory.