org.keycloak.connections.mongo.impl

## Class MongoStoreImpl

- java.lang.Object
- - org.keycloak.connections.mongo.impl.MongoStoreImpl

- All Implemented Interfaces:
    MongoStore

      public class MongoStoreImpl
      extends Object
      implements MongoStore

  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MongoStoreImpl(com.mongodb.DB database, Class<?>[] managedEntityTypes)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAppObjectConverter(Mapper<?,?> mapper)`
    `void` | `addDBObjectConverter(Mapper<?,?> mapper)`
    `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)`
    `static ModelException` | `convertException(com.mongodb.MongoException e)`
    `<T extends MongoIdentifiableEntity> int` | `countEntities(Class<T> type, com.mongodb.DBObject query, MongoStoreInvocationContext context)`
    `protected void` | `dropDatabase()`
    `protected com.mongodb.DBCollection` | `getDBCollectionForType(Class<?> type)`
    `EntityInfo` | `getEntityInfo(Class<?> entityClass)`
    `void` | `insertEntity(MongoIdentifiableEntity entity, MongoStoreInvocationContext context)` Insert new entity
    `<T extends MongoIdentifiableEntity> List<T>` | `loadEntities(Class<T> type, com.mongodb.DBObject query, com.mongodb.DBObject sort, int firstResult, int maxResults, MongoStoreInvocationContext context)`
    `<T extends MongoIdentifiableEntity> List<T>` | `loadEntities(Class<T> type, com.mongodb.DBObject query, MongoStoreInvocationContext context)`
    `<T extends MongoIdentifiableEntity> T` | `loadEntity(Class<T> type, String id, MongoStoreInvocationContext context)`
    `<T extends MongoIdentifiableEntity> T` | `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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MongoStoreImpl

          public MongoStoreImpl(com.mongodb.DB database,
                        Class<?>[] managedEntityTypes)

  - ### Method Detail

    - #### dropDatabase

          protected void dropDatabase()

    - #### insertEntity

          public void insertEntity(MongoIdentifiableEntity entity,
                          MongoStoreInvocationContext context)

      Description copied from interface: `MongoStore`
      Insert new entity
      Specified by:
        `insertEntity` in interface `MongoStore`
      Parameters:
        `entity` - to insert

    - #### convertException

          public static ModelException convertException(com.mongodb.MongoException e)

    - #### updateEntity

          public void updateEntity(MongoIdentifiableEntity entity,
                          MongoStoreInvocationContext context)

      Description copied from interface: `MongoStore`
      Update existing entity
      Specified by:
        `updateEntity` in interface `MongoStore`
      Parameters:
        `entity` - to update

    - #### loadEntity

          public <T extends MongoIdentifiableEntity> T loadEntity(Class<T> type,
                                                         String id,
                                                         MongoStoreInvocationContext context)

      Specified by:
        `loadEntity` in interface `MongoStore`

    - #### loadSingleEntity

          public <T extends MongoIdentifiableEntity> T loadSingleEntity(Class<T> type,
                                                               com.mongodb.DBObject query,
                                                               MongoStoreInvocationContext context)

      Specified by:
        `loadSingleEntity` in interface `MongoStore`

    - #### loadEntities

          public <T extends MongoIdentifiableEntity> List<T> loadEntities(Class<T> type,
                                                                 com.mongodb.DBObject query,
                                                                 MongoStoreInvocationContext context)

      Specified by:
        `loadEntities` in interface `MongoStore`

    - #### loadEntities

          public <T extends MongoIdentifiableEntity> List<T> loadEntities(Class<T> type,
                                                                 com.mongodb.DBObject query,
                                                                 com.mongodb.DBObject sort,
                                                                 int firstResult,
                                                                 int maxResults,
                                                                 MongoStoreInvocationContext context)

      Specified by:
        `loadEntities` in interface `MongoStore`

    - #### countEntities

          public <T extends MongoIdentifiableEntity> int countEntities(Class<T> type,
                                                              com.mongodb.DBObject query,
                                                              MongoStoreInvocationContext context)

      Specified by:
        `countEntities` in interface `MongoStore`

    - #### removeEntity

          public boolean removeEntity(MongoIdentifiableEntity entity,
                             MongoStoreInvocationContext context)

      Specified by:
        `removeEntity` in interface `MongoStore`

    - #### removeEntity

          public boolean removeEntity(Class<? extends MongoIdentifiableEntity> type,
                             String id,
                             MongoStoreInvocationContext context)

      Specified by:
        `removeEntity` in interface `MongoStore`

    - #### removeEntities

          public boolean removeEntities(Class<? extends MongoIdentifiableEntity> type,
                               com.mongodb.DBObject query,
                               MongoStoreInvocationContext context)

      Specified by:
        `removeEntities` in interface `MongoStore`

    - #### pushItemToList

          public <S> boolean pushItemToList(MongoIdentifiableEntity entity,
                                   String listPropertyName,
                                   S itemToPush,
                                   boolean skipIfAlreadyPresent,
                                   MongoStoreInvocationContext context)

      Specified by:
        `pushItemToList` in interface `MongoStore`

    - #### pullItemFromList

          public <S> boolean pullItemFromList(MongoIdentifiableEntity entity,
                                     String listPropertyName,
                                     S itemToPull,
                                     MongoStoreInvocationContext context)

      Specified by:
        `pullItemFromList` in interface `MongoStore`

    - #### addAppObjectConverter

          public void addAppObjectConverter(Mapper<?,?> mapper)

    - #### addDBObjectConverter

          public void addDBObjectConverter(Mapper<?,?> mapper)

    - #### getEntityInfo

          public EntityInfo getEntityInfo(Class<?> entityClass)

    - #### convertCursor

          protected <T extends MongoIdentifiableEntity> List<T> convertCursor(Class<T> type,
                                                                  com.mongodb.DBCursor cursor,
                                                                  MongoStoreInvocationContext context)

    - #### convertDBObjectToEntity

          protected <T extends MongoIdentifiableEntity> T convertDBObjectToEntity(Class<T> type,
                                                                      com.mongodb.DBObject dbObject,
                                                                      MongoStoreInvocationContext context)

    - #### getDBCollectionForType

          protected com.mongodb.DBCollection getDBCollectionForType(Class<?> type)

Copyright © 2015. All Rights Reserved.