Klasse DUUIMongoDBStorage

java.lang.Object
org.texttechnologylab.duui.api.storage.DUUIMongoDBStorage

public class DUUIMongoDBStorage extends Object
A utility class for setting up and retrieving information about the database including its collections. Also contains utility methods for database operations.
Autor:
Cedric Borkowski
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static com.mongodb.client.MongoCollection<org.bson.Document>
    Utility functions for fast access to collections in the database.
    static void
    convertDateToTimestamp(org.bson.Document document, String fieldName)
    Convert a MongoDB date object to a timestamp.
    static org.bson.Document
    convertObjectIdToString(org.bson.Document document)
    Replaces the ObjectID object by a plain text representation of the id called oid.
    static org.bson.Document
    convertObjectIdToString(org.bson.Document document, String field, String newName)
    Replaces the ObjectID object by a plain text representation of the id.
    static com.mongodb.client.MongoCollection<org.bson.Document>
    Utility functions for fast access to collections in the database.
    static com.mongodb.client.MongoCollection<org.bson.Document>
    Utility functions for fast access to collections in the database.
    static com.mongodb.client.MongoClient
    Retrieve the existing MongoClient or instantiate a new one.
    static String
    Retrieve the connection URI to connect to a MongoClient.
    static List<String>
    getFilterOrDefault(spark.Request request, String queryParameter)
    For a given filter queryParameter extract the string from the request query parameters (queryParameter=A;B;C;D...) and return a List of filter names
    static com.mongodb.client.MongoCollection<org.bson.Document>
    Utility functions for fast access to collections in the database.
    static void
    init(Config config)
    Inject the Config for the application and initialize a
    Ungültige Referenz
    com.mongodb.MongoClient
    .
    static com.mongodb.client.MongoCollection<org.bson.Document>
    Utility functions for fast access to collections in the database.
    static com.mongodb.client.MongoCollection<org.bson.Document>
    Utility functions for fast access to collections in the database.
    static void
    Refactor all connections in the database to the new structure.
    static void
    updateDocument(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.conversions.Bson filter, org.bson.Document updates, Set<String> allowedUpdates)
    static void
    updateDocument(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.conversions.Bson filter, org.bson.Document updates, Set<String> allowedUpdates, boolean skipInvalid)
    Combine a Document containing key value pairs representing an update action into a merged BSON object.
    static com.mongodb.client.MongoCollection<org.bson.Document>
    Utility functions for fast access to collections in the database.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Methodendetails

    • convertObjectIdToString

      public static org.bson.Document convertObjectIdToString(org.bson.Document document)
      Replaces the ObjectID object by a plain text representation of the id called oid.
      Parameter:
      document - The document to convert.
    • convertObjectIdToString

      public static org.bson.Document convertObjectIdToString(org.bson.Document document, String field, String newName)
      Replaces the ObjectID object by a plain text representation of the id.
      Parameter:
      document - The document to convert.
      field - The name of the ObjectId field. Usually _id.
      newName - The new name of the field. Usually oid.
    • convertDateToTimestamp

      public static void convertDateToTimestamp(org.bson.Document document, String fieldName)
      Convert a MongoDB date object to a timestamp.
      Parameter:
      document - The document containing the date.
    • getConnectionURI

      public static String getConnectionURI()
      Retrieve the connection URI to connect to a MongoClient.
      Gibt zurück:
      The connection URI.
    • getClient

      public static com.mongodb.client.MongoClient getClient()
      Retrieve the existing MongoClient or instantiate a new one.
      Gibt zurück:
      A MongoClient instance.
    • init

      public static void init(Config config)
      Inject the Config for the application and initialize a
      Ungültige Referenz
      com.mongodb.MongoClient
      .
      Parameter:
      config - the configuration for the application.
    • refactorAllConnections

      public static void refactorAllConnections()
      Refactor all connections in the database to the new structure.
    • Pipelines

      public static com.mongodb.client.MongoCollection<org.bson.Document> Pipelines()
      Utility functions for fast access to collections in the database.
      Gibt zurück:
      A MongoCollection object.
    • Components

      public static com.mongodb.client.MongoCollection<org.bson.Document> Components()
      Utility functions for fast access to collections in the database.
      Gibt zurück:
      A MongoCollection object.
    • Users

      public static com.mongodb.client.MongoCollection<org.bson.Document> Users()
      Utility functions for fast access to collections in the database.
      Gibt zurück:
      A MongoCollection object.
    • Documents

      public static com.mongodb.client.MongoCollection<org.bson.Document> Documents()
      Utility functions for fast access to collections in the database.
      Gibt zurück:
      A MongoCollection object.
    • Processses

      public static com.mongodb.client.MongoCollection<org.bson.Document> Processses()
      Utility functions for fast access to collections in the database.
      Gibt zurück:
      A MongoCollection object.
    • Events

      public static com.mongodb.client.MongoCollection<org.bson.Document> Events()
      Utility functions for fast access to collections in the database.
      Gibt zurück:
      A MongoCollection object.
    • Globals

      public static com.mongodb.client.MongoCollection<org.bson.Document> Globals()
      Utility functions for fast access to collections in the database.
      Gibt zurück:
      A MongoCollection object.
    • updateDocument

      public static void updateDocument(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.conversions.Bson filter, org.bson.Document updates, Set<String> allowedUpdates, boolean skipInvalid)
      Combine a Document containing key value pairs representing an update action into a merged BSON object.
      Parameter:
      collection - The collection on which to perform the update
      filter - A set of filters so that only matching documents are updated.
      updates - The Document containing the updates.
      allowedUpdates - A Set of field names that are allowed to be updated.
      skipInvalid - Wether to skip invalid keys or return when encountered. Default true.
    • updateDocument

      public static void updateDocument(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.conversions.Bson filter, org.bson.Document updates, Set<String> allowedUpdates)
    • getFilterOrDefault

      public static List<String> getFilterOrDefault(spark.Request request, String queryParameter)
      For a given filter queryParameter extract the string from the request query parameters (queryParameter=A;B;C;D...) and return a List of filter names
      Parameter:
      request - the request object.
      queryParameter - the queryParameter of the query parameter
      Gibt zurück:
      a list of Strings to filter by.