Class BulkOperation


  • public class BulkOperation
    extends Object
    Contains all data needed for one operation of a bulk write operation.
    Author:
    sschmitt
    • Constructor Detail

      • BulkOperation

        public BulkOperation​(JsonObject json)
        Json constructor
        Parameters:
        json - the json object
    • Method Detail

      • createDelete

        public static BulkOperation createDelete​(JsonObject filter)
        Create a new delete operation with the given filter
        Parameters:
        filter - the filter
        Returns:
        a new delete operation instance
      • createInsert

        public static BulkOperation createInsert​(JsonObject document)
        Create a new insert operation with the given document
        Parameters:
        document - the document to insert
        Returns:
        a new insert operation instance
      • createReplace

        public static BulkOperation createReplace​(JsonObject filter,
                                                  JsonObject document)
        Create a new replace operation with the given filter and replace document
        Parameters:
        filter - the filter
        document - the replace document
        Returns:
        a new replace operation instance
      • createReplace

        public static BulkOperation createReplace​(JsonObject filter,
                                                  JsonObject document,
                                                  boolean upsert)
        Create a new replace operation with the given filter, replace document, and the upsert flag
        Parameters:
        filter - the filter
        document - the replace document
        upsert - the upsert flag
        Returns:
        a new replace operation instance
      • createUpdate

        public static BulkOperation createUpdate​(JsonObject filter,
                                                 JsonObject document)
        Create a new update operation with the given filter and update document
        Parameters:
        filter - the filter
        document - the update document
        Returns:
        a new update operation instance
      • createUpdate

        public static BulkOperation createUpdate​(JsonObject filter,
                                                 JsonObject document,
                                                 boolean upsert,
                                                 boolean multi)
        Create a new update operation with the given filter, update document, the upsert flag, and multi flag
        Parameters:
        filter - the filter
        document - the update document
        upsert - the upsert flag
        multi - the multi flag
        Returns:
        a new update operation instance
      • toJson

        public JsonObject toJson()
        Generate a json from this object
        Returns:
        the json representation
      • getType

        public BulkOperationType getType()
        Returns the operation type
        Returns:
        the operation type
      • setType

        public BulkOperation setType​(BulkOperationType type)
        Sets the operation type
        Parameters:
        type - the operation type
        Returns:
        this for fluency
      • getFilter

        public JsonObject getFilter()
        Returns the filter document, used by replace, update, and delete operations
        Returns:
        the filter document
      • setFilter

        public BulkOperation setFilter​(JsonObject filter)
        Sets the filter document, used by replace, update, and delete operations
        Parameters:
        filter - the filter document
        Returns:
        this for fluency
      • getDocument

        public JsonObject getDocument()
        Returns the document, used by insert, replace, and update operations
        Returns:
        the document
      • setDocument

        public BulkOperation setDocument​(JsonObject document)
        Sets the document, used by insert, replace, and update operations
        Parameters:
        document - the document
        Returns:
        this for fluency
      • isUpsert

        public boolean isUpsert()
        Returns the upsert flag, used by update and replace operations
        Returns:
        the upsert flag
      • setUpsert

        public BulkOperation setUpsert​(boolean upsert)
        Sets the upsert flag, used by update and replace operations
        Parameters:
        upsert - the upsert flag
        Returns:
        this for fluency
      • isMulti

        public boolean isMulti()
        Returns the multi flag, used by update and delete operations
        Returns:
        the multi flag
      • setMulti

        public BulkOperation setMulti​(boolean multi)
        Sets the multi flag, used by update and delete operations
        Parameters:
        multi - the mutli flag
        Returns:
        this for fluency
      • getHint

        public JsonObject getHint()
        Returns the operation hint
        Returns:
        the operation hint
      • setHint

        public BulkOperation setHint​(JsonObject hint)
        Sets the operation hint
        Parameters:
        hint - the operation hint
        Returns:
        this for fluency
      • getHintString

        public String getHintString()
        Returns the operation hint string
        Returns:
        the operation hint string
      • setHintString

        public BulkOperation setHintString​(String hintString)
        Sets the operation hint string
        Parameters:
        hintString - the operation hint string
        Returns:
        this for fluency
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object