org.keycloak.models.mongo.impl.context

## Class TransactionMongoStoreInvocationContext

- java.lang.Object
- - org.keycloak.models.mongo.impl.context.TransactionMongoStoreInvocationContext

- All Implemented Interfaces:
    MongoStoreInvocationContext

      public class TransactionMongoStoreInvocationContext
      extends Object
      implements MongoStoreInvocationContext

  Invocation context, which has some very basic support for transactions, and is able to cache loaded objects. It always execute all pending update tasks before start searching for other objects It's per-request object (not thread safe)
  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionMongoStoreInvocationContext(MongoStore mongoStore)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCreatedEntity(MongoIdentifiableEntity entity)`
    `void` | `addLoadedEntity(MongoIdentifiableEntity entity)`
    `void` | `addRemovedEntity(MongoIdentifiableEntity entity)`
    `void` | `addUpdateTask(MongoIdentifiableEntity entityToUpdate, MongoTask task)`
    `void` | `beforeDBSearch(Class<? extends MongoIdentifiableEntity> entityType)`
    `void` | `begin()`
    `void` | `commit()`
    `<T extends MongoIdentifiableEntity> T` | `getLoadedEntity(Class<T> type, String id)`
    `MongoStore` | `getMongoStore()`
    `void` | `rollback()`

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

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

- - ### Constructor Detail

    - #### TransactionMongoStoreInvocationContext

          public TransactionMongoStoreInvocationContext(MongoStore mongoStore)

  - ### Method Detail

    - #### addCreatedEntity

          public void addCreatedEntity(MongoIdentifiableEntity entity)

      Specified by:
        `addCreatedEntity` in interface `MongoStoreInvocationContext`

    - #### addLoadedEntity

          public void addLoadedEntity(MongoIdentifiableEntity entity)

      Specified by:
        `addLoadedEntity` in interface `MongoStoreInvocationContext`

    - #### getLoadedEntity

          public <T extends MongoIdentifiableEntity> T getLoadedEntity(Class<T> type,
                                                              String id)

      Specified by:
        `getLoadedEntity` in interface `MongoStoreInvocationContext`

    - #### addUpdateTask

          public void addUpdateTask(MongoIdentifiableEntity entityToUpdate,
                           MongoTask task)

      Specified by:
        `addUpdateTask` in interface `MongoStoreInvocationContext`

    - #### addRemovedEntity

          public void addRemovedEntity(MongoIdentifiableEntity entity)

      Specified by:
        `addRemovedEntity` in interface `MongoStoreInvocationContext`

    - #### beforeDBSearch

          public void beforeDBSearch(Class<? extends MongoIdentifiableEntity> entityType)

      Specified by:
        `beforeDBSearch` in interface `MongoStoreInvocationContext`

    - #### begin

          public void begin()

      Specified by:
        `begin` in interface `MongoStoreInvocationContext`

    - #### commit

          public void commit()

      Specified by:
        `commit` in interface `MongoStoreInvocationContext`

    - #### rollback

          public void rollback()

      Specified by:
        `rollback` in interface `MongoStoreInvocationContext`

    - #### getMongoStore

          public MongoStore getMongoStore()

      Specified by:
        `getMongoStore` in interface `MongoStoreInvocationContext`

Copyright © 2014. All Rights Reserved.