Accessing a user-defined policy from a graphical data map

Use the Graphical Data Mapping editor to access the properties of a user-defined policy in a static manner.

Before you begin

About this task

If you created a user-defined policy, and created properties for that policy, you can query those properties by using the MbPolicy.getPolicy call from a Custom Java™ transform in a message map.

Procedure

Complete the following steps to use Java in a Custom Java transform:

  1. Create a Java class (for example, MyPolicyAccessClass) with the following static method:
    Static String getPolicyProperty(String policyProjectName, String propertyName)
  2. Implement getPolicyProperty to look up the passed policyProjectName by using code such as in the following example.
    MbPolicy myPol = MbPolicy.getPolicy("UserDefined", policyProjectName);
  3. Ensure that your method returns the value of the passed propertyName by using code such as in the following example.
    resultPropertyValue = myPol.getPropertyValueAsString(propertyName);
  4. Create a message map.
  5. Add a Custom Java transform to the map.
  6. Set the following properties for the Custom Java transform.
    • Call the Java method MyPolicyAccessClass.getPolicyProperty().
    • Set suitable values for the policyProjectName and propertyName parameters.
    You can map the returned resultPropertyValue from the output of the Custom Java transform.