PersonalDataObfuscator

PersonalDataObfuscator is the parent class for the obfuscator classes. It is a general class that obfuscates the fields for any entity. You 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 marked fields. If you have tagged all the entity fields PersonalData with value ObfuscateDefault, 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.
    • The method sets the field value with the obfuscatedValue.
    • 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. In the base configuration, getObfuscatedValueForPersonalDataField is defined in DefaultPersonalDataObfuscator and uses the tag value. You can override the definition of this method to change how it obfuscates the field.
    • At the end, the method sets the ObfuscateInternal column to true by using ObfuscatablePublicMethod.setObfuscated.
  • obfuscateSimple – Works the same as obfuscate.

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.

See also