Interface VitamRepository

All Known Implementing Classes:
VitamMongoRepository

public interface VitamRepository
This repository is a specification of vitam data management
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Count occurence of documents
    long
    count(org.bson.conversions.Bson filter)
    Count occurence of documents
    void
    delete(List<String> ids, int tenant)
    Deleted all documents by ids
    com.mongodb.client.FindIterable<org.bson.Document>
    findByFieldsDocuments(Map<String,String> fields, int mongoBatchSize, Integer tenant)
    Return iterable over document for the given collection for a specific tenant and fields
    Optional<org.bson.Document>
    Find by identifier for collections cross tenant
    Optional<org.bson.Document>
    find by identifier for all tenant
    com.mongodb.client.FindIterable<org.bson.Document>
    findDocuments(int mongoBatchSize)
    Return iterable over document for the given collection
    com.mongodb.client.FindIterable<org.bson.Document>
    findDocuments(int mongoBatchSize, Integer tenant)
    Return iterable over document for the given collection for a specific tenant
    com.mongodb.client.FindIterable<org.bson.Document>
    findDocuments(Collection<String> ids, org.bson.conversions.Bson projection)
    Find collection of document by there id and return only projection fields
    com.mongodb.client.FindIterable<org.bson.Document>
    findDocuments(org.bson.conversions.Bson query, int mongoBatchSize)
    Return iterable over document for the given collection
    Optional<org.bson.Document>
    getByID(String id, Integer tenant)
    Get vitam document by id
    long
    Be careful when using this method Remove by tenant for collection cross-tenant
    long
    purge(Integer tenant)
    Be careful when using this method Remove by tenant for collection multi-tenant
    void
    remove(String id, Integer tenant)
    Remove document by id
    long
    remove(org.bson.conversions.Bson query)
    Be careful when using this method Remove by query
    void
    Be careful when using this method Remove collection by name and tenant
    void
    save(List<org.bson.Document> documents)
    Save a list of vitam documents
    void
    save(org.bson.Document document)
    Save vitam document
    void
    saveOrUpdate(List<org.bson.Document> documents)
    Save or update a list of vitam documents
    saveOrUpdate(org.bson.Document document)
    Save or updatevitam document
    void
    update(List<com.mongodb.client.model.WriteModel<org.bson.Document>> updates)
    Used to execute a bulk update If document exists then update If document do not exists then create document throw Duplicate key exception if document exists by _id but not exists by filter in the update one model
  • Method Details

    • save

      void save(org.bson.Document document) throws DatabaseException
      Save vitam document
      Parameters:
      document - the document to be saved
      Throws:
      DatabaseException - in case error with database occurs
    • saveOrUpdate

      VitamRepositoryStatus saveOrUpdate(org.bson.Document document) throws DatabaseException
      Save or updatevitam document
      Parameters:
      document - the document to be saved
      Returns:
      status CREATED or UPDATED
      Throws:
      DatabaseException - in case error with database occurs
    • save

      void save(List<org.bson.Document> documents) throws DatabaseException
      Save a list of vitam documents
      Parameters:
      documents - the list of documents to be saved
      Throws:
      DatabaseException - in case error with database occurs
    • saveOrUpdate

      void saveOrUpdate(List<org.bson.Document> documents) throws DatabaseException
      Save or update a list of vitam documents
      Parameters:
      documents - the list of document to be saved orupdated
      Throws:
      DatabaseException - in case error with database occurs
    • update

      void update(List<com.mongodb.client.model.WriteModel<org.bson.Document>> updates) throws DatabaseException
      Used to execute a bulk update If document exists then update If document do not exists then create document throw Duplicate key exception if document exists by _id but not exists by filter in the update one model
      Parameters:
      updates -
      Throws:
      DatabaseException
    • remove

      void remove(String id, Integer tenant) throws DatabaseException
      Remove document by id
      Parameters:
      id - the id of the document to be removed
      tenant - the tenant of the document to be removed
      Throws:
      DatabaseException - in case error with database occurs
    • remove

      long remove(org.bson.conversions.Bson query) throws DatabaseException
      Be careful when using this method Remove by query
      Parameters:
      query -
      Throws:
      DatabaseException
    • removeByNameAndTenant

      void removeByNameAndTenant(String name, Integer tenant) throws DatabaseException
      Be careful when using this method Remove collection by name and tenant
      Parameters:
      name - the name of the collection to be removed
      tenant - the tenant of the collection to be removed
      Throws:
      DatabaseException - in case error with database occurs
    • purge

      long purge(Integer tenant) throws DatabaseException
      Be careful when using this method Remove by tenant for collection multi-tenant
      Parameters:
      tenant - the tenant
      Returns:
      the number of deleted documents
      Throws:
      DatabaseException - in case error with database occurs
    • purge

      long purge() throws DatabaseException
      Be careful when using this method Remove by tenant for collection cross-tenant
      Returns:
      number of purged documents
      Throws:
      DatabaseException - in case error with database occurs
    • getByID

      Optional<org.bson.Document> getByID(String id, Integer tenant) throws DatabaseException
      Get vitam document by id
      Parameters:
      id - the document id
      tenant - the tenant of the document
      Returns:
      the document if found
      Throws:
      DatabaseException - in case error with database occurs
    • findByIdentifierAndTenant

      Optional<org.bson.Document> findByIdentifierAndTenant(String identifier, Integer tenant) throws DatabaseException
      find by identifier for all tenant
      Parameters:
      identifier - the identifier of the document
      tenant - the tenant of the document
      Returns:
      the document if found
      Throws:
      DatabaseException - in case error with database occurs
    • findByIdentifier

      Optional<org.bson.Document> findByIdentifier(String identifier) throws DatabaseException
      Find by identifier for collections cross tenant
      Parameters:
      identifier - the identifier of the document
      Returns:
      the document if found
      Throws:
      DatabaseException - in case error with database occurs
    • findDocuments

      com.mongodb.client.FindIterable<org.bson.Document> findDocuments(Collection<String> ids, org.bson.conversions.Bson projection)
      Find collection of document by there id and return only projection fields
      Parameters:
      ids - list of documents id
      projection - the fields wanted in the result
      Returns:
      An iterable of documents
    • findDocuments

      com.mongodb.client.FindIterable<org.bson.Document> findDocuments(int mongoBatchSize, Integer tenant)
      Return iterable over document for the given collection for a specific tenant
      Parameters:
      mongoBatchSize - mongoBatchSize
      tenant - tenant id
      Returns:
      iterable over document for the given collection
    • findByFieldsDocuments

      com.mongodb.client.FindIterable<org.bson.Document> findByFieldsDocuments(Map<String,String> fields, int mongoBatchSize, Integer tenant)
      Return iterable over document for the given collection for a specific tenant and fields
      Parameters:
      fields - list of fields for filter
      mongoBatchSize - mongoBatchSize
      tenant - tenant id
      Returns:
      iterable over document for the given collection
    • findDocuments

      com.mongodb.client.FindIterable<org.bson.Document> findDocuments(int mongoBatchSize)
      Return iterable over document for the given collection
      Parameters:
      mongoBatchSize - mongoBatchSize
      Returns:
      iterable over document for the given collection
    • count

      long count()
      Count occurence of documents
      Returns:
      the number of documents
    • count

      long count(org.bson.conversions.Bson filter)
      Count occurence of documents
      Parameters:
      filter - filtre
      Returns:
      the number of documents
    • findDocuments

      com.mongodb.client.FindIterable<org.bson.Document> findDocuments(org.bson.conversions.Bson query, int mongoBatchSize)
      Return iterable over document for the given collection
      Parameters:
      query - the mongo query to be executed
      mongoBatchSize - mongoBatchSize
      Returns:
      iterable over document for the given collection
    • delete

      void delete(List<String> ids, int tenant) throws DatabaseException
      Deleted all documents by ids
      Parameters:
      ids -
      tenant -
      Throws:
      DatabaseException