public interface MapKeycloakTransaction<K,V extends AbstractEntity<K>,M> extends KeycloakTransaction
Modifier and Type | Method and Description |
---|---|
void |
create(K key,
V value)
Instructs this transaction to add a new value into the underlying store on commit.
|
void |
delete(K key)
Instructs this transaction to delete a value associated with the identifier
key from the underlying store
on commit. |
long |
delete(K artificialKey,
ModelCriteriaBuilder<M> mcb)
Instructs this transaction to remove values (identified by
mcb filter) from the underlying store on commit. |
long |
getCount(ModelCriteriaBuilder<M> mcb)
Returns a number of values present in the underlying storage that fulfill the given criteria with respect to
changes done in the current transaction.
|
default V |
getUpdated(V orig)
Returns an updated version of the
orig object as updated in this transaction. |
V |
read(K key)
Provides possibility to lookup for values by a
key in the underlying store with respect to changes done
in current transaction. |
V |
read(K key,
Function<K,V> defaultValueFunc)
Looks up a value in the current transaction with corresponding key, returns
defaultValueFunc when
the transaction does not contain a value for the key identifier. |
Stream<V> |
read(ModelCriteriaBuilder<M> mcb)
Returns a stream of values from underlying storage that are updated based on the current transaction changes;
i.e.
|
void |
update(K key,
V value)
Instructs this transaction to force-update the
value associated with the identifier key in the
underlying store on commit. |
void |
updateIfChanged(K key,
V value,
Predicate<V> shouldPut)
Instructs this transaction to update the
value associated with the identifier key in the
underlying store on commit, if by the time of commit the shouldPut predicate returns true |
begin, commit, getRollbackOnly, isActive, rollback, setRollbackOnly
void create(K key, V value)
key
- an identifier that will be associated with the value
value
- the valueV read(K key)
key
in the underlying store with respect to changes done
in current transaction.key
- identifier of a valuekey
V read(K key, Function<K,V> defaultValueFunc)
defaultValueFunc
when
the transaction does not contain a value for the key
identifier.key
- identifier of a valuedefaultValueFunc
- fallback function if the transaction does not contain a value that corresponds to key
key
, or the result of defaultValueFunc
Stream<V> read(ModelCriteriaBuilder<M> mcb)
create(K, V)
, update(K, V)
,
delete(K)
, etc.mcb
- criteria to filter valueslong getCount(ModelCriteriaBuilder<M> mcb)
mcb
- criteria to filter valuesvoid update(K key, V value)
value
associated with the identifier key
in the
underlying store on commit.key
- identifier of the value
value
- updated version of the valuedefault V getUpdated(V orig)
orig
object as updated in this transaction.
If the underlying store handles transactions on its own, this can return orig
directly.orig
- possibly stale version of some object from the underlying storeorig
object as visible from this transaction, or null
if the object has been removed.void updateIfChanged(K key, V value, Predicate<V> shouldPut)
value
associated with the identifier key
in the
underlying store on commit, if by the time of commit
the shouldPut
predicate returns true
key
- identifier of the value
value
- new version of the valueshouldPut
- predicate to check in commit phasevoid delete(K key)
key
from the underlying store
on commit.key
- identifier of a valuelong delete(K artificialKey, ModelCriteriaBuilder<M> mcb)
mcb
filter) from the underlying store on commit.artificialKey
- key to record the transaction with, must be a key that does not exist in this transaction to
prevent collisions with other operations in this transactionmcb
- criteria to delete valuesCopyright © 2021 JBoss by Red Hat. All rights reserved.