Class IngestDocument

  • All Implemented Interfaces:
    LocaleAware, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<IngestField>

    public class IngestDocument
    extends java.lang.Object
    implements java.lang.Iterable<IngestField>, java.io.Serializable, java.lang.Cloneable, LocaleAware
    A document for content ingestion.
    See Also:
    Serialized Form
    • Field Detail

      • DEFAULT_DOCUMENT_MODE

        public static final DocumentMode DEFAULT_DOCUMENT_MODE
    • Constructor Detail

      • IngestDocument

        public IngestDocument​(java.lang.String id)
        Construct a new IngestDocument.
      • IngestDocument

        public IngestDocument​(java.lang.String id,
                              DocumentMode mode)
        Construct a new IngestDocument.
    • Method Detail

      • getId

        public java.lang.String getId()
        Get the unique document id.
      • setId

        public void setId​(java.lang.String value)
        Set the unique document id.
      • getCorrelationId

        public java.util.UUID getCorrelationId()
        Get the correlation ID for this document.

        The correlation ID is used to tie different instances of the same document sent in back to their original source.

      • setCorrelationId

        public void setCorrelationId​(java.util.UUID value)
        Set the correlation ID for this document.

        WARNING: internal use only. The correlation ID is set by the system and should not be modified by client code.

      • getLocale

        public java.util.Locale getLocale()
        Get the Locale for this field.
        Specified by:
        getLocale in interface LocaleAware
      • setLocale

        public void setLocale​(java.util.Locale value)
        Set the Locale for this field.
        Specified by:
        setLocale in interface LocaleAware
      • getMode

        public DocumentMode getMode()
        Gets the mode for ingesting this document.
      • setMode

        public void setMode​(DocumentMode value)
        Gets the mode for ingesting this document.
      • getZone

        public java.lang.String getZone()
        Get the zone for this document.

        If set the zone acts as a composite key with the value of getId().

      • setZone

        public void setZone​(java.lang.String value)
        Set the zone for this document.
      • size

        public int size()
        Get the number of fields in this document.
      • containsField

        public boolean containsField​(java.lang.String name)
        Get if this document contains field.
      • getFieldNames

        public java.lang.Iterable<java.lang.String> getFieldNames()
        Return an Iterable for iterating over all unique field names.
      • iterator

        public java.util.Iterator<IngestField> iterator()
        Get an iterator for iterating over all fields.
        Specified by:
        iterator in interface java.lang.Iterable<IngestField>
      • forEach

        public void forEach​(java.util.function.Consumer<? super IngestField> consumer)
        Specified by:
        forEach in interface java.lang.Iterable<IngestField>
      • clear

        public void clear()
        Remove all fields and attributes.
      • getField

        public IngestField getField​(java.lang.String field)
        Get a field or null if field does not exist.

        NOTE: if the field exists, but contains no field values, null will be returned.

      • renameField

        public void renameField​(java.lang.String oldName,
                                java.lang.String newName)
        Rename a field.

        If the field does not exist no action is taken.

      • removeField

        public void removeField​(java.lang.String name)
        Remove a field by name.

        Will have no effect if field does not exist.

      • importFields

        public void importFields​(IngestDocument doc)
        Import all fields into this document.

        Fields and FieldValues will be deep cloned.

      • getFirstValue

        public IngestFieldValue getFirstValue​(java.lang.String field)
        Get the first IngestFieldValue for field or null if the field does not exist.
      • setField

        public void setField​(IngestField field)
        Set a field for this document.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             java.lang.String... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             java.lang.Number... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             java.lang.Boolean... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             java.util.Date... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             Point... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             Shape... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             ContentPointer... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • setField

        public void setField​(java.lang.String field,
                             org.w3c.dom.Document... values)
        Set the values for a field.

        If a field already exists with the same name, it will be replaced.

      • addValues

        public void addValues​(java.lang.String field,
                              java.lang.String... values)
        Add String values to field.
      • addValues

        public void addValues​(java.lang.String field,
                              java.lang.Number... values)
        Add numeric values to field.
      • addValues

        public void addValues​(java.lang.String field,
                              java.util.Date... values)
        Add Date values to field.
      • addValues

        public void addValues​(java.lang.String field,
                              java.lang.Boolean... values)
        Add Boolean values to field.
      • addValues

        public void addValues​(java.lang.String field,
                              Point... values)
        Add Point values to field.
      • addValues

        public void addValues​(java.lang.String field,
                              Shape... values)
        Add Shape values to field.
      • addValues

        public void addValues​(java.lang.String field,
                              org.w3c.dom.Document... values)
        Add Document values to field.
      • addValue

        public void addValue​(java.lang.String field,
                             IngestFieldValue value)
        Add a value to field.
      • addValue

        public void addValue​(java.lang.String name,
                             java.lang.String value)
        Add a String value to field.
      • addValue

        public void addValue​(java.lang.String name,
                             java.lang.Number value)
        Add a numeric value to field.
      • addValue

        public void addValue​(java.lang.String name,
                             java.util.Date value)
        Add a Date value to field.
      • addValue

        public void addValue​(java.lang.String name,
                             java.lang.Boolean value)
        Add a Boolean value to field.
      • addValue

        public void addValue​(java.lang.String name,
                             Point value)
        Add a Point value to field.
      • addValue

        public void addValue​(java.lang.String name,
                             Shape value)
        Add a Shape value to field.
      • addValue

        public void addValue​(java.lang.String name,
                             org.w3c.dom.Document value)
        Add a Document value to field.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • clone

        public IngestDocument clone()
        Overrides:
        clone in class java.lang.Object
      • ensureCapacity

        public final void ensureCapacity()
      • getEstimatedSize

        public long getEstimatedSize()
        Get the estimated size of the document in bytes.

        NOTE: Includes size of remote content pointers.