Class ConcurrentHashMapCrudOperations<K,V extends AbstractEntity & UpdatableEntity,M>  
java.lang.Object
org.keycloak.models.map.storage.chm.ConcurrentHashMapCrudOperations<K,V,M>  
- All Implemented Interfaces:
- CrudOperations<V,- M> 
- Direct Known Subclasses:
- SingleUseObjectConcurrentHashMapCrudOperations
public class ConcurrentHashMapCrudOperations<K,V extends AbstractEntity & UpdatableEntity,M>  
extends Object
implements CrudOperations<V,M> 
It contains basic object CRUD operations as well as bulk 
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)).- Author:
- hmlnarik
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final DeepClonerprotected final Map<SearchableModelField<? super M>,MapModelCriteriaBuilder.UpdatePredicatesFunc<K, V, M>> protected final StringKeyConverter<K>protected final ConcurrentMap<K,V> 
- 
Constructor SummaryConstructorsConstructorDescriptionConcurrentHashMapCrudOperations(Class<M> modelClass, StringKeyConverter<K> keyConverter, DeepCloner cloner) 
- 
Method SummaryModifier and TypeMethodDescriptionCreates an object in the storage.booleanDeletes object with the givenkeyfrom the storage, if exists, no-op otherwise.longdelete(QueryParameters<M> queryParameters) Deletes objects that match the given criteria.longgetCount(QueryParameters<M> queryParameters) Returns the number of objects satisfying givencriteriafrom the storage.Returns object with the givenkeyfrom the storage ornullif object does not exist.read(QueryParameters<M> queryParameters) Returns stream of objects satisfying givencriteriafrom 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.map.storage.CrudOperationsdetermineKeyFromValue, exists, exists
- 
Field Details- 
store
- 
fieldPredicatesprotected final Map<SearchableModelField<? super M>,MapModelCriteriaBuilder.UpdatePredicatesFunc<K, fieldPredicatesV extends AbstractEntity & UpdatableEntity, M>> 
- 
keyConverter
- 
cloner
 
- 
- 
Constructor Details- 
ConcurrentHashMapCrudOperationspublic ConcurrentHashMapCrudOperations(Class<M> modelClass, StringKeyConverter<K> keyConverter, DeepCloner cloner) 
 
- 
- 
Method Details- 
createDescription copied from interface:CrudOperationsCreates an object in the storage.
 ID of thevaluemay be prescribed in id of thevalue. If the id isnullor 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:
- createin interface- CrudOperations<K,- V extends AbstractEntity & UpdatableEntity> 
- Parameters:
- value- Entity to create in the store
- Returns:
- Entity representing the valuein the store. It may or may not be the same instance asvalue
- See Also:
 
- 
readDescription copied from interface:CrudOperationsReturns object with the givenkeyfrom the storage ornullif object does not exist.
 IfVimplementsExpirableEntitythis method should not return entities that are expired. SeeExpirableEntityJavaDoc for more details. TODO: Consider returningOptional<V>instead.- Specified by:
- readin interface- CrudOperations<K,- V extends AbstractEntity & UpdatableEntity> 
- Parameters:
- key- Key of the object. Must not be- null.
- Returns:
- See description
 
- 
updateDescription copied from interface:CrudOperationsUpdates the object with the key of thevalue's ID in the storage if it already exists.- Specified by:
- updatein interface- CrudOperations<K,- V extends AbstractEntity & UpdatableEntity> 
- 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:
 
- 
deleteDescription copied from interface:CrudOperationsDeletes object with the givenkeyfrom the storage, if exists, no-op otherwise.- Specified by:
- deletein interface- CrudOperations<K,- V extends AbstractEntity & UpdatableEntity> 
- Returns:
- Returns trueif the object has been deleted or result cannot be determined,falseotherwise.
 
- 
deleteDescription copied from interface:CrudOperationsDeletes objects that match the given criteria.- Specified by:
- deletein interface- CrudOperations<K,- V extends AbstractEntity & UpdatableEntity> 
- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- Number of removed objects (might return -1if not supported)
 
- 
createCriteriaBuilder
- 
getKeyConverter
- 
readDescription copied from interface:CrudOperationsReturns stream of objects satisfying givencriteriafrom the storage. The criteria are specified in the given criteria builder based on model properties.
 IfVimplementsExpirableEntitythis method should not return entities that are expired. SeeExpirableEntityJavaDoc for more details.- Specified by:
- readin interface- CrudOperations<K,- V extends AbstractEntity & UpdatableEntity> 
- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- Stream of objects. Never returns null.
 
- 
getCountDescription copied from interface:CrudOperationsReturns the number of objects satisfying givencriteriafrom the storage. The criteria are specified in the given criteria builder based on model properties.- Specified by:
- getCountin interface- CrudOperations<K,- V extends AbstractEntity & UpdatableEntity> 
- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- Number of objects. Never returns null.
 
 
-