public class VitamMongoRepository extends Object implements VitamRepository
| Constructor and Description |
|---|
VitamMongoRepository(com.mongodb.client.MongoCollection<org.bson.Document> collection)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
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> |
findByIdentifier(String identifier)
Find by identifier for collections cross tenant
|
Optional<org.bson.Document> |
findByIdentifierAndTenant(String identifier,
Integer tenant)
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
|
Optional<org.bson.Document> |
getByID(String id,
Integer tenant)
Get vitam document by id
|
long |
purge()
Remove by tenant for collection cross-tenant
|
long |
purge(Integer tenant)
Remove by tenant for collection multi-tenant
|
void |
remove(String id,
Integer tenant)
Remove document by id
|
void |
removeByNameAndTenant(String name,
Integer tenant)
Remove collection by name and tenant
|
void |
save(org.bson.Document document)
Save vitam document
|
void |
save(List<org.bson.Document> documents)
Save a list of vitam documents
|
VitamRepositoryStatus |
saveOrUpdate(org.bson.Document document)
Save or updatevitam document
|
void |
saveOrUpdate(List<org.bson.Document> documents)
Save or update a list of vitam documents
|
public static final String NAME
public VitamMongoRepository(com.mongodb.client.MongoCollection<org.bson.Document> collection)
collection - the collection on which to perform operationpublic void save(org.bson.Document document)
throws DatabaseException
VitamRepositorysave in interface VitamRepositorydocument - the document to be savedDatabaseException - in case error with database occurspublic VitamRepositoryStatus saveOrUpdate(org.bson.Document document) throws DatabaseException
VitamRepositorysaveOrUpdate in interface VitamRepositorydocument - the document to be savedDatabaseException - in case error with database occurspublic void save(List<org.bson.Document> documents) throws DatabaseException
VitamRepositorysave in interface VitamRepositorydocuments - the list of documents to be savedDatabaseException - in case error with database occurspublic void saveOrUpdate(List<org.bson.Document> documents) throws DatabaseException
VitamRepositorysaveOrUpdate in interface VitamRepositorydocuments - the list of document to be saved orupdatedDatabaseException - in case error with database occurspublic void remove(String id, Integer tenant) throws DatabaseException
VitamRepositoryremove in interface VitamRepositoryid - the id of the document to be removedtenant - the tenant of the document to be removedDatabaseException - in case error with database occurspublic void removeByNameAndTenant(String name, Integer tenant) throws DatabaseException
VitamRepositoryremoveByNameAndTenant in interface VitamRepositoryname - the name of the collection to be removedtenant - the tenant of the collection to be removedDatabaseException - in case error with database occurspublic long purge(Integer tenant) throws DatabaseException
VitamRepositorypurge in interface VitamRepositorytenant - the tenantDatabaseException - in case error with database occurspublic long purge()
throws DatabaseException
VitamRepositorypurge in interface VitamRepositoryDatabaseException - in case error with database occurspublic Optional<org.bson.Document> getByID(String id, Integer tenant) throws DatabaseException
VitamRepositorygetByID in interface VitamRepositoryid - the document idtenant - the tenant of the documentDatabaseException - in case error with database occurspublic Optional<org.bson.Document> findByIdentifierAndTenant(String identifier, Integer tenant) throws DatabaseException
VitamRepositoryfindByIdentifierAndTenant in interface VitamRepositoryidentifier - the identifier of the documenttenant - the tenant of the documentDatabaseException - in case error with database occurspublic Optional<org.bson.Document> findByIdentifier(String identifier) throws DatabaseException
VitamRepositoryfindByIdentifier in interface VitamRepositoryidentifier - the identifier of the documentDatabaseException - in case error with database occurspublic com.mongodb.client.FindIterable<org.bson.Document> findByFieldsDocuments(Map<String,String> fields, int mongoBatchSize, Integer tenant)
VitamRepositoryfindByFieldsDocuments in interface VitamRepositoryfields - list of fields for filtermongoBatchSize - mongoBatchSizetenant - tenant idpublic com.mongodb.client.FindIterable<org.bson.Document> findDocuments(int mongoBatchSize,
Integer tenant)
VitamRepositoryfindDocuments in interface VitamRepositorymongoBatchSize - mongoBatchSizetenant - tenant idpublic com.mongodb.client.FindIterable<org.bson.Document> findDocuments(int mongoBatchSize)
VitamRepositoryfindDocuments in interface VitamRepositorymongoBatchSize - mongoBatchSizeCopyright © 2018 Vitam. All rights reserved.