Class NoContentTransformer
- java.lang.Object
-
- com.norconex.importer.handler.AbstractImporterHandler
-
- com.norconex.importer.handler.transformer.AbstractDocumentTransformer
-
- com.norconex.importer.handler.transformer.impl.NoContentTransformer
-
- All Implemented Interfaces:
IXMLConfigurable,IImporterHandler,IDocumentTransformer
public class NoContentTransformer extends AbstractDocumentTransformer implements IXMLConfigurable
Get rid of the content stream and optionally store it as text into a metadata field instead.
Storing content in an existing field
If a
toFieldwith the same name already exists for a document, the value will be added to the end of the existing value list. It is possible to change this default behavior by supplying aPropertySetter.This class can be used both as a pre-parsing or post-parsing handler. To store the content in a field, make sure pre-parsing is of a text content-types.
XML configuration usage:
<handler class="com.norconex.importer.handler.transformer.impl.NoContentTransformer" toField="(Optionally store content into a field.)"> <!-- multiple "restrictTo" tags allowed (only one needs to match) --> <restrictTo> <fieldMatcher>(field-matching expression)</fieldMatcher> <valueMatcher>(value-matching expression)</valueMatcher> </restrictTo> </handler>XML usage example:
<handler class="NoContentTransformer"/>The above example removes the content of all documents (leaving you with metadata only).
- Since:
- 3.0.0
- Author:
- Pascal Essiembre
-
-
Constructor Summary
Constructors Constructor Description NoContentTransformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)PropertySettergetOnSet()StringgetToField()inthashCode()protected voidloadHandlerFromXML(XML xml)Loads configuration settings specific to the implementing class.protected voidsaveHandlerToXML(XML xml)Saves configuration settings specific to the implementing class.voidsetOnSet(PropertySetter onSet)voidsetToField(String toField)StringtoString()protected voidtransformApplicableDocument(HandlerDoc doc, InputStream input, OutputStream output, ParseState parseState)-
Methods inherited from class com.norconex.importer.handler.transformer.AbstractDocumentTransformer
transformDocument
-
Methods inherited from class com.norconex.importer.handler.AbstractImporterHandler
addRestriction, addRestriction, addRestrictions, clearRestrictions, detectCharsetIfBlank, getRestrictions, isApplicable, loadFromXML, removeRestriction, removeRestriction, saveToXML
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.norconex.commons.lang.xml.IXMLConfigurable
loadFromXML, saveToXML
-
-
-
-
Method Detail
-
getToField
public String getToField()
-
setToField
public void setToField(String toField)
-
getOnSet
public PropertySetter getOnSet()
-
setOnSet
public void setOnSet(PropertySetter onSet)
-
transformApplicableDocument
protected void transformApplicableDocument(HandlerDoc doc, InputStream input, OutputStream output, ParseState parseState) throws ImporterHandlerException
- Specified by:
transformApplicableDocumentin classAbstractDocumentTransformer- Throws:
ImporterHandlerException
-
loadHandlerFromXML
protected void loadHandlerFromXML(XML xml)
Description copied from class:AbstractImporterHandlerLoads configuration settings specific to the implementing class.- Specified by:
loadHandlerFromXMLin classAbstractImporterHandler- Parameters:
xml- XML configuration
-
saveHandlerToXML
protected void saveHandlerToXML(XML xml)
Description copied from class:AbstractImporterHandlerSaves configuration settings specific to the implementing class.- Specified by:
saveHandlerToXMLin classAbstractImporterHandler- Parameters:
xml- the XML
-
equals
public boolean equals(Object other)
- Overrides:
equalsin classAbstractImporterHandler
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractImporterHandler
-
toString
public String toString()
- Overrides:
toStringin classAbstractImporterHandler
-
-