This article covers a Bloomreach Experience Manager version 12. There's an updated version available that covers our most recent release.

Filtering properties before replication

If you have properties that contain sensitive information you don't want to risk exposing in your target environment, then you may need to implement the PropertyFilter interface to filter out or modify such properties. Most of the use cases however, can be handled by the already configured generic property filter.

Use the generic property filter

If you want to simply exclude properties by name then you can use the pre-configured generic property filter. Add the name of the property you want to exclude to  /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter/excludedProperties

You can use the add operation in a YAML source definition for this:

definitions:
  config:
    /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter:
      excludedProperties:
        operation: add
        type: string
        value: ['example:example']

You can also use this filter when you want to change the value of some specific property to a constant value. Specify the multi-valued configuration properties  /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter/modifiedProperties and /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter/modifiedValues for this purpose. Properties named in the former property get the value specified at the corresponding position in the latter property. Only properties of type string can be modified in this way.

Implement your own PropertyFilter 

If the logic to determine which properties to filter out, or the way to modify those properties, is more complicated than what can be accomplished with the generic property filter, then you must implement your own. Create a class that implements the interface  com.onehippo.cms7.replication.PropertyFilter:

/**
 * Implement this interface to filter out and/or modify certain properties before they are replicated.
 */
public interface PropertyFilter {

    /**
     * Whether the {@code property} is to be replicated or not.
     * @throws RepositoryException
     */
    boolean excludeProperty(Property property) throws RepositoryException;

    /**
     * Allows to modify the value to be sent to the target.
     * @param property  the property to be modified
     * @param value  the original value
     * @return  the modified value to be sent to the target or {@code null} if this filter
     * does not modify the value.
     * @throws RepositoryException
     */
    Value modifyValue(Property property, Value value) throws RepositoryException;

}

If you want to be passed the moduleConfig node that registers your filter with the replication engine, then also implement the interface com.onehippo.cms7.replication.Configurable.

To register the filter with the replication engine add a node of type hipposys:moduleconfig below /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/ using the following YAML source definition:

definitions:
  config:
    /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/myfilter:
      jcr:primaryType: hipposys:moduleconfig
      className: com.onehippo.cms7.replication.metadata.ExamplePropertyFilter

Note that the same class may implement both the PropertyFilter interface and the ReplicationScopeProvider interface.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?