Accelerate the Value of Data

Custom Cleanse Functions

Implement your own cleanse function by writing a Java module (JAR file).

The following properties are used to customize the configuration of a cleanse function:

Table 1. Properties
Name Required Description
type Yes This is the class name of the cleanse function. This also indicates the Name of the S3 bucket where the properties file is located.
module Yes Path to the Java module with the cleanse function implementation inside S3 file storage.

You can also specify any other parameters in the options section of the configuration. All these parameters are passed to the cleanse function. The cleanse function class consists of the following details:

  1. Implement the cleanse function interface:
    public interface ICleanseFunction {
        List<CleanseOutputs> cleanseValues(List<CleanseInputs> 
          inputs, Map<String,String> securedOptions, Map<String,String> unsecuredOptions) throws CleanseException;
  2. Include the default constructor where,
  • cleanseInputs - Indicates the input data for the cleanse function, where, one CleanseInputs element belongs to one entity to cleanse. The values to cleanse may be obtained by the getAttributesToCleanse call. It outputs Map<String,Object>, where the key is the attribute name and the value-is is the value. Depending on the inputMappings configuration, the type of the value may be String, List<String>, Map<String, String>, or Map<String, List<String>>.
    Note: For more information, see Configuring Cleanse Rules.
  • securedOptions - Indicates the properties specified in the tenant cleanse configuration (under the options section).
  • unsecuredOptions - Indicates the properties specified in the cleanse rules configuration.
Note: For each CleanseInput, the function generates CleanseOutputs (to create an instance of the CleanseOutputs, use createOutputs method of the CleanseInput object). If the entity cannot be cleansed, you cannot create the CleanseOutputs for it. All the generated CleanseOutputs are returned by the function.

System Properties

Get system properties using a System.getProperty(<property name>) call using Java code.

Note: Typically, you can provide these properties by modifying the JAVA_OPTS parameter inside the /opt/tomcat/bin/ file.
export JAVA_OPTS="$JAVA_OPTS... -DloqateDefaultCountry=USA..."