Filtering Properties Before Replication
To prevent sensitive information from being exposed in a target environment during replication, you can filter or modify properties before they are replicated. Most scenarios can be addressed using the generic property filter included with Bloomreach Content. For advanced filtering logic, you can implement a custom PropertyFilter.
Using the Generic Property Filter
To exclude properties by name during replication, configure the generic property filter. Add the property names you want to exclude to the following configuration path:
/hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter/excludedProperties
You can update this configuration using a YAML source definition:
definitions: config: /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter: excludedProperties: operation: add type: string value: ['example:example']
To replace the value of specific properties with a constant value during replication, use the following multi-valued configuration properties:
/hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter/modifiedProperties/hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/filter/modifiedValues
Each property listed in modifiedProperties will be set to the corresponding value in modifiedValues. Only string properties can be modified using this method.
Implementing a Custom PropertyFilter
If you require more complex filtering or modification logic than the generic property filter supports, implement the com.onehippo.cms7.replication.PropertyFilter interface. This allows you to define custom rules for excluding or modifying properties during replication.
/** * Implement this interface to filter out and/or modify certain properties before they are replicated. */ public interface PropertyFilter { /** * Determines whether the {@code property} should be replicated. * @throws RepositoryException */ boolean excludeProperty(Property property) throws RepositoryException; /** * Optionally modifies 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 your filter to receive the moduleConfig node during registration, also implement the com.onehippo.cms7.replication.Configurable interface.
To register your custom filter with the replication engine, add a node of type hipposys:moduleconfig under /hippo:configuration/hippo:modules/replication/hippo:moduleconfig/metadata/ using a 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
A single class can implement both the PropertyFilter interface and the ReplicationScopeProvider interface if needed.