Package com.norconex.committer.core
Class BaseCommitterConfig
java.lang.Object
com.norconex.committer.core.BaseCommitterConfig
- Direct Known Subclasses:
BaseBatchCommitterConfig,BaseFsCommitterConfig,LogCommitterConfig,MemoryCommitterConfig
A base implementation taking care of basic plumbing for field mappings and restrictions for filtering unwanted requests.
Restricting committer to specific documents
Optionally apply a committer only to certain type of documents. Documents are restricted based on their metadata field names and values. This option can be used to perform document routing when you have multiple Committers defined.
Field mappings
By default, this abstract class applies field mappings for metadata fields, but leaves the document reference and content (input stream) for concrete implementations to handle. In other words, they only apply to a committer request metadata. Field mappings are performed on committer requests before upserts and deletes are actually performed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRestriction(PropertyMatcher restriction) Adds one restriction this committer should be restricted to.addRestrictions(List<PropertyMatcher> restrictions) Adds restrictions this committer should be restricted to.protected booleanvoidvoidClears all restrictions.booleanGets an unmodifiable copy of the metadata mappings.Gets all restrictionsinthashCode()removeFieldMapping(String fromField) booleanremoveRestriction(PropertyMatcher restriction) Removes a restriction.intremoveRestriction(String field) Removes all restrictions on a given field.setFieldMapping(String fromField, String toField) Sets a metadata field mapping.setFieldMappings(Map<String, String> mappings) Sets a metadata field mappings, where the key is the source field and the value is the target field.toString()
-
Constructor Details
-
BaseCommitterConfig
public BaseCommitterConfig()
-
-
Method Details
-
addRestriction
Adds one restriction this committer should be restricted to.- Parameters:
restriction- the restriction- Returns:
- this
-
addRestrictions
Adds restrictions this committer should be restricted to.- Parameters:
restrictions- the restrictions- Returns:
- this
-
removeRestriction
Removes all restrictions on a given field.- Parameters:
field- the field to remove restrictions on- Returns:
- how many elements were removed
-
removeRestriction
Removes a restriction.- Parameters:
restriction- the restriction to remove- Returns:
trueif this committer contained the restriction
-
clearRestrictions
public void clearRestrictions()Clears all restrictions. -
getRestrictions
Gets all restrictions- Returns:
- the restrictions
-
getFieldMappings
Gets an unmodifiable copy of the metadata mappings.- Returns:
- metadata mappings
-
setFieldMapping
Sets a metadata field mapping.- Parameters:
fromField- source fieldtoField- target field- Returns:
- this
-
setFieldMappings
Sets a metadata field mappings, where the key is the source field and the value is the target field.- Parameters:
mappings- metadata field mappings- Returns:
- this
-
removeFieldMapping
-
clearFieldMappings
public void clearFieldMappings() -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-