Package de.cxp.ocs.preprocessor
Class ConfigureableDataprocessor<T extends ConfigureableField>
- java.lang.Object
-
- de.cxp.ocs.preprocessor.ConfigureableDataprocessor<T>
-
- Type Parameters:
T-ConfigureableFieldimplementation to which theDocumentPreProcessorgets 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 initializingDocumentPreProcessorimplementations which need further configuration.- Author:
- hjk
-
-
Field Summary
Fields Modifier and Type Field Description protected List<T>patternConfprotected IndexConfigurationproperties
-
Constructor Summary
Constructors Constructor Description ConfigureableDataprocessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TgetPatternConfiguration(String key, String value, Map<String,String> confMap)Returns theConfigureableFieldholding the parsed configuration for every configured key.protected abstract BiConsumer<T,Object>getProcessConsumer(Document sourceDocument, boolean visible)Returns aBiConsumerwhose input is the configuredConfigureableFieldwith the value of the currently processed record.voidinitialize(FieldConfigAccess fieldConfig, Map<String,String> confMap)DataPreProcessor MUST have a no-args constructor.protected booleanisRecordVisible(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.booleanprocess(Document sourceDocument, boolean visible)Called for each source document.
-
-
-
Field Detail
-
properties
protected IndexConfiguration properties
-
patternConf
protected List<T extends ConfigureableField> patternConf
-
-
Method Detail
-
initialize
public void initialize(FieldConfigAccess fieldConfig, Map<String,String> confMap)
Description copied from interface:DocumentPreProcessorDataPreProcessor MUST have a no-args constructor. To configure it afterwards, this method will be used.- Specified by:
initializein interfaceDocumentPreProcessorconfMap- custom string-to-string map that can be configured per DocumentPreProcessor.
-
getPatternConfiguration
protected abstract T getPatternConfiguration(String key, String value, Map<String,String> confMap)
Returns theConfigureableFieldholding 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
public boolean process(Document sourceDocument, boolean visible)
Description copied from interface:DocumentPreProcessorCalled for each source document.- Specified by:
processin interfaceDocumentPreProcessorvisible- weather or not the record is currently marked for indexing.- Returns:
trueif the record should be indexed,falseotherwise.
-
getProcessConsumer
protected abstract BiConsumer<T,Object> getProcessConsumer(Document sourceDocument, boolean visible)
Returns aBiConsumerwhose input is the configuredConfigureableFieldwith 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
BiConsumerwhose accept method should handle everyPatternConfigurationwith the corresponding value.
-
isRecordVisible
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.- Parameters:
sourceDocument- the record datavisible- the current visibility of the record- Returns:
trueif the record should be indexed,falseotherwise.
-
-