Class EmbeddedConfig

java.lang.Object
com.norconex.importer.handler.parser.impl.EmbeddedConfig
All Implemented Interfaces:
Serializable

public class EmbeddedConfig extends Object implements Serializable

For documents containing embedded documents (e.g. zip files), the default behavior of this treat them as a single document, merging all embedded documents content and metadata into the parent document. You can tell this parser to "split" embedded documents to have them treated as if they were individual documents. When split, each embedded documents will go through the entire import cycle, going through your handlers and even this parser again (just like any regular document would).

A container that was split is still a document of its own, with whatever content it has itself (the body of an email, the text of a document that holds pictures), and it goes on through your handlers and is committed like any other. When it has none (a zip file, say), you may not want it: list its content types with setDiscardContainerContentTypes(List) to have it discarded once its embedded documents were split off, which are not affected.

You can also decide to skip the parsing of embedded documents. Either by the content type of the parent document, or the content types of the embedded documents.

When embedded are being parsed, the resulting ImporterResponse will contain nested documents, which in turn, might contain some (tree-like structure).

See Also:
  • Constructor Details

    • EmbeddedConfig

      public EmbeddedConfig()
  • Method Details

    • getDiscardContainerContentTypes

      public List<TextMatcher> getDiscardContainerContentTypes()
      Gets the content types of containers to discard, once split. Only applies to a container that is split (see getSplitContentTypes()) and that did hold embedded documents: the container is then discarded (rejected) and its embedded documents, which are documents of their own, carry on. A container of a type that is not split is merged with its embedded documents and is never discarded, whatever is set here. Each level is looked at on its own: a split container found inside a split container is discarded too if its type is listed.

      Default is to discard none: a split container is kept, as it always was.

      Returns:
      list of content type matcher
    • setDiscardContainerContentTypes

      public EmbeddedConfig setDiscardContainerContentTypes(List<TextMatcher> discardContainerContentTypes)
      Sets the content types of containers to discard, once split. See getDiscardContainerContentTypes().
      Parameters:
      discardContainerContentTypes - list of content type matcher
      Returns:
      this instance
    • getSplitContentTypes

      public List<TextMatcher> getSplitContentTypes()
      Gets the content types of container files to split and treat their embedded files as separate documents. Default does not split any type (all embedded documents are merged).
      Returns:
      list of content type matcher
    • setSplitContentTypes

      public EmbeddedConfig setSplitContentTypes(List<TextMatcher> splitContentTypes)
      Gets the content types of container files to split and treat their embedded files as separate documents. Default does not split any type (all embedded documents are merged).
      Parameters:
      splitContentTypes - list of content type matcher
      Returns:
      this instance
    • getSkipEmbeddedOfContentTypes

      public List<TextMatcher> getSkipEmbeddedOfContentTypes()
      Gets the content type matchers of container files you do not want to have their embedded files parsed. Embedded files of matching containers will effectively be skipped/ignored. Default parses embedded files of all container file content types.
      Returns:
      list of content type matcher
    • setSkipEmbeddedOfContentTypes

      public EmbeddedConfig setSkipEmbeddedOfContentTypes(List<TextMatcher> skipEmbeddedOfContentTypes)
      Gets the content type matchers of container files you do not want to have their embedded files parsed. Embedded files of matching containers will effectively be skipped/ignored. Default parses embedded files of all container file content types.
      Parameters:
      skipEmbeddedOfContentTypes - list of content type matcher
      Returns:
      this instance
    • getSkipEmbeddedContentTypes

      public List<TextMatcher> getSkipEmbeddedContentTypes()
      Gets the content types of container files to split and treat their embedded files as separate documents. Default does not split any type (all embedded documents are merged).
      Returns:
      list of content type matcher
    • setSkipEmbeddedContentTypes

      public EmbeddedConfig setSkipEmbeddedContentTypes(List<TextMatcher> skipEmbeddedContentTypes)
      Gets the content types of container files to split and treat their embedded files as separate documents. Default does not split any type (all embedded documents are merged).
      Parameters:
      skipEmbeddedContentTypes - list of content type matcher
      Returns:
      this instance
    • getMaxEmbeddedDepth

      public int getMaxEmbeddedDepth()
      Maximum detph of embeded documents to extract. Zero is the root document (original container).
      Returns:
      maximum depth of embedded docs to extract
    • setMaxEmbeddedDepth

      public EmbeddedConfig setMaxEmbeddedDepth(int maxEmbeddedDepth)
      Maximum detph of embeded documents to extract. Zero is the root document (original container).
      Parameters:
      maxEmbeddedDepth - max depth or -1 (default) for unlimited.
      Returns:
      this.
    • 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