Class MongoBulkInsertHelper<F,E extends F>

java.lang.Object
io.clonecloudstore.common.database.mongo.MongoBulkInsertHelper<F,E>
Type Parameters:
E - the DTO type to use

public class MongoBulkInsertHelper<F,E extends F> extends Object
Mongo implementation of the BulkHelper
  • Field Details

    • MAX_BATCH

      public static final int MAX_BATCH
      See Also:
    • repositoryBase

      protected final ExtendedPanacheMongoRepositoryBase<F,E extends F> repositoryBase
    • listInsert

      protected final List<E extends F> listInsert
    • listFindQuery

      protected final List<org.bson.Document> listFindQuery
    • listUpdate

      protected final List<org.bson.Document> listUpdate
    • listInsertForUpdate

      protected final List<E extends F> listInsertForUpdate
  • Constructor Details

  • Method Details

    • addToInsertBulk

      public boolean addToInsertBulk(E object)
      Parameters:
      object - the element to persist within a bulk operation
      Returns:
      True if bulk operation reaches the limit
    • getMaxBatch

      protected int getMaxBatch()
      Returns:
      the current max batch value
    • bulkPersist

      public MongoBulkInsertHelper<F,E> bulkPersist() throws CcsDbException
      Persist all elements using bulk operation
      Returns:
      this
      Throws:
      CcsDbException
    • addToUpsertBulk

      public boolean addToUpsertBulk(org.bson.Document findQuery, E original)
      Parameters:
      findQuery - the find query associated in order with Upsert
      original - the original one for insert (null means update only)
      Returns:
      True if bulk operation reaches the limit
    • addToUpdateBulk

      public boolean addToUpdateBulk(org.bson.Document findQuery, org.bson.Document update)
      Parameters:
      findQuery - the find query associated in order with Upsert
      update - the update part
      Returns:
      True if bulk operation reaches the limit
    • bulkUpsert

      public MongoBulkInsertHelper<F,E> bulkUpsert() throws CcsDbException
      Upsert Persist all elements using bulk operation
      Returns:
      this
      Throws:
      CcsDbException