PersonalDataObfuscator

PersonalDataObfuscator is the parent class for the obfuscator classes. It is a general class that obfuscates the fields for any entity. You are required to extend this class or one of its subclasses when implementing obfuscation for entities that do not have obfuscator classes defined.

PersonalDataObfuscator handles setting the obfuscation for effdated and non-effdated fields. If you have tagged the entity fields PersonalData with value ObfuscateUnique, and there is no need to do any special preprocessing of the fields, you can use this class.

The following methods are provided:

isObfuscated
Checks the field ObfuscatedInternal and returns true or false depending on the value.
obfuscate
Finds all the columns that are marked for obfuscation on this object.
  • If the object is an instance of EffDated then the method obfuscates all versions of that column on the EffDated object.
  • Otherwise, the method sets the field value with the obfuscatedValue.
  • Before obfuscating the column, the method calls preProcessPersonalDataFieldBeforeObfuscating to do any preprocessing.
    • If the column is marked PersonalData with a value of ObfuscateDefault, the method sets the value to either null or the default value.
    • If the column is marked PersonalData with a value of something other than ObfuscateDefault, the method calls getObfuscatedValueForPersonalDataField. That method passes the tag value, and you must provide the object that the method uses to obfuscate the field.
  • At the end, the method sets the ObfuscateInternal column to true by using ObfuscatablePublicMethod.setObfuscated.
obfuscateSimple
Works the same as obfuscate, but for objects that are not EffDated.

If you want to do preprocessing before obfuscation, you can extend PersonalDataObfuscator or a subclass of this class and override the beforeObfuscate method. If you want to change the value of the personal data field before obfuscation, you can override getObfuscatedValueForPersonalDataField.

The method getObfuscatedValueForPersonalDataField(Obfuscatable bean, IEntityPropertyInfo personalDataField, String tagValue) defines default obfuscation behavior for fields that are tagged OfuscateUnique and ObfuscateDefault.

See also