Package de.cxp.ocs.preprocessor.impl
Class RemoveValuesDataProcessor
java.lang.Object
de.cxp.ocs.preprocessor.ConfigureableDataprocessor<PatternConfiguration>
de.cxp.ocs.preprocessor.impl.RemoveValuesDataProcessor
- All Implemented Interfaces:
DocumentPreProcessor
DocumentPreProcessor
implementation which
removes values from a fields value based on a regular expression. Will be
auto configured and can be further configuration like described below:
data-processor-configuration:
processors:
- RemoveValuesDataProcessor
configuration:
RemoveValuesDataProcessor:
someFieldName: ".*\\d+.*"
someFieldName_destination: "someDestinationField"
# Optional configuration:
# RegEx used to split the value into chunks, //s+ if omitted
someFieldName_wordSplitRegEx: "/"
# join character used when combining splitted cleared chunks, default space " "
someFieldName_wordJoinSeparator: "/"
This would remove all numerical values from the field with the name
'someFieldName' and write it into the field 'someDestinationField'. If no
destination is specified, the destination will be the source field.
This implementation splits the value into separate tokens
and checks the regular expression against each token. If the regular
expression matches the token, the token get's removed.-
Field Summary
Fields inherited from class de.cxp.ocs.preprocessor.ConfigureableDataprocessor
patternConf, properties
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PatternConfiguration
Returns theConfigureableField
holding the parsed configuration for every configured key.protected BiConsumer
<PatternConfiguration, Object> getProcessConsumer
(Document sourceData, boolean visible) Returns aBiConsumer
whose input is the configuredConfigureableField
with the value of the currently processed record.Methods inherited from class de.cxp.ocs.preprocessor.ConfigureableDataprocessor
initialize, isRecordVisible, process
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.cxp.ocs.spi.indexer.DocumentPreProcessor
finish
-
Constructor Details
-
RemoveValuesDataProcessor
public RemoveValuesDataProcessor()
-
-
Method Details
-
getPatternConfiguration
protected PatternConfiguration getPatternConfiguration(String key, String value, Map<String, String> confMap) Description copied from class:ConfigureableDataprocessor
Returns theConfigureableField
holding the parsed configuration for every configured key.- Specified by:
getPatternConfiguration
in classConfigureableDataprocessor<PatternConfiguration>
- Parameters:
key
- a key from the data processor configuration for this data processor.value
- the value of that key.confMap
- the complete data processor configuration map.- Returns:
- the parsed configurable field for the key.
-
getProcessConsumer
protected BiConsumer<PatternConfiguration,Object> getProcessConsumer(Document sourceData, boolean visible) Description copied from class:ConfigureableDataprocessor
Returns aBiConsumer
whose input is the configuredConfigureableField
with the value of the currently processed record. The consumer gets called in theDocumentPreProcessor.process(Document, boolean)
method for each configured key.- Specified by:
getProcessConsumer
in classConfigureableDataprocessor<PatternConfiguration>
- Parameters:
sourceData
- the record datavisible
- the current visibility of the record- Returns:
- a
BiConsumer
whose accept method should handle everyPatternConfiguration
with the corresponding value.
-