Create a New Custom Function


Creating a custom function requires that a Java routine be written and added to Data Privacy using the Manage Custom Functions view. You will use the custom function in the Expression Builder after it is created.

Before you can create and use a new custom function, you must create the Java routine that you want to use. For more information, see Create-a-New-Java-Routine.

To create a new custom function:

  1. Start Topaz Workbench and open the desired repository.
  2. On the Data Privacy Menu view, Resource Administration stack bar, select Manage Custom Functions. The Manage Custom Functions view appears.
  3. Click Add. The Create New Custom Function dialog box appears.
  4. To load an implementation class from a file, click Load File. Browse through the dialog box that appears to where the desired class file or jar file is located.
  5. Select the desired class or jar file and click Open.
    1. If a class file is selected, the Function Name and Java Class Name are pre-filled based on the selected class.
    2. If a jar file is selected, the Select a Custom Function class dialog box appears. Select the desired class and click OK. The Function Name and Java Class Name are pre-filled based on the selected class.
  6. If desired, enter a Description. This description is what appears in the Description field for the properties of the function. In other words, it tells the end user how and what the function is used for.
  7. Based on the type of function chosen above, the Usage field will display Expression Builder, Value Conversion, Custom Hash, or Custom Encrypt. If the Usage is Expression Builder:
    1. In the Expression Builder section, select the Return Value Type: String, Number, String List, or Number List.
    2. Next to the parameter list, click Add to add a new parameter. The Create New Custom Function Parameter dialog box appears.
    3. Enter the Parameter Name and select the Parameter Type from the list: String, Number, String List, or Number List.
  8. Click OK. A prompt appears asking if you would like to manage dependencies for the function.
  9. If you click Yes, which is optional, the Manage Custom Function dependencies dialog box appears.

    Important

    This step can also be done as part of the Edit Custom Function process by clicking the Manage Dependencies button. During the edit, if you attempt to load a new custom function file with a usage type different from that of the existing definition, an error message will be displayed. If you load a new file of the same usage type but with a different custom function name, when you attempt to save it, a warning message will be displayed stating that you must modify the existing references to make use of the custom function.

    1. Click Add and browse through the dialog box that appears to where the desired jar file is located. You can also select an existing item from the File list and remove it by clicking the Delete button.
    2. Select the jar file and click Open.
    3. Repeat as needed to add more jar files, then check the box next to each desired jar file and click OK. The function class file and any dependent jar files are automatically uploaded to the Data Privacy server.

      Important

      The .dll and .so dependency files cannot be uploaded automatically the way .jar files can. They must be manually placed directly on the Data Privacy server.

  10. On the Create New Custom Function dialog box, click OK.

If you registered an Expression Builder function, it is now available for use in the Expression Builder. It can be found by opening the Expression Builder and selecting the Functions tab, then expanding Custom Functions. The Custom Functions category is only available after the first custom function has been created.

If you registered a Value Conversion function, it is now available for use in the source data identifier layout restrictions tab.

If you registered a Custom Encryption function, it is now available for use in the encryption rule actions.

If you registered a Custom Hash function, it is available for use in hash access paths and two-tier hash access paths.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*