Package org.graylog2.database
Class PersistedServiceImpl
java.lang.Object
org.graylog2.database.PersistedServiceImpl
- All Implemented Interfaces:
PersistedService
- Direct Known Subclasses:
AccessTokenServiceImpl
,IndexFailureServiceImpl
,InputServiceImpl
,MongoDBSessionServiceImpl
,NodeServiceImpl
,NotificationServiceImpl
,PreflightConfigService
,StreamRuleServiceImpl
,StreamServiceImpl
,SystemMessageServiceImpl
,UserServiceImpl
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends Persisted>
com.mongodb.DBCollectioncollection
(Class<T> modelClass) protected <T extends Persisted>
com.mongodb.DBCollectioncollection
(T model) protected long
protected <T extends Persisted>
longprotected List<com.mongodb.DBObject>
cursorToList
(com.mongodb.DBCursor cursor) protected int
<T extends Persisted>
intdestroy
(T model) <T extends Persisted>
intdestroyAll
(Class<T> modelClass) protected <T extends Persisted>
intdestroyAll
(Class<T> modelClass, com.mongodb.DBObject query) protected int
destroyAll
(String collectionName) protected <T extends Persisted>
voidembed
(T model, String key, EmbeddedPersistable o) protected void
fieldTransformations
(Map<String, Object> doc) protected com.mongodb.DBObject
protected com.mongodb.DBObject
protected <T extends Persisted>
com.mongodb.DBObjectprotected <T extends Persisted>
com.mongodb.DBObjectprotected <T extends Persisted>
com.mongodb.DBObjectprotected <T extends Persisted>
com.mongodb.DBObjectprotected com.mongodb.DBObject
protected List<com.mongodb.DBObject>
query
(com.mongodb.DBObject query, com.mongodb.DBCollection collection) protected List<com.mongodb.DBObject>
query
(Class<T> modelClass, com.mongodb.DBObject query, com.mongodb.DBObject sort, int limit, int offset) protected <T extends Persisted>
voidremoveEmbedded
(T model, String key, String searchId) protected <T extends Persisted>
voidremoveEmbedded
(T model, String arrayKey, String key, String searchId) save
(T model) saveWithoutValidation
(T model) protected <T extends Persisted>
longtotalCount
(Class<T> modelClass) protected long
totalCount
(String collectionName) <T extends Persisted>
Map<String,List<ValidationResult>> validate
(T model) <T extends Persisted>
Map<String,List<ValidationResult>>
-
Field Details
-
mongoConnection
-
-
Constructor Details
-
PersistedServiceImpl
-
-
Method Details
-
get
-
get
-
get
-
query
-
query
protected List<com.mongodb.DBObject> query(com.mongodb.DBObject query, com.mongodb.DBCollection collection) -
query
-
query
-
query
-
count
-
count
-
collection
-
collection
-
cursorToList
-
findOne
-
findOne
-
findOne
-
findOne
protected com.mongodb.DBObject findOne(com.mongodb.DBObject query, com.mongodb.DBObject sort, String collectioName) -
totalCount
-
totalCount
-
destroy
- Specified by:
destroy
in interfacePersistedService
-
destroyAll
- Specified by:
destroyAll
in interfacePersistedService
-
destroyAll
-
destroy
-
destroyAll
-
save
- Specified by:
save
in interfacePersistedService
- Throws:
ValidationException
-
saveWithoutValidation
- Specified by:
saveWithoutValidation
in interfacePersistedService
-
validate
public <T extends Persisted> Map<String,List<ValidationResult>> validate(T model, Map<String, Object> fields) - Specified by:
validate
in interfacePersistedService
-
validate
public Map<String,List<ValidationResult>> validate(Map<String, Validator> validators, Map<String, Object> fields) - Specified by:
validate
in interfacePersistedService
-
validate
- Specified by:
validate
in interfacePersistedService
-
embed
protected <T extends Persisted> void embed(T model, String key, EmbeddedPersistable o) throws ValidationException - Throws:
ValidationException
-
removeEmbedded
-
removeEmbedded
-
fieldTransformations
-