public class ConcurrentHashMapKeycloakTransaction<K,V extends AbstractEntity & UpdatableEntity,M> extends Object implements MapKeycloakTransaction<V,M>
Modifier and Type | Class and Description |
---|---|
protected class |
ConcurrentHashMapKeycloakTransaction.MapTaskWithValue |
Constructor and Description |
---|
ConcurrentHashMapKeycloakTransaction(MapStorage<V,M> map,
StringKeyConvertor<K> keyConvertor) |
Modifier and Type | Method and Description |
---|---|
protected void |
addTask(String key,
ConcurrentHashMapKeycloakTransaction.MapTaskWithValue task)
Adds a given task if not exists for the given key
|
void |
begin() |
void |
commit() |
V |
create(V value)
Instructs this transaction to add a new value into the underlying store on commit.
|
long |
delete(QueryParameters<M> queryParameters)
Instructs this transaction to remove values (identified by
mcb filter) from the underlying store on commit. |
boolean |
delete(String key)
Instructs this transaction to delete a value associated with the identifier
key from the underlying store
on commit. |
long |
getCount(QueryParameters<M> queryParameters)
Returns a number of values present in the underlying storage that fulfill the given criteria with respect to
changes done in the current transaction.
|
boolean |
getRollbackOnly() |
boolean |
isActive() |
Stream<V> |
read(QueryParameters<M> queryParameters)
Returns the stream of records that match given criteria and includes changes made in this transaction, i.e.
|
V |
read(String sKey)
Provides possibility to lookup for values by a
key in the underlying store with respect to changes done
in current transaction. |
V |
read(String key,
Function<String,V> defaultValueFunc) |
V |
registerEntityForChanges(V origEntity)
Returns a deep clone of an entity.
|
void |
rollback() |
void |
setRollbackOnly() |
V |
updateIfChanged(V value,
Predicate<V> shouldPut) |
public ConcurrentHashMapKeycloakTransaction(MapStorage<V,M> map, StringKeyConvertor<K> keyConvertor)
public void begin()
begin
in interface KeycloakTransaction
public void commit()
commit
in interface KeycloakTransaction
public void rollback()
rollback
in interface KeycloakTransaction
public void setRollbackOnly()
setRollbackOnly
in interface KeycloakTransaction
public boolean getRollbackOnly()
getRollbackOnly
in interface KeycloakTransaction
public boolean isActive()
isActive
in interface KeycloakTransaction
protected void addTask(String key, ConcurrentHashMapKeycloakTransaction.MapTaskWithValue task)
public V registerEntityForChanges(V origEntity)
Usually used before giving an entity from a source back to the caller, to prevent changing it directly in the data store, but to keep transactional properties.
origEntity
- Original entitypublic V read(String sKey)
MapKeycloakTransaction
key
in the underlying store with respect to changes done
in current transaction. Updates to the returned instance would be visible in the current transaction
and will propagate into the underlying store upon commit.read
in interface MapKeycloakTransaction<V extends AbstractEntity & UpdatableEntity,M>
sKey
- identifier of a valuekey
public Stream<V> read(QueryParameters<M> queryParameters)
read
in interface MapKeycloakTransaction<V extends AbstractEntity & UpdatableEntity,M>
queryParameters
- public long getCount(QueryParameters<M> queryParameters)
MapKeycloakTransaction
getCount
in interface MapKeycloakTransaction<V extends AbstractEntity & UpdatableEntity,M>
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.public V create(V value)
MapKeycloakTransaction
Updates to the returned instances of V
would be visible in the current transaction
and will propagate into the underlying store upon commit.
create
in interface MapKeycloakTransaction<V extends AbstractEntity & UpdatableEntity,M>
value
- the valuevalue
in the store. It may or may not be the same instance as value
public boolean delete(String key)
MapKeycloakTransaction
key
from the underlying store
on commit.delete
in interface MapKeycloakTransaction<V extends AbstractEntity & UpdatableEntity,M>
key
- identifier of a valuetrue
if the object has been deleted or result cannot be determined, false
otherwise.public long delete(QueryParameters<M> queryParameters)
MapKeycloakTransaction
mcb
filter) from the underlying store on commit.delete
in interface MapKeycloakTransaction<V extends AbstractEntity & UpdatableEntity,M>
queryParameters
- parameters for the query like firstResult, maxResult, requested ordering, etc.-1
if not supported)Copyright © 2021 JBoss by Red Hat. All rights reserved.