Class ConditionalDocHandler

java.lang.Object
com.norconex.importer.handler.condition.ConditionalDocHandler
All Implemented Interfaces:
DocHandler, Labelable
Direct Known Subclasses:
If, IfNot

public abstract class ConditionalDocHandler extends Object implements DocHandler, Labelable
Conditionally execute one or more doc handlers (possibly including other conditional doc handlers) upon matching a condition, or not. Conditional handlers effectively allows you to perform if/then/else using objects, facilitating basic decision branches in Importer flow configuration.
  • Constructor Details

    • ConditionalDocHandler

      protected ConditionalDocHandler(boolean negated)
    • ConditionalDocHandler

      protected ConditionalDocHandler(Condition condition, boolean negated)
  • Method Details

    • getName

      public abstract String getName()
    • getThenHandlers

      public List<DocHandler> getThenHandlers()
    • setThenHandlers

      public ConditionalDocHandler setThenHandlers(List<DocHandler> thenHandlers)
    • getElseHandlers

      public List<DocHandler> getElseHandlers()
    • setElseHandlers

      public ConditionalDocHandler setElseHandlers(List<DocHandler> elseHandlers)
    • handle

      public boolean handle(@NonNull @NonNull DocHandlerContext docHandlerContext) throws IOException
      Description copied from interface: DocHandler
      Perform any operations on a document.
      Specified by:
      handle in interface DocHandler
      Parameters:
      docHandlerContext - the document handling context
      Returns:
      false to stop processing and reject a document or true to proceed to the next configured handler.
      Throws:
      IOException - An I/O exception of some sort has occurred
    • getLabel

      public String getLabel()
      Description copied from interface: Labelable
      Gets an optional user-supplied label.
      Specified by:
      getLabel in interface Labelable
      Returns:
      label or null
    • isNegated

      public boolean isNegated()
    • getCondition

      public Condition getCondition()
    • setLabel

      public void setLabel(String label)
    • setCondition

      public void setCondition(Condition condition)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object