public class MongoStoreImpl extends Object implements MongoStore
Constructor and Description |
---|
MongoStoreImpl(com.mongodb.DB database,
boolean clearCollectionsOnStartup,
Class<?>[] managedEntityTypes) |
Modifier and Type | Method and Description |
---|---|
void |
addAppObjectConverter(Mapper<?,?> mapper) |
void |
addDBObjectConverter(Mapper<?,?> mapper) |
protected void |
clearManagedCollections(Class<?>[] managedEntityTypes) |
protected <T extends MongoIdentifiableEntity> |
convertCursor(Class<T> type,
com.mongodb.DBCursor cursor,
MongoStoreInvocationContext context) |
protected <T extends MongoIdentifiableEntity> |
convertDBObjectToEntity(Class<T> type,
com.mongodb.DBObject dbObject,
MongoStoreInvocationContext context) |
static ModelException |
convertException(com.mongodb.MongoException e) |
<T extends MongoIdentifiableEntity> |
countEntities(Class<T> type,
com.mongodb.DBObject query,
MongoStoreInvocationContext context) |
protected void |
createIndex(com.mongodb.DBCollection dbCollection,
MongoIndex index) |
protected void |
dropDatabase() |
protected com.mongodb.DBCollection |
getDBCollectionForType(Class<?> type) |
EntityInfo |
getEntityInfo(Class<?> entityClass) |
protected void |
initManagedCollections(Class<?>[] managedEntityTypes) |
void |
insertEntity(MongoIdentifiableEntity entity,
MongoStoreInvocationContext context)
Insert new entity
|
<T extends MongoIdentifiableEntity> |
loadEntities(Class<T> type,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
int firstResult,
int maxResults,
MongoStoreInvocationContext context) |
<T extends MongoIdentifiableEntity> |
loadEntities(Class<T> type,
com.mongodb.DBObject query,
MongoStoreInvocationContext context) |
<T extends MongoIdentifiableEntity> |
loadEntity(Class<T> type,
String id,
MongoStoreInvocationContext context) |
<T extends MongoIdentifiableEntity> |
loadSingleEntity(Class<T> type,
com.mongodb.DBObject query,
MongoStoreInvocationContext context) |
<S> boolean |
pullItemFromList(MongoIdentifiableEntity entity,
String listPropertyName,
S itemToPull,
MongoStoreInvocationContext context) |
<S> boolean |
pushItemToList(MongoIdentifiableEntity entity,
String listPropertyName,
S itemToPush,
boolean skipIfAlreadyPresent,
MongoStoreInvocationContext context) |
boolean |
removeEntities(Class<? extends MongoIdentifiableEntity> type,
com.mongodb.DBObject query,
MongoStoreInvocationContext context) |
boolean |
removeEntity(Class<? extends MongoIdentifiableEntity> type,
String id,
MongoStoreInvocationContext context) |
boolean |
removeEntity(MongoIdentifiableEntity entity,
MongoStoreInvocationContext context) |
void |
updateEntity(MongoIdentifiableEntity entity,
MongoStoreInvocationContext context)
Update existing entity
|
public MongoStoreImpl(com.mongodb.DB database, boolean clearCollectionsOnStartup, Class<?>[] managedEntityTypes)
protected void dropDatabase()
protected void clearManagedCollections(Class<?>[] managedEntityTypes)
protected void initManagedCollections(Class<?>[] managedEntityTypes)
protected void createIndex(com.mongodb.DBCollection dbCollection, MongoIndex index)
public void insertEntity(MongoIdentifiableEntity entity, MongoStoreInvocationContext context)
MongoStore
insertEntity
in interface MongoStore
entity
- to insertpublic static ModelException convertException(com.mongodb.MongoException e)
public void updateEntity(MongoIdentifiableEntity entity, MongoStoreInvocationContext context)
MongoStore
updateEntity
in interface MongoStore
entity
- to updatepublic <T extends MongoIdentifiableEntity> T loadEntity(Class<T> type, String id, MongoStoreInvocationContext context)
loadEntity
in interface MongoStore
public <T extends MongoIdentifiableEntity> T loadSingleEntity(Class<T> type, com.mongodb.DBObject query, MongoStoreInvocationContext context)
loadSingleEntity
in interface MongoStore
public <T extends MongoIdentifiableEntity> List<T> loadEntities(Class<T> type, com.mongodb.DBObject query, MongoStoreInvocationContext context)
loadEntities
in interface MongoStore
public <T extends MongoIdentifiableEntity> List<T> loadEntities(Class<T> type, com.mongodb.DBObject query, com.mongodb.DBObject sort, int firstResult, int maxResults, MongoStoreInvocationContext context)
loadEntities
in interface MongoStore
public <T extends MongoIdentifiableEntity> int countEntities(Class<T> type, com.mongodb.DBObject query, MongoStoreInvocationContext context)
countEntities
in interface MongoStore
public boolean removeEntity(MongoIdentifiableEntity entity, MongoStoreInvocationContext context)
removeEntity
in interface MongoStore
public boolean removeEntity(Class<? extends MongoIdentifiableEntity> type, String id, MongoStoreInvocationContext context)
removeEntity
in interface MongoStore
public boolean removeEntities(Class<? extends MongoIdentifiableEntity> type, com.mongodb.DBObject query, MongoStoreInvocationContext context)
removeEntities
in interface MongoStore
public <S> boolean pushItemToList(MongoIdentifiableEntity entity, String listPropertyName, S itemToPush, boolean skipIfAlreadyPresent, MongoStoreInvocationContext context)
pushItemToList
in interface MongoStore
public <S> boolean pullItemFromList(MongoIdentifiableEntity entity, String listPropertyName, S itemToPull, MongoStoreInvocationContext context)
pullItemFromList
in interface MongoStore
public void addAppObjectConverter(Mapper<?,?> mapper)
public void addDBObjectConverter(Mapper<?,?> mapper)
public EntityInfo getEntityInfo(Class<?> entityClass)
protected <T extends MongoIdentifiableEntity> List<T> convertCursor(Class<T> type, com.mongodb.DBCursor cursor, MongoStoreInvocationContext context)
protected <T extends MongoIdentifiableEntity> T convertDBObjectToEntity(Class<T> type, com.mongodb.DBObject dbObject, MongoStoreInvocationContext context)
protected com.mongodb.DBCollection getDBCollectionForType(Class<?> type)
Copyright © 2015. All Rights Reserved.