Class ClientMongoRepository

java.lang.Object
io.github.marcopaglio.booking.repository.mongo.MongoRepository<Client>
io.github.marcopaglio.booking.repository.mongo.ClientMongoRepository
All Implemented Interfaces:
ClientRepository

public class ClientMongoRepository extends MongoRepository<Client> implements ClientRepository
Implementation of repository layer through MongoDB for Client entities of the booking application.
  • Field Summary

    Fields inherited from class io.github.marcopaglio.booking.repository.mongo.MongoRepository

    collection, session
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClientMongoRepository(com.mongodb.client.MongoClient client, com.mongodb.client.ClientSession session, String databaseName)
    Constructs a repository layer for Client entities using MongoDB database.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(Client client)
    Removes the unique specified client from the MongoDB database, if it exists, otherwise it does nothing.
    Retrieves all the clients from the MongoDB database in a list.
    Retrieves the unique client with the specified identifier from the MongoDB database, if it exists.
    findByName(String firstName, String lastName)
    Retrieves the unique client with the specified name and surname from the MongoDB database, if it exists.
    save(Client client)
    Inserts a new Client in the MongoDB database or saves changes of an existing one.

    Methods inherited from class io.github.marcopaglio.booking.repository.mongo.MongoRepository

    getCollection

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClientMongoRepository

      public ClientMongoRepository(com.mongodb.client.MongoClient client, com.mongodb.client.ClientSession session, String databaseName)
      Constructs a repository layer for Client entities using MongoDB database. The construction generates and configures a collection for using by the repository.
      Parameters:
      client - the MongoClient used to retrieve the collection.
      session - the ClientSession used to communicate with MongoDB database.
      databaseName - the name of the database in which the repository works.
  • Method Details