Package org.keycloak.models.map.storage
Interface CrudOperations<V extends AbstractEntity & UpdatableEntity,M>
- 
- Type Parameters:
- V- Type of the value stored in the storage
- M- Type of the model object
 - All Known Implementing Classes:
- ConcurrentHashMapCrudOperations,- FileCrudOperations,- HotRodCrudOperations,- SingleUseObjectConcurrentHashMapCrudOperations,- SingleUseObjectHotRodCrudOperations
 
 public interface CrudOperations<V extends AbstractEntity & UpdatableEntity,M>Interface for CRUD operations on the storage. The operations may not respect transactional boundaries if the underlying storage does not support it.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Vcreate(V value)Creates an object in the storage.booleandelete(String key)Deletes object with the givenkeyfrom the storage, if exists, no-op otherwise.longdelete(QueryParameters<M> queryParameters)Deletes objects that match the given criteria.default StringdetermineKeyFromValue(V value, boolean forCreate)Determines first available key from the value upon creation.default booleanexists(String key)Returnstrueif the object with the givenkeyexists in the storage.default booleanexists(QueryParameters<M> queryParameters)Returnstrueif at least one object is satisfying givencriteriafrom the storage.longgetCount(QueryParameters<M> queryParameters)Returns the number of objects satisfying givencriteriafrom the storage.Vread(String key)Returns object with the givenkeyfrom the storage ornullif object does not exist.Stream<V>read(QueryParameters<M> queryParameters)Returns stream of objects satisfying givencriteriafrom the storage.Vupdate(V value)Updates the object with the key of thevalue's ID in the storage if it already exists.
 
- 
- 
- 
Method Detail- 
createV create(V value) Creates 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.- 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
- Throws:
- NullPointerException- if- valueis- null
- See Also:
- AbstractEntity.getId()
 
 - 
readV read(String key) Returns 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.- Parameters:
- key- Key of the object. Must not be- null.
- Returns:
- See description
- Throws:
- NullPointerException- if the- keyis- null
 
 - 
updateV update(V value) Updates the object with the key of thevalue's ID in the storage if it already exists.- 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.)
- Throws:
- NullPointerException- if the object or its- idis- null
- See Also:
- AbstractEntity.getId()
 
 - 
deleteboolean delete(String key) Deletes object with the givenkeyfrom the storage, if exists, no-op otherwise.- Parameters:
- key-
- Returns:
- Returns trueif the object has been deleted or result cannot be determined,falseotherwise.
 
 - 
deletelong delete(QueryParameters<M> queryParameters) Deletes objects that match the given criteria.- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- Number of removed objects (might return -1if not supported)
 
 - 
readStream<V> read(QueryParameters<M> queryParameters) Returns 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.- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- Stream of objects. Never returns null.
 
 - 
getCountlong getCount(QueryParameters<M> queryParameters) Returns the number of objects satisfying givencriteriafrom the storage. The criteria are specified in the given criteria builder based on model properties.- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- Number of objects. Never returns null.
 
 - 
existsdefault boolean exists(String key) Returnstrueif the object with the givenkeyexists in the storage.falseotherwise.- Parameters:
- key- Key of the object. Must not be- null.
- Returns:
- See description
- Throws:
- NullPointerException- if the- keyis- null
 
 - 
existsdefault boolean exists(QueryParameters<M> queryParameters) Returnstrueif at least one object is satisfying givencriteriafrom the storage.falseotherwise. The criteria are specified in the given criteria builder based on model properties.- Parameters:
- queryParameters- parameters for the query
- Returns:
- See description
 
 
- 
 
-