Learning business key validation framework components
A number of framework components are bundled with InfoSphere® MDM. These components can help you to customize business key validation for different groups.
The following class diagram shows the classes that make up the business key validation framework.
- com.ibm.mdm.common.validator.CustomBusinessKeyValidator
- This interface provides the methods required to create a custom
business key validator:
- validateBusinessKey() – This method encodes the logic
that validates business keys based on the type of validation (add
or update).
- Parameters:
- com.ibm.mdm.common.validator.BusinessKeyValidationContext – This context object contains all of the necessary details to validate a business key.
- Return type: DWLStatus
- Parameters:
- validateBusinessKey() – This method encodes the logic
that validates business keys based on the type of validation (add
or update).
- com.ibm.mdm.common.validator.BusinessKeyValidator
- This class encodes the logic for constructing the dynamic SQL
to verify duplicates of business keys. The methods in this class are
used during add or update transactions:
- validateBusinessKey() – This method encodes the logic
that validates business keys based on the type of validation (add
or update).
- Parameters:
- com.ibm.mdm.common.validator.BusinessKeyValidationContext – This context object contains all of the necessary details to validate a business key.
- Return type: DWLStatus
- Parameters:
- setCustomValidator() – Use this method to add custom validators
to alter validation for any groups.
- Parameters:
- appName (String) – The name of the application for which the business key validation will be customized.
- groupName (String) – The name of the group for which the business key validation will be customized.
- validationType (String) – The type of validation for which the custom validation should be applied.
- customValidator (String) – The fully qualified name of the class that implements the custom validation code. This class should implement the CustomBusinessKeyValidator interface.
- Return type: void
- Parameters:
- setCustomValidators() – Override this method to set custom
validators for the groups that require custom validation..
- Return type: void
- validateBusinessKey() – This method encodes the logic
that validates business keys based on the type of validation (add
or update).
- com.ibm.mdm.common.validator.BusinessKeyValidationContext
- This class holds all the necessary details for validating a business
key. This class also provides a facility to hold any additional information
that will be required for custom validations, as name/value pairs.
This class contains the following methods:
- getBusinessObject() – This method returns an instance
of DWLCommon for the business object that is being validated.
- Return type: DWLCommon
- getValidationType() – This method returns the type of validation
performed on the business object. The type of validation indicates
whether the business key validation will be done for add or update
transactions. The types are defined as enumeration in BusinessKeyValidationType.
- Return type: BusinessKeyValidationType
- getStatus() – This method returns the DWLStatus object.
This object holds error details in case of validation failure.
- Return type: DWLStatus
- getErrorReasonCode() – This method enables you to get
the error reason code that will be used in case of validation failure.
- Return type: long
- setErrorReasonCode() – This method enables you to set
the error reason code that will be used in case of validation failure.
- Parameters:
- errorReasonCode (Long) – A valid error reason code. If there is no entry in the ERRORREASON table corresponding to this code, InfoSphere MDM will use the default error reason code for business key validation.
- Return type: void
- Parameters:
- setProperty() – This method enables you to set any object
into the context. This method should be used in custom validations
where additional details are required.
- Parameters:
- propKey (String) – The key to the property being set into context.
- propVal (Object) – The value of the property being set into context.
- Return type: DWLStatus
- Parameters:
- getProperty() – This method returns the value of a given
property. If there is no property matching the key, the return is
null.
- Parameters:
- propKey (String) – The key to the property.
- Return type: – The value of the property (Object),
- Parameters:
- getGroupName() – This method returns the name of the group
for which the validation is being performed.
- Return type: The name of the group (String).
- getApplicationName() – This method returns the name of
the application corresponding to the group for which the validation
is being performed.
- Return type: The name of the application (String).
- setSkipValidation() – This method sets the context property
to indicate that the validation can be skipped.
- Parameters:
- skipValidationFlag (Boolean) – The value of the skip validation flag.
- Return type: void
- Parameters:
- isSkipValidation() – This method returns the value of
the property that indicates whether the validation can be skipped.
- Return type: The value of the skip validation flag (Boolean).
- setSkipValidationOnNullBusinessKeyAttributes() – This
method sets the context property to indicate whether validation can
be skipped if the business key attributes are null or empty.
- Parameters:
- skipValidationFlag (Boolean) – The value of the skip validation flag.
- Return type: void
- Parameters:
- isSkipValidationOnNullBusinessKeyAttributes() – This method
returns the value of the property that indicates whether the validation
can be skipped if the business key attributes are null or empty.
- Return type: The value of the skip validation flag (Boolean).
- getBusinessObject() – This method returns an instance
of DWLCommon for the business object that is being validated.
- com.ibm.mdm.common.validator.BusinessKeyValidatorFactory
- This class is a factory implementation to provide an instance
of BusinessKeyValidator. This class contains the following method:
- static getInstance() – This method returns an object of
the BusinessKeyValidator that is configured through the related InfoSphere MDM configuration
element. Note: For information on configuring business key validation, see Overview of business key validation configuration elements.
- Return type: BusinessKeyValidator
- static getInstance() – This method returns an object of
the BusinessKeyValidator that is configured through the related InfoSphere MDM configuration
element.
- com.ibm.mdm.common.validator.BusinessKeyValidationType
- This class is an enumeration that provides the following validation
types:
- ADD – Indicates that business key validation should be done for add transactions.
- UPDATE – Indicates that business key validation should be done for update transactions.
- GENERAL – Indicates that common business key validation should be done for both add and update transactions.
- com.ibm.mdm.annotations.BusinessKeyValidationErrorReasonCodes
- This class is an annotation applicable to the business object
classes. This annotation specifies the error reason codes used by
the business key validation framework. Note: If a business object does not have this annotation, then it will use the default error reason codes in case of a business key validation failure.
This annotation has the following attributes:
- AddValidation – Indicates the error reason code that will be used in case of business key validation errors during an Add transaction.
- UpdateValidation – Indicates the error reason code that will be used in case of business key validation errors during an Update transaction.
For example:@BusinessKeyValidationErrorReasonCodes(AddValidation = 1234, UpdateValidation = 5678)
The following sequence diagram shows the control flow during business key validation: