public class PersistedServiceImpl extends Object implements PersistedService
Modifier and Type | Field and Description |
---|---|
MongoConnection |
mongoConnection |
Modifier | Constructor and Description |
---|---|
protected |
PersistedServiceImpl(MongoConnection mongoConnection) |
Modifier and Type | Method and Description |
---|---|
protected <T extends Persisted> |
collection(Class<T> modelClass) |
protected <T extends Persisted> |
collection(T model) |
protected <T extends Persisted> |
count(Class<T> modelClass,
com.mongodb.DBObject query) |
protected long |
count(com.mongodb.DBObject query,
String collectionName) |
protected List<com.mongodb.DBObject> |
cursorToList(com.mongodb.DBCursor cursor) |
protected int |
destroy(com.mongodb.DBObject query,
String collectionName) |
<T extends Persisted> |
destroy(T model) |
<T extends Persisted> |
destroyAll(Class<T> modelClass) |
protected <T extends Persisted> |
destroyAll(Class<T> modelClass,
com.mongodb.DBObject query) |
protected int |
destroyAll(String collectionName) |
protected <T extends Persisted> |
embed(T model,
String key,
EmbeddedPersistable o) |
protected <T extends Persisted> |
findOne(Class<T> model,
com.mongodb.DBObject query) |
protected <T extends Persisted> |
findOne(Class<T> model,
com.mongodb.DBObject query,
com.mongodb.DBObject sort) |
protected com.mongodb.DBObject |
findOne(com.mongodb.DBObject query,
com.mongodb.DBObject sort,
String collectioName) |
protected com.mongodb.DBObject |
findOne(com.mongodb.DBObject query,
String collectionName) |
protected <T extends Persisted> |
get(Class<T> modelClass,
org.bson.types.ObjectId id) |
protected <T extends Persisted> |
get(Class<T> modelClass,
String id) |
protected com.mongodb.DBObject |
get(org.bson.types.ObjectId id,
String collectionName) |
protected <T extends Persisted> |
query(Class<T> modelClass,
com.mongodb.DBObject query) |
protected <T extends Persisted> |
query(Class<T> modelClass,
com.mongodb.DBObject query,
com.mongodb.DBObject sort) |
protected <T extends Persisted> |
query(Class<T> modelClass,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
int limit,
int offset) |
protected List<com.mongodb.DBObject> |
query(com.mongodb.DBObject query,
com.mongodb.DBCollection collection) |
protected List<com.mongodb.DBObject> |
query(com.mongodb.DBObject query,
String collectionName) |
protected <T extends Persisted> |
removeEmbedded(T model,
String key,
String searchId) |
protected <T extends Persisted> |
removeEmbedded(T model,
String arrayKey,
String key,
String searchId) |
<T extends Persisted> |
save(T model) |
<T extends Persisted> |
saveWithoutValidation(T model) |
protected <T extends Persisted> |
totalCount(Class<T> modelClass) |
protected long |
totalCount(String collectionName) |
Map<String,List<ValidationResult>> |
validate(Map<String,Validator> validators,
Map<String,Object> fields) |
<T extends Persisted> |
validate(T model) |
<T extends Persisted> |
validate(T model,
Map<String,Object> fields) |
public final MongoConnection mongoConnection
protected PersistedServiceImpl(MongoConnection mongoConnection)
protected com.mongodb.DBObject get(org.bson.types.ObjectId id, String collectionName)
protected <T extends Persisted> com.mongodb.DBObject get(Class<T> modelClass, org.bson.types.ObjectId id)
protected List<com.mongodb.DBObject> query(com.mongodb.DBObject query, com.mongodb.DBCollection collection)
protected <T extends Persisted> List<com.mongodb.DBObject> query(Class<T> modelClass, com.mongodb.DBObject query)
protected <T extends Persisted> List<com.mongodb.DBObject> query(Class<T> modelClass, com.mongodb.DBObject query, com.mongodb.DBObject sort)
protected <T extends Persisted> List<com.mongodb.DBObject> query(Class<T> modelClass, com.mongodb.DBObject query, com.mongodb.DBObject sort, int limit, int offset)
protected long count(com.mongodb.DBObject query, String collectionName)
protected <T extends Persisted> com.mongodb.DBCollection collection(T model)
protected List<com.mongodb.DBObject> cursorToList(com.mongodb.DBCursor cursor)
protected <T extends Persisted> com.mongodb.DBObject findOne(Class<T> model, com.mongodb.DBObject query)
protected <T extends Persisted> com.mongodb.DBObject findOne(Class<T> model, com.mongodb.DBObject query, com.mongodb.DBObject sort)
protected com.mongodb.DBObject findOne(com.mongodb.DBObject query, String collectionName)
protected com.mongodb.DBObject findOne(com.mongodb.DBObject query, com.mongodb.DBObject sort, String collectioName)
protected long totalCount(String collectionName)
public <T extends Persisted> int destroy(T model)
destroy
in interface PersistedService
public <T extends Persisted> int destroyAll(Class<T> modelClass)
destroyAll
in interface PersistedService
protected int destroyAll(String collectionName)
protected int destroy(com.mongodb.DBObject query, String collectionName)
protected <T extends Persisted> int destroyAll(Class<T> modelClass, com.mongodb.DBObject query)
public <T extends Persisted> String save(T model) throws ValidationException
save
in interface PersistedService
ValidationException
public <T extends Persisted> String saveWithoutValidation(T model)
saveWithoutValidation
in interface PersistedService
public <T extends Persisted> Map<String,List<ValidationResult>> validate(T model, Map<String,Object> fields)
validate
in interface PersistedService
public Map<String,List<ValidationResult>> validate(Map<String,Validator> validators, Map<String,Object> fields)
validate
in interface PersistedService
public <T extends Persisted> Map<String,List<ValidationResult>> validate(T model)
validate
in interface PersistedService
protected <T extends Persisted> void embed(T model, String key, EmbeddedPersistable o) throws ValidationException
ValidationException
protected <T extends Persisted> void removeEmbedded(T model, String key, String searchId)
Copyright © 2012–2019 Graylog, Inc.. All rights reserved.