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 Vcreate(V value)Instructs this storage to add a new value into the underlying store on commit in the context of the current transaction.booleandelete(String key)Instructs this storage to delete a value associated with the identifierkeyfrom the underlying store upon commit.longdelete(QueryParameters<M> queryParameters)Instructs this transaction to remove values (identified bymcbfilter) from the underlying store upon commit.default booleanexists(String key)Returnstrueif the object with the givenkeyexists in the underlying storage with respect to changes done in the current transaction.default booleanexists(QueryParameters<M> queryParameters)Returnstrueif at least one object is satisfying givencriteriafrom the underlying storage with respect to changes done in the current transaction.longgetCount(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.Vread(String key)Provides possibility to lookup for values by akeyin 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
Vwould 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
valuein the store. It may or may not be the same instance asvalue.
-
read
V read(String key)
Provides possibility to lookup for values by akeyin 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. IfVimplementsExpirableEntitythis method should not return entities that are expired. SeeExpirableEntityJavaDoc 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
Vwould be visible in the current transaction and will propagate into the underlying store upon commit. IfVimplementsExpirableEntitythis method should not return entities that are expired. SeeExpirableEntityJavaDoc 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 identifierkeyfrom the underlying store upon commit.- Parameters:
key- identifier of a value- Returns:
- Returns
trueif the object has been deleted or result cannot be determined,falseotherwise.
-
delete
long delete(QueryParameters<M> queryParameters)
Instructs this transaction to remove values (identified bymcbfilter) 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
-1if not supported)
-
exists
default boolean exists(String key)
Returnstrueif the object with the givenkeyexists in the underlying storage with respect to changes done in the current transaction.falseotherwise.- Parameters:
key- Key of the object. Must not benull.- Returns:
- See description
- Throws:
NullPointerException- if thekeyisnull
-
exists
default boolean exists(QueryParameters<M> queryParameters)
Returnstrueif at least one object is satisfying givencriteriafrom the underlying storage with respect to changes done in the current transaction.falseotherwise. The criteria are specified in the given criteria builder based on model properties.- Parameters:
queryParameters- parameters for the query- Returns:
- See description
-
-