Package org.keycloak.models.map.storage
Interface MapStorage<V extends AbstractEntity,M>
-
- All Known Subinterfaces:
MapStorageWithAuth<V,M>
- All Known Implementing Classes:
ConcurrentHashMapStorage
,FileMapStorage
,HotRodUserSessionMapStorage
,JpaAdminEventMapStorage
,JpaAuthEventMapStorage
,JpaClientMapStorage
,JpaClientScopeMapStorage
,JpaGroupMapStorage
,JpaLockMapStorage
,JpaMapStorage
,JpaPermissionMapStorage
,JpaPolicyMapStorage
,JpaRealmMapStorage
,JpaResourceMapStorage
,JpaResourceServerMapStorage
,JpaRoleMapStorage
,JpaRootAuthenticationSessionMapStorage
,JpaScopeMapStorage
,JpaSingleUseObjectMapStorage
,JpaUserLoginFailureMapStorage
,JpaUserMapStorage
,JpaUserSessionMapStorage
,LdapMapStorage
,LdapRoleMapStorage
,SingleUseObjectMapStorage
public interface MapStorage<V extends AbstractEntity,M>
A storage for entities that is based on a map and operates in the context of transaction managed by currentKeycloakSession
. Implementations of its methods should respect transactional boundaries of that transaction.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description V
create(V value)
Instructs this storage to add a new value into the underlying store on commit in the context of the current transaction.boolean
delete(String key)
Instructs this storage to delete a value associated with the identifierkey
from the underlying store upon commit.long
delete(QueryParameters<M> queryParameters)
Instructs this transaction to remove values (identified bymcb
filter) from the underlying store upon commit.default boolean
exists(String key)
Returnstrue
if the object with the givenkey
exists in the underlying storage with respect to changes done in the current transaction.default boolean
exists(QueryParameters<M> queryParameters)
Returnstrue
if at least one object is satisfying givencriteria
from the underlying storage with respect to changes done in the current transaction.long
getCount(QueryParameters<M> queryParameters)
Returns a number of values present in the underlying storage that fulfill the given criteria with respect to changes done in the current transaction.V
read(String key)
Provides possibility to lookup for values by akey
in the underlying store with respect to changes done in current transaction.Stream<V>
read(QueryParameters<M> queryParameters)
Returns a stream of values from underlying storage that are updated based on the current transaction changes; i.e.
-
-
-
Method Detail
-
create
V create(V value)
Instructs this storage to add a new value into the underlying store on commit in the context of the current transaction.Updates to the returned instances of
V
would be visible in the current transaction and will propagate into the underlying store upon commit. The ID of the entity passed in the parameter might change to a different value in the returned value if the underlying storage decided this was necessary. If the ID of the entity was null before, it will be set on the returned value.- Parameters:
value
- the value- Returns:
- Entity representing the
value
in the store. It may or may not be the same instance asvalue
.
-
read
V read(String key)
Provides possibility to lookup for values by akey
in the underlying store with respect to changes done in current transaction. Updates to the returned instance would be visible in the current transaction and will propagate into the underlying store upon commit. IfV
implementsExpirableEntity
this method should not return entities that are expired. SeeExpirableEntity
JavaDoc for more details.- Parameters:
key
- identifier of a value- Returns:
- a value associated with the given
key
-
read
Stream<V> read(QueryParameters<M> queryParameters)
Returns a stream of values from underlying storage that are updated based on the current transaction changes; i.e. the result contains updates and excludes of records that have been created, updated or deleted in this transaction by respective methods of this interface.Updates to the returned instances of
V
would be visible in the current transaction and will propagate into the underlying store upon commit. IfV
implementsExpirableEntity
this method should not return entities that are expired. SeeExpirableEntity
JavaDoc for more details.- Parameters:
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.- Returns:
- values that fulfill the given criteria, that are updated based on changes in the current transaction
-
getCount
long getCount(QueryParameters<M> queryParameters)
Returns a number of values present in the underlying storage that fulfill the given criteria with respect to changes done in the current transaction.- Parameters:
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.- Returns:
- number of values present in the storage that fulfill the given criteria
-
delete
boolean delete(String key)
Instructs this storage to delete a value associated with the identifierkey
from the underlying store upon commit.- Parameters:
key
- identifier of a value- Returns:
- Returns
true
if the object has been deleted or result cannot be determined,false
otherwise.
-
delete
long delete(QueryParameters<M> queryParameters)
Instructs this transaction to remove values (identified bymcb
filter) from the underlying store upon commit.- Parameters:
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.- Returns:
- number of removed objects (might return
-1
if not supported)
-
exists
default boolean exists(String key)
Returnstrue
if the object with the givenkey
exists in the underlying storage with respect to changes done in the current transaction.false
otherwise.- Parameters:
key
- Key of the object. Must not benull
.- Returns:
- See description
- Throws:
NullPointerException
- if thekey
isnull
-
exists
default boolean exists(QueryParameters<M> queryParameters)
Returnstrue
if at least one object is satisfying givencriteria
from the underlying storage with respect to changes done in the current transaction.false
otherwise. The criteria are specified in the given criteria builder based on model properties.- Parameters:
queryParameters
- parameters for the query- Returns:
- See description
-
-