public class ReferenceCondition extends Object implements IImporterCondition, IXMLConfigurable
A condition based on a text pattern matching a document reference (e.g. URL).
Can be used both as a pre-parse or post-parse handler.
<condition
class="com.norconex.importer.handler.condition.impl.ReferenceCondition">
<valueMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(expression of reference value to match)
</valueMatcher>
</condition>
<condition
class="ReferenceCondition">
<valueMatcher
method="regex">
.*/login/.*
</valueMatcher>
</condition>
The above example reject documents having "/login/" in their reference.
Constructor and Description |
---|
ReferenceCondition() |
ReferenceCondition(TextMatcher valueMatcher) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
TextMatcher |
getValueMatcher()
Gets the text matcher for field values.
|
int |
hashCode() |
void |
loadFromXML(XML xml) |
void |
saveToXML(XML xml) |
void |
setValueMatcher(TextMatcher valueMatcher)
Sets the text matcher for field values.
|
boolean |
testDocument(HandlerDoc doc,
InputStream input,
ParseState parseState)
Tests a given document.
|
String |
toString() |
public ReferenceCondition()
public ReferenceCondition(TextMatcher valueMatcher)
public TextMatcher getValueMatcher()
public void setValueMatcher(TextMatcher valueMatcher)
valueMatcher
- text matcherpublic boolean testDocument(HandlerDoc doc, InputStream input, ParseState parseState) throws ImporterHandlerException
IImporterCondition
testDocument
in interface IImporterCondition
doc
- the document to testinput
- document contentparseState
- whether the document has been parsed already or not (a
parsed document should normally be text-based)true
if the condition evaluates as suchImporterHandlerException
- problem reading the documentpublic void loadFromXML(XML xml)
loadFromXML
in interface IXMLConfigurable
public void saveToXML(XML xml)
saveToXML
in interface IXMLConfigurable
Copyright © 2009–2023 Norconex Inc.. All rights reserved.