V
- Type of the stored values that contains all the data stripped of session state. In other words, in the entities
there are only IDs and mostly primitive types / String
, never references to *Model
instances.
See the Abstract*Entity
classes in this module.M
- Type of the *Model
corresponding to the stored value, e.g. UserModel
. This is used for
filtering via model fields in ModelCriteriaBuilder
which is necessary to abstract from physical
layout and thus to support no-downtime upgrade.public interface MapStorage<V extends AbstractEntity,M>
read(org.keycloak.models.map.storage.QueryParameters)
and bulk delete(org.keycloak.models.map.storage.QueryParameters)
operations,
and operation for determining the number of the objects satisfying given criteria
(getCount(org.keycloak.models.map.storage.QueryParameters)
).Modifier and Type | Method and Description |
---|---|
V |
create(V value)
Creates an object in the store.
|
ModelCriteriaBuilder<M> |
createCriteriaBuilder()
Returns criteria builder for the storage engine.
|
MapKeycloakTransaction<V,M> |
createTransaction(KeycloakSession session)
Creates a
MapKeycloakTransaction object that tracks a new transaction related to this storage. |
long |
delete(QueryParameters<M> queryParameters)
Deletes objects that match the given criteria.
|
boolean |
delete(String key)
Deletes object with the given
key from the storage, if exists, no-op otherwise. |
long |
getCount(QueryParameters<M> queryParameters)
Returns the number of objects satisfying given
criteria from the storage. |
Stream<V> |
read(QueryParameters<M> queryParameters)
Returns stream of objects satisfying given
criteria from the storage. |
V |
read(String key)
Returns object with the given
key from the storage or null if object does not exist. |
V |
update(V value)
Updates the object with the key of the
value 's ID in the storage if it already exists. |
V create(V value)
value
may be prescribed in id of the value
.
If the id is null
or its format is not matching the store internal format for ID, then
the value
's ID will be generated and returned in the id of the return value.value
- Entity to create in the storevalue
in the store. It may or may not be the same instance as value
NullPointerException
- if value
is null
AbstractEntity.getId()
V read(String key)
key
from the storage or null
if object does not exist.
Optional<V>
instead.key
- Key of the object. Must not be null
.NullPointerException
- if the key
is null
Stream<V> read(QueryParameters<M> queryParameters)
criteria
from the storage.
The criteria are specified in the given criteria builder based on model properties.queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.null
.IllegalStateException
- If criteria
is not compatible, i.e. has not been originally created
by the createCriteriaBuilder()
method of this object.long getCount(QueryParameters<M> queryParameters)
criteria
from the storage.
The criteria are specified in the given criteria builder based on model properties.queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.null
.IllegalStateException
- If criteria
is not compatible, i.e. has not been originally created
by the createCriteriaBuilder()
method of this object.V update(V value)
value
's ID in the storage if it already exists.value
- Updated valueNullPointerException
- if the object or its id
is null
AbstractEntity.getId()
boolean delete(String key)
key
from the storage, if exists, no-op otherwise.key
- true
if the object has been deleted or result cannot be determined, false
otherwise.long delete(QueryParameters<M> queryParameters)
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.-1
if not supported)IllegalStateException
- If criteria
is not compatible, i.e. has not been originally created
by the createCriteriaBuilder()
method of this object.ModelCriteriaBuilder<M> createCriteriaBuilder()
null
MapKeycloakTransaction<V,M> createTransaction(KeycloakSession session)
MapKeycloakTransaction
object that tracks a new transaction related to this storage.
In case of JPA or similar, the transaction object might be supplied by the container (via JTA) or
shared same across storages accessing the same database within the same session; in other cases
(e.g. plain map) a separate transaction handler might be created per each storage.null
Copyright © 2021 JBoss by Red Hat. All rights reserved.