Class HotRodCrudOperations<K,E extends AbstractHotRodEntity,V extends AbstractEntity & HotRodEntityDelegate<E>,M>
java.lang.Object
org.keycloak.models.map.storage.hotRod.HotRodCrudOperations<K,E,V,M>
- All Implemented Interfaces:
CrudOperations<V,
M>
- Direct Known Subclasses:
SingleUseObjectHotRodCrudOperations
public class HotRodCrudOperations<K,E extends AbstractHotRodEntity,V extends AbstractEntity & HotRodEntityDelegate<E>,M>
extends Object
implements CrudOperations<V,M>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final DeepCloner
protected boolean
protected final StringKeyConverter<K>
protected final HotRodEntityDescriptor<E,
V> -
Constructor Summary
ConstructorDescriptionHotRodCrudOperations
(KeycloakSession session, org.infinispan.client.hotrod.RemoteCache<K, E> remoteCache, StringKeyConverter<K> keyConverter, HotRodEntityDescriptor<E, V> storedEntityDescriptor, DeepCloner cloner, Long lockTimeout) -
Method Summary
Modifier and TypeMethodDescriptionCreates an object in the storage.boolean
Deletes object with the givenkey
from the storage, if exists, no-op otherwise.long
delete
(QueryParameters<M> queryParameters) Deletes objects that match the given criteria.boolean
Returnstrue
if the object with the givenkey
exists in the storage.long
getCount
(QueryParameters<M> queryParameters) Returns the number of objects satisfying givencriteria
from the storage.Returns object with the givenkey
from the storage ornull
if object does not exist.read
(QueryParameters<M> queryParameters) Returns stream of objects satisfying givencriteria
from the storage.Updates the object with the key of thevalue
's ID in the storage if it already exists.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.models.map.storage.CrudOperations
determineKeyFromValue, exists
-
Field Details
-
keyConverter
-
storedEntityDescriptor
protected final HotRodEntityDescriptor<E extends AbstractHotRodEntity,V extends AbstractEntity & HotRodEntityDelegate<E>> storedEntityDescriptor -
cloner
-
isExpirableEntity
protected boolean isExpirableEntity
-
-
Constructor Details
-
HotRodCrudOperations
public HotRodCrudOperations(KeycloakSession session, org.infinispan.client.hotrod.RemoteCache<K, E> remoteCache, StringKeyConverter<K> keyConverter, HotRodEntityDescriptor<E, V> storedEntityDescriptor, DeepCloner cloner, Long lockTimeout)
-
-
Method Details
-
create
Description copied from interface:CrudOperations
Creates an object in the storage.
ID of thevalue
may be prescribed in id of thevalue
. If the id isnull
or its format is not matching the store internal format for ID, then thevalue
's ID will be generated and returned in the id of the return value.- Specified by:
create
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Parameters:
value
- Entity to create in the store- Returns:
- Entity representing the
value
in the store. It may or may not be the same instance asvalue
- See Also:
-
read
Description copied from interface:CrudOperations
Returns object with the givenkey
from the storage ornull
if object does not exist.
IfV
implementsExpirableEntity
this method should not return entities that are expired. SeeExpirableEntity
JavaDoc for more details. TODO: Consider returningOptional<V>
instead.- Specified by:
read
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Parameters:
key
- Key of the object. Must not benull
.- Returns:
- See description
-
update
Description copied from interface:CrudOperations
Updates the object with the key of thevalue
's ID in the storage if it already exists.- Specified by:
update
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Parameters:
value
- Updated value- Returns:
- the previous value associated with the specified key, or null if there was no mapping for the key. (A null return can also indicate that the map previously associated null with the key, if the implementation supports null values.)
- See Also:
-
delete
Description copied from interface:CrudOperations
Deletes object with the givenkey
from the storage, if exists, no-op otherwise.- Specified by:
delete
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Returns:
- Returns
true
if the object has been deleted or result cannot be determined,false
otherwise.
-
read
Description copied from interface:CrudOperations
Returns stream of objects satisfying givencriteria
from the storage. The criteria are specified in the given criteria builder based on model properties.
IfV
implementsExpirableEntity
this method should not return entities that are expired. SeeExpirableEntity
JavaDoc for more details.- Specified by:
read
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Parameters:
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.- Returns:
- Stream of objects. Never returns
null
.
-
getCount
Description copied from interface:CrudOperations
Returns the number of objects satisfying givencriteria
from the storage. The criteria are specified in the given criteria builder based on model properties.- Specified by:
getCount
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Parameters:
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.- Returns:
- Number of objects. Never returns
null
.
-
delete
Description copied from interface:CrudOperations
Deletes objects that match the given criteria.- Specified by:
delete
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Parameters:
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.- Returns:
- Number of removed objects (might return
-1
if not supported)
-
exists
Description copied from interface:CrudOperations
Returnstrue
if the object with the givenkey
exists in the storage.false
otherwise.- Specified by:
exists
in interfaceCrudOperations<K,
E extends AbstractHotRodEntity> - Parameters:
key
- Key of the object. Must not benull
.- Returns:
- See description
-
createCriteriaBuilder
-