Class ReplacePatternInValuesDataProcessor

java.lang.Object
de.cxp.ocs.preprocessor.ConfigureableDataprocessor<PatternWithReplacementConfiguration>
de.cxp.ocs.preprocessor.impl.ReplacePatternInValuesDataProcessor
All Implemented Interfaces:
DocumentPreProcessor

public class ReplacePatternInValuesDataProcessor extends ConfigureableDataprocessor<PatternWithReplacementConfiguration>
ConfigureableDataprocessor implementation which replaces all occurrences of a regular expression within a fields value. Will be auto configured and can be further configuration like described below:
 data-processor-configuration: 
   processors:
     - ReplacePatternInValuesDataProcessor
  configuration:
    ReplacePatternInValuesDataProcessor:
      someFieldName: ".*\\d+.*"
      someFieldName_replacement: "foo"
      someFieldName_destination: "someDestinationField"
 
This would replace all word between a number with 'foo' from the field with the name 'someFieldName'. If no *_replacement is provided, the matched pattern will be replaced by StringUtils.EMPTY. Furthermore if a *_destination is configured, the original value stays untouched and the replaced value will be written into the configured field.