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
toField
with 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 boolean
equals(Object other)
PropertySetter
getOnSet()
String
getToField()
int
hashCode()
protected void
loadHandlerFromXML(XML xml)
Loads configuration settings specific to the implementing class.protected void
saveHandlerToXML(XML xml)
Saves configuration settings specific to the implementing class.void
setOnSet(PropertySetter onSet)
void
setToField(String toField)
String
toString()
protected void
transformApplicableDocument(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:
transformApplicableDocument
in classAbstractDocumentTransformer
- Throws:
ImporterHandlerException
-
loadHandlerFromXML
protected void loadHandlerFromXML(XML xml)
Description copied from class:AbstractImporterHandler
Loads configuration settings specific to the implementing class.- Specified by:
loadHandlerFromXML
in classAbstractImporterHandler
- Parameters:
xml
- XML configuration
-
saveHandlerToXML
protected void saveHandlerToXML(XML xml)
Description copied from class:AbstractImporterHandler
Saves configuration settings specific to the implementing class.- Specified by:
saveHandlerToXML
in classAbstractImporterHandler
- Parameters:
xml
- the XML
-
equals
public boolean equals(Object other)
- Overrides:
equals
in classAbstractImporterHandler
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractImporterHandler
-
toString
public String toString()
- Overrides:
toString
in classAbstractImporterHandler
-
-