Package de.cxp.ocs.preprocessor.impl
Class SplitValueDataProcessor
java.lang.Object
de.cxp.ocs.preprocessor.ConfigureableDataprocessor<SplitValueConfiguration>
de.cxp.ocs.preprocessor.impl.SplitValueDataProcessor
- All Implemented Interfaces:
DocumentPreProcessor
DocumentPreProcessor
implementation which
splits a field value on a regular expression and adds the splitted values
into new fields. Will be auto configured and can be further configuration
like described below:
data-processor-configuration: processors: - SplitValueDataProcessor configuration: SplitValueDataProcessor: FieldName: ColorMapping ColorMapping_keepOriginal: true ColorMapping_regEx: /::/ ColorMapping_idxToDest: 0:Hauptfarbe;1:Nebenfarbe #Optionally a wildcard index can be supplied if the index count is not predictable when splitting a value. #In this case only one value is allowed and must be -1. For every splitted value a record entry #in form: value_idxOfSplitted value will be added. E.g.: ColorMapping_idxToDest: -1:Hauptfarbe # This would add Hauptfarbe_0, Hauptfarbe_1, Hauptfarbe_3 for on a value foo/::/bar/::/bazThis would split the value of the ColorMapping field by the regular expression /::/ assuming that it result in two splitted values. The first of the splitted values is going to be added in a new field called Hauptfarbe and the second value into a new field Nebenfarbe. Furthermore the original value of the field ColorMapping is not removed.
-
Field Summary
Fields inherited from class de.cxp.ocs.preprocessor.ConfigureableDataprocessor
patternConf, properties
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SplitValueConfiguration
Returns theConfigureableField
holding the parsed configuration for every configured key.protected BiConsumer
<SplitValueConfiguration, Object> getProcessConsumer
(Document doc, 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
-
SplitValueDataProcessor
public SplitValueDataProcessor()
-
-
Method Details
-
getPatternConfiguration
protected SplitValueConfiguration 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<SplitValueConfiguration>
- 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<SplitValueConfiguration,Object> getProcessConsumer(Document doc, 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<SplitValueConfiguration>
- Parameters:
doc
- the record datavisible
- the current visibility of the record- Returns:
- a
BiConsumer
whose accept method should handle everyPatternConfiguration
with the corresponding value.
-