Package de.cxp.ocs.preprocessor
Class ConfigureableDataprocessor<T extends ConfigureableField>
java.lang.Object
de.cxp.ocs.preprocessor.ConfigureableDataprocessor<T>
- Type Parameters:
T
-ConfigureableField
implementation to which theDocumentPreProcessor
gets mapped.
- All Implemented Interfaces:
DocumentPreProcessor
- Direct Known Subclasses:
RemoveValuesDataProcessor
,ReplacePatternInValuesDataProcessor
,SplitValueDataProcessor
public abstract class ConfigureableDataprocessor<T extends ConfigureableField>
extends Object
implements DocumentPreProcessor
Abstract class which handles reading and initializing
DocumentPreProcessor
implementations which need further configuration.- Author:
- hjk
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
Returns theConfigureableField
holding the parsed configuration for every configured key.protected abstract BiConsumer
<T, Object> getProcessConsumer
(Document sourceDocument, boolean visible) Returns aBiConsumer
whose input is the configuredConfigureableField
with the value of the currently processed record.void
initialize
(FieldConfigAccess fieldConfig, Map<String, String> confMap) DataPreProcessor MUST have a no-args constructor.protected boolean
isRecordVisible
(Document sourceDocument, boolean visible) Called at the end of each process(Document, boolean) run aftergetProcessConsumer(Document, boolean)
is has run for everyConfigureableField
, to determine weather the record should be visible or not.boolean
Called for each source document.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
-
Field Details
-
properties
-
patternConf
-
-
Constructor Details
-
ConfigureableDataprocessor
public ConfigureableDataprocessor()
-
-
Method Details
-
initialize
Description copied from interface:DocumentPreProcessor
DataPreProcessor MUST have a no-args constructor. To configure it afterwards, this method will be used.- Specified by:
initialize
in interfaceDocumentPreProcessor
- Parameters:
fieldConfig
- field config accessconfMap
- custom string-to-string map that can be configured per DocumentPreProcessor.
-
getPatternConfiguration
Returns theConfigureableField
holding the parsed configuration for every configured key.- 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.
-
process
Description copied from interface:DocumentPreProcessor
Called for each source document.- Specified by:
process
in interfaceDocumentPreProcessor
- Parameters:
sourceDocument
- source documentvisible
- weather or not the record is currently marked for indexing.- Returns:
true
if the record should be indexed,false
otherwise.
-
getProcessConsumer
protected abstract BiConsumer<T,Object> getProcessConsumer(Document sourceDocument, boolean visible) 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.- Parameters:
sourceDocument
- the record datavisible
- the current visibility of the record- Returns:
- a
BiConsumer
whose accept method should handle everyPatternConfiguration
with the corresponding value.
-
isRecordVisible
Called at the end of each process(Document, boolean) run aftergetProcessConsumer(Document, boolean)
is has run for everyConfigureableField
, to determine weather the record should be visible or not.- Parameters:
sourceDocument
- the record datavisible
- the current visibility of the record- Returns:
true
if the record should be indexed,false
otherwise.
-