Product Documentation
Abstract
The "Configuring validation rules" section is missing from Administering IBM Atlas Policy Suite, Version 6.0.3.
Content
The "Configuring validation rules" section belongs here:
Chapter 4. Importing data into IBM Atlas Policy Suite
- Importing data into IBM Atlas Policy Suite by using Atlas Extensions
- Regularly pulling data into the Atlas database
- Configuring validation rules
Configuring validation rules
You can refine and add the rules that Atlas Extensions uses to validate the imported data.
About this task
Atlas Extensions validates the data that it ingests by comparing the data to the validation rules in the /ATLAS/Properties/validation.xml file. For example, the default rules ensure that required values are supplied, email addresses are in the correct format, and numeric values are in the correct range. If a rule is violated, a message is printed in the Atlas Extensions console.
In a fresh deployment, the validation.xml file contains the default validation rules that are set by IBM® Atlas Policy Suite. You can refine the rules and add your own by editing the file. Do not change or remove the default rules. After you modify the file, you must restart Atlas Extensions.
File Layout and Rule Format
The form of the validation.xml file and the validation rules themselves are written
in the Spring Module’s Valang language. The full specification for the language can
be found here: http://www.springbyexample.org/examples/spring-modules-validation-module.html
The validation.xml file is divided into three sections, one each for the three types
of data. The rules for a data type are listed within a class element. The data type is
embedded in the name attribute:
<?xml version="1.0" encoding="ISO-8859-1"?>
<validation xmlns="http://www.springmodules.org/validation/bean"
...xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
...xsi:schemaLocation="http://www.springmodules.org/validation/bean
http://www.springmodules.org/validation/bean/validation.xsd">
...<class name="com.secretseal.policyatlas.dto.LegalMatterStagingDTO">
...... <!-- Matter validation rules -->
...</class>
...<class name="com.secretseal.policyatlas.dto.PersonStagingExDTO">
...... <!-- Person validation rules -->
...</class>
...<class name="com.secretseal.policyatlas.dto.OrgUnitStagingDTO">
...... <!-- Organization validation rules -->
...</class>
</validation>
The rules for a particular column are defined in a property element within the
class element. The column is named by the name attribute:
<class name="com.secretseal.policyatlas.dto.PersonStagingExDTO">
- ...
<property name="email" >
- <not-null message="email cannot be NULL" />
<email message="Invalid Email id" apply-if="email IS NOT NULL" />
...
Each rule is expressed in its own element. All rule elements have three common
components:
| Component | Required | Meaning |
| element name | Yes | Specifies the type of rule. The two rules shown above, not-null and email, mean that the Email column in the Person table can’t be empty, and it must be formatted as an email address. The specifications for all the rules are given in the next section. |
| message attribute | No | The error message that’s displayed in the Atlas Extensions Console if the rule is violated. You must escape all occurrences of double-quotes within the attribute’s value; for example: message="The \"LoginID\" column must not be empty." |
| apply-if attribute | No | A Boolean expression that gives the conditions in which the rule is applied. The full list of operators that you can use is given in the Spring documentation. For the purposes of data validation, the condition is typically a test of whether a column contains a value: applyif=” ColumnName IS NOT NULL” |
In addition to these common components, some of the rules have their own sets of
attributes. These attributes are described in the rule specifications, below.
Rule Specifications
The sections below describe the Spring validation rules that are most commonly
used in the validation.xml file. Each rule description is followed by an example.
not-null
Specifies that the column must hold a value.
Example:
<not-null message="email cannot be NULL" />
not-blank
Specifies that a string value must contain printable characters.
Example:
<not-blank message="Matter ID cannot be blank."
apply-if="matterID IS NOT NULL" />
Specifies that the column must hold an email address that’s formatted thus:
Example:
username@company.suffix
The rule only tests the form of the email value; it doesn’t check whether the
address actually exists.
Example:
<email message="Invalid Email address" apply-if="email IS NOT NULL" />
length
Specifies that the column must hold a string whose length is within the range
specified by the min and max attributes.
| Attribute | Required | Data Type | Meaning |
| min | At least one of the attributes must be specified. | Nonnegative integer | The minimum and maximum number of characters (inclusive) that the string cancontain. If min isn’t specified, the minimum is 0; if max isn’t specified, themaximum is unbounded. |
| max |
Example:
<length min=6 max=12 message="Login must be between 6 and 12 characters
- in length" apply-if="login IS NOT NULL" />
not-empty
Specifies that a list must contain at least one element.
Example:
<not-empty message="List cannot be empty" />
size
Specifies that the number of elements in a list must be within the range specified
by the min and max attributes.
| Attribute | Required | Data Type | Meaning |
| min | At least one of the attributes must be specified. | Nonnegative integer | The minimum and maximum number ofelements (inclusive) that the list can contain. If min isn’tspecified, the minimum is 0; if max isn’t specified, the maximum is unbounded. |
| max |
Example:
- <size min="1" max="5" message="CustomField1 must contain between 1 and 5
- elements." />
Specifies that a numeric value or string must be within the range specified by the
min and max attributes.
| Attribute | Required | Data Type | Meaning |
| min | At least one of the attributes must be specified. | Number or string | The minimum andmaximum value (inclusive) of the number or string. Strings are compared alphabetically. If min isn’t specified, the minimum is 0; if max isn’t specified, the maximum is unbounded. |
| max |
Example:
- <size min="100" message="CustomField2 may not be less than 100" />
regexp
Specifies that a string must match the regular expression given by the expression
attribute.
| Attribute | Required | Data Type | Meaning |
| expression | Yes | String | Specifies the regular expression that the string must match. |
Example:
- <regexp expression= "^(\s*)([\S]+[\s]*[\S]*[\s]*[\S]*)(\s*)$"
- message="firstName is Invalid" />
expression
Specifies that the value must pass a conditional statement.
| Attribute | Required | Data Type | Meaning |
| condition | Yes | String | Specifies the condition that the value must pass. For IBM Atlas Policy Suite data, this is typically a test that determines if the value is within agiven set, as shown in the example. |
Example:
- <expression condition="interviewRequired IN ’Y’, ’N’"
- message="InterviewRequired can be only ’Y’ or ’N’"
apply-if="interviewRequired IS NOT NULL" />
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
swg27042040