Package io.micronaut.coherence.data.ops
Class DefaultCoherenceRepositoryOperations
java.lang.Object
io.micronaut.coherence.data.ops.DefaultCoherenceRepositoryOperations
- All Implemented Interfaces:
CoherenceRepositoryOperations
,io.micronaut.context.ApplicationContextProvider
,io.micronaut.core.convert.ConversionServiceProvider
,io.micronaut.data.operations.async.AsyncCapableRepository
,io.micronaut.data.operations.HintsCapableRepository
,io.micronaut.data.operations.RepositoryOperations
@EachProperty("coherence.data")
public class DefaultCoherenceRepositoryOperations
extends Object
implements CoherenceRepositoryOperations
A
RepositoryOperations
implementation for Coherence.-
Constructor Summary
ConstructorDescriptionDefaultCoherenceRepositoryOperations
(String mapName, io.micronaut.context.ApplicationContext applicationContext, io.micronaut.core.convert.ConversionService conversionService, io.micronaut.context.BeanContext beanContext) Constructs a new operations instance. -
Method Summary
Modifier and TypeMethodDescription@NonNull io.micronaut.data.operations.async.AsyncRepositoryOperations
async()
<T> long
count
(io.micronaut.data.model.runtime.PagedQuery<T> pagedQuery) createBindingMap
(io.micronaut.data.model.runtime.PreparedQuery preparedQuery) Creates a map of binding parameters names and their values.<T> int
delete
(@NonNull io.micronaut.data.model.runtime.DeleteOperation<T> operation) deleteAll
(@NonNull io.micronaut.data.model.runtime.DeleteBatchOperation<T> operation) protected com.tangosol.net.Session
Return theSession
that should be used by thisrepository
.executeUpdate
(@NonNull io.micronaut.data.model.runtime.PreparedQuery<?, Number> preparedQuery) <T> boolean
<T> @NonNull Iterable<T>
findAll
(@NonNull io.micronaut.data.model.runtime.PagedQuery<T> query) <T,
R> @NonNull Iterable<R> findAll
(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T, R> preparedQuery) <T,
R> R findOne
(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T, R> preparedQuery) <T> T
<R> io.micronaut.data.model.Page<R>
findPage
(@NonNull io.micronaut.data.model.runtime.PagedQuery<R> query) <T> @NonNull Stream<T>
findStream
(@NonNull io.micronaut.data.model.runtime.PagedQuery<T> query) <T,
R> @NonNull Stream<R> findStream
(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T, R> preparedQuery) io.micronaut.context.ApplicationContext
io.micronaut.core.convert.ConversionService
<ID,
T> ID getId
(T entity) Return the id associated with the specified entity.<ID,
T> com.tangosol.net.NamedMap<ID, T> Obtain theNamedMap
associated with thisrepository
.protected void
logQuery
(com.tangosol.coherence.dslquery.ExecutionContext ctx, com.tangosol.coherence.dslquery.Statement statement, String query, Map<String, Object> bindingParams) Logs the specified query and binding parameters.<T> T
persist
(@NonNull io.micronaut.data.model.runtime.InsertOperation<T> operation) <T> @NonNull Iterable<T>
persistAll
(@NonNull io.micronaut.data.model.runtime.InsertBatchOperation<T> operation) protected <T> String
replaceTarget
(String query, Class<? extends T> entityClass) Replaces the generated target of the statement with the nameNamedMap
associated with thisRepositoryOperations
instance.protected void
setSession
(String sessionName) Configure the name of theSession
.<T> T
update
(@NonNull io.micronaut.data.model.runtime.UpdateOperation<T> operation) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.data.operations.HintsCapableRepository
getQueryHints
Methods inherited from interface io.micronaut.data.operations.RepositoryOperations
execute, executeDelete, getEntity, updateAll
-
Constructor Details
-
DefaultCoherenceRepositoryOperations
public DefaultCoherenceRepositoryOperations(@Parameter String mapName, io.micronaut.context.ApplicationContext applicationContext, io.micronaut.core.convert.ConversionService conversionService, io.micronaut.context.BeanContext beanContext) Constructs a new operations instance.- Parameters:
mapName
- the name of theNamedMap
(from configuration)applicationContext
- theApplicationContext
conversionService
- theConversionService
beanContext
- theBeanContext
used to look up aSession
instance
-
-
Method Details
-
getApplicationContext
public io.micronaut.context.ApplicationContext getApplicationContext()- Specified by:
getApplicationContext
in interfaceio.micronaut.context.ApplicationContextProvider
-
getNamedMap
public <ID,T> com.tangosol.net.NamedMap<ID,T> getNamedMap()Description copied from interface:CoherenceRepositoryOperations
Obtain theNamedMap
associated with thisrepository
.- Specified by:
getNamedMap
in interfaceCoherenceRepositoryOperations
- Type Parameters:
ID
- the type of the entity idT
- the entity type- Returns:
- the
NamedMap
associated this thisrepository
-
getId
public <ID,T> ID getId(T entity) Description copied from interface:CoherenceRepositoryOperations
Return the id associated with the specified entity.- Specified by:
getId
in interfaceCoherenceRepositoryOperations
- Type Parameters:
ID
- the type of the entity idT
- the entity type- Parameters:
entity
- the entity to interrogate- Returns:
- the id associated with the specified entity
-
setSession
Configure the name of theSession
. This is called during configuration.- Parameters:
sessionName
- the name of theSession
-
async
@NonNull public @NonNull io.micronaut.data.operations.async.AsyncRepositoryOperations async()- Specified by:
async
in interfaceio.micronaut.data.operations.async.AsyncCapableRepository
-
findOne
- Specified by:
findOne
in interfaceio.micronaut.data.operations.RepositoryOperations
-
findOne
@Nullable public <T,R> R findOne(@NonNull @NonNull io.micronaut.data.model.runtime.PreparedQuery<T, R> preparedQuery) - Specified by:
findOne
in interfaceio.micronaut.data.operations.RepositoryOperations
-
exists
public <T> boolean exists(@NonNull @NonNull io.micronaut.data.model.runtime.PreparedQuery<T, Boolean> preparedQuery) - Specified by:
exists
in interfaceio.micronaut.data.operations.RepositoryOperations
-
findAll
@NonNull public <T> @NonNull Iterable<T> findAll(@NonNull @NonNull io.micronaut.data.model.runtime.PagedQuery<T> query) - Specified by:
findAll
in interfaceio.micronaut.data.operations.RepositoryOperations
-
count
public <T> long count(io.micronaut.data.model.runtime.PagedQuery<T> pagedQuery) - Specified by:
count
in interfaceio.micronaut.data.operations.RepositoryOperations
-
findAll
@NonNull public <T,R> @NonNull Iterable<R> findAll(@NonNull @NonNull io.micronaut.data.model.runtime.PreparedQuery<T, R> preparedQuery) - Specified by:
findAll
in interfaceio.micronaut.data.operations.RepositoryOperations
-
findStream
@NonNull public <T,R> @NonNull Stream<R> findStream(@NonNull @NonNull io.micronaut.data.model.runtime.PreparedQuery<T, R> preparedQuery) - Specified by:
findStream
in interfaceio.micronaut.data.operations.RepositoryOperations
-
findStream
@NonNull public <T> @NonNull Stream<T> findStream(@NonNull @NonNull io.micronaut.data.model.runtime.PagedQuery<T> query) - Specified by:
findStream
in interfaceio.micronaut.data.operations.RepositoryOperations
-
findPage
public <R> io.micronaut.data.model.Page<R> findPage(@NonNull @NonNull io.micronaut.data.model.runtime.PagedQuery<R> query) - Specified by:
findPage
in interfaceio.micronaut.data.operations.RepositoryOperations
-
persist
@NonNull public <T> T persist(@NonNull @NonNull io.micronaut.data.model.runtime.InsertOperation<T> operation) - Specified by:
persist
in interfaceio.micronaut.data.operations.RepositoryOperations
-
update
@NonNull public <T> T update(@NonNull @NonNull io.micronaut.data.model.runtime.UpdateOperation<T> operation) - Specified by:
update
in interfaceio.micronaut.data.operations.RepositoryOperations
-
executeUpdate
@NonNull public @NonNull Optional<Number> executeUpdate(@NonNull @NonNull io.micronaut.data.model.runtime.PreparedQuery<?, Number> preparedQuery) - Specified by:
executeUpdate
in interfaceio.micronaut.data.operations.RepositoryOperations
-
deleteAll
public <T> Optional<Number> deleteAll(@NonNull @NonNull io.micronaut.data.model.runtime.DeleteBatchOperation<T> operation) - Specified by:
deleteAll
in interfaceio.micronaut.data.operations.RepositoryOperations
-
delete
public <T> int delete(@NonNull @NonNull io.micronaut.data.model.runtime.DeleteOperation<T> operation) - Specified by:
delete
in interfaceio.micronaut.data.operations.RepositoryOperations
-
persistAll
@NonNull public <T> @NonNull Iterable<T> persistAll(@NonNull @NonNull io.micronaut.data.model.runtime.InsertBatchOperation<T> operation) - Specified by:
persistAll
in interfaceio.micronaut.data.operations.RepositoryOperations
-
ensureSession
protected com.tangosol.net.Session ensureSession()Return theSession
that should be used by thisrepository
.- Returns:
- return the
Session
that should be used by thisrepository
-
replaceTarget
Replaces the generated target of the statement with the nameNamedMap
associated with thisRepositoryOperations
instance.- Type Parameters:
T
- the entity type- Parameters:
query
- the query as provided by MicronautentityClass
- the entity type- Returns:
- the modified query
-
createBindingMap
protected Map<String,Object> createBindingMap(io.micronaut.data.model.runtime.PreparedQuery preparedQuery) Creates a map of binding parameters names and their values.- Parameters:
preparedQuery
- thePreparedQuery
to build the binding map from- Returns:
- the parameters necessary to execute a CohQL statement
-
logQuery
protected void logQuery(com.tangosol.coherence.dslquery.ExecutionContext ctx, com.tangosol.coherence.dslquery.Statement statement, String query, Map<String, Object> bindingParams) Logs the specified query and binding parameters.- Parameters:
ctx
- theExecutionContext
statement
- theStatement
query
- the querybindingParams
- the binding parameters
-
getConversionService
public io.micronaut.core.convert.ConversionService getConversionService()- Specified by:
getConversionService
in interfaceio.micronaut.core.convert.ConversionServiceProvider
-