Package fr.gouv.vitam.common.database.server

# Class DbRequestHelper

java.lang.Object
fr.gouv.vitam.common.database.server.DbRequestHelper

public class DbRequestHelper extends Object
DbRequest Helper common for Single and Multiple

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CONSISTENCY_ERROR_THE_DOCUMENT_GUID_S_IN_ES_IS_NOT_IN_MONGO_DB_ANYMORE_TENANT_S_REQUEST_ID_S`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `isDuplicateKeyError(Exception e)`
  Helper to detect if document already exists so update needed instead of insert
  `static <T extends VitamDocument<?>>
  com.mongodb.client.MongoCursor<T>`
  `selectMongoDbExecuteThroughFakeMongoCursor(VitamCollection<T> collection, RequestParserSingle parser, List<String> list, List<Double> scores)`
  Private method for select using MongoDb from Elasticsearch result

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CONSISTENCY_ERROR_THE_DOCUMENT_GUID_S_IN_ES_IS_NOT_IN_MONGO_DB_ANYMORE_TENANT_S_REQUEST_ID_S

    public static final String CONSISTENCY_ERROR_THE_DOCUMENT_GUID_S_IN_ES_IS_NOT_IN_MONGO_DB_ANYMORE_TENANT_S_REQUEST_ID_S
    See Also:
      - Constant Field Values

- ## Method Details

  - ### isDuplicateKeyError

    public static boolean isDuplicateKeyError(Exception e)
    Helper to detect if document already exists so update needed instead of insert
    Returns:
      true if an insert that should be an Update, else False

  - ### selectMongoDbExecuteThroughFakeMongoCursor

    public static <T extends VitamDocument<?>> com.mongodb.client.MongoCursor<T> selectMongoDbExecuteThroughFakeMongoCursor(VitamCollection<T> collection, RequestParserSingle parser, List<String> list, List<Double> scores) throws InvalidParseOperationException, VitamDBException
    Private method for select using MongoDb from Elasticsearch result
    Parameters:
      `collection` -
      `parser` -
      `list` - list of Ids
      `scores` - can be null, containing scores
    Returns:
      MongoCursor of VitamDocument
    Throws:
      `InvalidParseOperationException` - when query is not correct
      `InvalidCreateOperationException`
      `VitamDBException`