Interface MongoStorageService
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
MongoStorageServiceImpl
public interface MongoStorageService extends java.io.Serializable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
downloadBinary(java.lang.String id)
This method does download data in database.byte[]
downloadBinary(java.lang.String dbName, java.lang.String collectionName, java.lang.Object doc)
This method does download data in database.<T> org.springframework.data.domain.Page<T>
find(org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does find requests and returns data as page.java.util.Map<java.lang.String,java.lang.Object>
findDocuments(java.lang.String dbName, java.lang.String collectionName, java.util.Map<java.lang.String,java.lang.Object> filter)
This method does find documents and returns data as map.<T> java.util.stream.Stream<T>
findToStream(org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does find requests and returns data as stream.com.mongodb.client.gridfs.GridFSBucket
getBinaryStorage(java.lang.String dbName, java.lang.String binaryCollection)
This method does return database system.com.mongodb.client.MongoCollection<org.bson.Document>
getCollection(java.lang.String dbName, java.lang.String collectionName)
This method does return database collection.java.util.List<java.util.Map<java.lang.String,java.lang.String>>
getCollections(java.lang.String dbName)
This method retrieves a map, which can be processed in a database.com.mongodb.client.MongoDatabase
getDatabase(java.lang.String dbName)
This method does return database.org.bson.Document
getDocument(java.lang.String dbName, java.lang.String collectionName, java.lang.Object id)
This method does return database document.<T> T
insert(T item)
This method does insert database entity.java.lang.Object
insertDocument(java.lang.String dbName, java.lang.String collectionName, java.util.Map<java.lang.String,java.lang.Object> mapObject)
This method does insert database document.<T> void
remove(T item)
This method does remove database entity.void
removeBinary(java.lang.String id)
This method does remove database binary.void
removeBinary(java.lang.String dbName, java.lang.String binStorageName, java.lang.String json)
This method does remove database binary.void
removeDocument(java.lang.String dbName, java.lang.String collectionName, java.lang.String id)
This method does remove database document.<T> T
save(T item)
This method does save database entity.java.lang.Object
saveDocument(java.lang.String dbName, java.lang.String collectionName, java.lang.String id, java.util.Map<java.lang.String,java.lang.Object> mapObject)
This method does save database document.<T> org.springframework.data.domain.Page<T>
search(org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort, int skip, int limit)
This method does search requests and returns data as page.<T> org.springframework.data.domain.Page<T>
textSearch(java.lang.String[] searchTerms, org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort, int skip, int limit)
This method does search requests and returns data as page.<T> java.util.List<T>
textSearchAsList(java.lang.String[] searchTerms, org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does search requests and returns data as list.<T> org.springframework.data.domain.Page<T>
textSearchUnpaged(java.lang.String[] searchTerms, org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does search requests and returns data as page.java.lang.String
uploadBinary(java.util.Map<java.lang.String,java.lang.Object> metadata, org.springframework.web.multipart.MultipartFile file)
This method does upload database bean.
-
-
-
Method Detail
-
getDocument
org.bson.Document getDocument(java.lang.String dbName, java.lang.String collectionName, java.lang.Object id)
This method does return database document.- Parameters:
dbName
- database, from which will be returnedcollectionName
- database collection, from which will be returnedid
- database document, which will be returned- Returns:
- database document
-
getCollection
com.mongodb.client.MongoCollection<org.bson.Document> getCollection(java.lang.String dbName, java.lang.String collectionName)
This method does return database collection.- Parameters:
dbName
- database, from which will be returnedcollectionName
- database collection, which will be returned- Returns:
- database collection
-
getCollections
java.util.List<java.util.Map<java.lang.String,java.lang.String>> getCollections(java.lang.String dbName)
This method retrieves a map, which can be processed in a database.- Parameters:
dbName
- identification for database collection which will be retrieved- Returns:
- map-representation of data
-
getDatabase
com.mongodb.client.MongoDatabase getDatabase(java.lang.String dbName)
This method does return database.- Parameters:
dbName
- database, where will be returned- Returns:
- database
-
insertDocument
java.lang.Object insertDocument(java.lang.String dbName, java.lang.String collectionName, java.util.Map<java.lang.String,java.lang.Object> mapObject)
This method does insert database document.- Parameters:
dbName
- database, where will be savedcollectionName
- collection, where will be savedmapObject
- map-representation which converted in json object and inserted in database- Returns:
- inserted database document
-
insert
<T> T insert(T item)
This method does insert database entity.- Type Parameters:
T
- class type of entity- Parameters:
item
- database entity, which will be saved- Returns:
- inserted database entity
-
saveDocument
java.lang.Object saveDocument(java.lang.String dbName, java.lang.String collectionName, java.lang.String id, java.util.Map<java.lang.String,java.lang.Object> mapObject)
This method does save database document.- Parameters:
dbName
- database, where will be savedcollectionName
- collection, where will be savedid
- database document, which will be savedmapObject
- map-representation which converted in json object and inserted in database- Returns:
- saved database document
-
save
<T> T save(T item)
This method does save database entity.- Type Parameters:
T
- class type of entity- Parameters:
item
- database entity, which will be saved- Returns:
- saved database entity
-
removeDocument
void removeDocument(java.lang.String dbName, java.lang.String collectionName, java.lang.String id)
This method does remove database document.- Parameters:
dbName
- database, from which it will be removedcollectionName
- collection, from which it will be removedid
- database document, which will be removed
-
remove
<T> void remove(T item)
This method does remove database entity.- Type Parameters:
T
- class type of entity- Parameters:
item
- database entity, which will be removed
-
findDocuments
java.util.Map<java.lang.String,java.lang.Object> findDocuments(java.lang.String dbName, java.lang.String collectionName, java.util.Map<java.lang.String,java.lang.Object> filter)
This method does find documents and returns data as map.- Parameters:
dbName
- search querycollectionName
- field which sort and returned itemsfilter
- database entity class type which will be returned- Returns:
- database entities as map
-
findToStream
<T> java.util.stream.Stream<T> findToStream(org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does find requests and returns data as stream.- Type Parameters:
T
- class type of entity- Parameters:
query
- search querysort
- field which sort and returned itemsclazz
- database entity class type which will be returned- Returns:
- database entities as stream
-
find
<T> org.springframework.data.domain.Page<T> find(org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does find requests and returns data as page.- Type Parameters:
T
- class type of entity- Parameters:
query
- search querysort
- field which sort and returned itemsclazz
- database entity class type which will be returned- Returns:
- database entities as page
-
search
<T> org.springframework.data.domain.Page<T> search(org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort, int skip, int limit)
This method does search requests and returns data as page.- Type Parameters:
T
- class type of entity- Parameters:
query
- search querysort
- field which sort and returned itemsclazz
- database entity class type which will be returnedskip
- skip for returned itemslimit
- limit for returned items- Returns:
- database entities as page
-
textSearch
<T> org.springframework.data.domain.Page<T> textSearch(java.lang.String[] searchTerms, org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort, int skip, int limit)
This method does search requests and returns data as page.- Type Parameters:
T
- class type of entity- Parameters:
query
- search querysearchTerms
- fields list which filter and returned itemssort
- field which sort and returned itemsclazz
- database entity class type which will be returnedskip
- skip for returned itemslimit
- limit for returned items- Returns:
- database entities as page
-
textSearchUnpaged
<T> org.springframework.data.domain.Page<T> textSearchUnpaged(java.lang.String[] searchTerms, org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does search requests and returns data as page.- Type Parameters:
T
- class type of entity- Parameters:
query
- search querysearchTerms
- fields list which filter and returned itemssort
- field which sort and returned itemsclazz
- database entity class type which will be returned- Returns:
- database entities as page
-
textSearchAsList
<T> java.util.List<T> textSearchAsList(java.lang.String[] searchTerms, org.springframework.data.mongodb.core.query.Query query, java.lang.Class<T> clazz, java.lang.String sort)
This method does search requests and returns data as list.- Type Parameters:
T
- class type of entity- Parameters:
query
- search querysearchTerms
- fields list which filter and returned itemssort
- field which sort and returned itemsclazz
- database entity class type which will be returned- Returns:
- database entities as list
-
downloadBinary
byte[] downloadBinary(java.lang.String dbName, java.lang.String collectionName, java.lang.Object doc)
This method does download data in database.- Parameters:
dbName
- database, from which it will be downloadedcollectionName
- collection, from which it will be downloadeddoc
- database document, which will be downloaded- Returns:
- data as byte list
-
downloadBinary
byte[] downloadBinary(java.lang.String id)
This method does download data in database.- Parameters:
id
- unique id from file in storage- Returns:
- data as byte list
-
getBinaryStorage
com.mongodb.client.gridfs.GridFSBucket getBinaryStorage(java.lang.String dbName, java.lang.String binaryCollection)
This method does return database system.- Parameters:
dbName
- database, from which it will be returnedbinaryCollection
- collection, from which it will be returned- Returns:
- database system
-
uploadBinary
java.lang.String uploadBinary(java.util.Map<java.lang.String,java.lang.Object> metadata, org.springframework.web.multipart.MultipartFile file)
This method does upload database bean.- Parameters:
metadata
- meta information for uploaded documentfile
- file data, which will be uploaded- Returns:
- unique id from uploaded file
-
removeBinary
void removeBinary(java.lang.String dbName, java.lang.String binStorageName, java.lang.String json)
This method does remove database binary.- Parameters:
dbName
- database, from which it will be returnedbinStorageName
- database bean storage name, which it will be removedjson
- JSON-object of request contains an instructions for search binary
-
removeBinary
void removeBinary(java.lang.String id)
This method does remove database binary.- Parameters:
id
- unique id, which it will be removed
-
-