public abstract class AbstractUserPropertyValidator extends java.lang.Object implements OfflineDBValidationManager.Validator
Subclasses should be registered in the offline-database-hook.
| Constructor and Description |
|---|
AbstractUserPropertyValidator() |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<java.lang.String> |
getPropertyNames(OfflineDBObjectProvider pro,
DBObject dbo)
Subclasses can return a list of user defined property names that they
wish to validate for the given DBObject.
|
void |
validateObject(OfflineDBObjectProvider pro,
DBObject original,
DBObject update,
java.lang.String property)
Validates the given object change for the given provider.
|
abstract void |
validateUserPropertyValue(OfflineDBObjectProvider pro,
DBObject original,
DBObject update,
java.lang.String userPropertyName,
java.lang.String userPropertyValue)
Implementations of this method will be called to allow validation of
User Property Values.
|
public final void validateObject(OfflineDBObjectProvider pro, DBObject original, DBObject update, java.lang.String property) throws ValidationException
OfflineDBValidationManager.ValidatorvalidateObject in interface OfflineDBValidationManager.Validatorpro - the offline database the validation is fororiginal - the original object if this is an update, or null if it
is a createupdate - the object definition to be validated - i.e. the new
version for an update, or the new object that's being created.property - the specific property to validate, or null if all
properties are the be validated.ValidationExceptionprotected java.util.List<java.lang.String> getPropertyNames(OfflineDBObjectProvider pro, DBObject dbo)
Returning null, or an empty list (the default), will cause validateUserPropertyValue to be called for all User Defined Properties applicable to the given DBObject.
pro - The Offline Database Providerdbo - The object whose properties are being validatedpublic abstract void validateUserPropertyValue(OfflineDBObjectProvider pro, DBObject original, DBObject update, java.lang.String userPropertyName, java.lang.String userPropertyValue) throws ValidationException
pro - The Offline Database Provideroriginal - The original object if an update is being peformed or null
if a new object is being created.update - The updated (or new) object whose properties are being validateduserPropertyName - The name of the User PropertyuserPropertyValue - The value of the user PropertyValidationException