@EachProperty(value="coherence.data") public class DefaultCoherenceRepositoryOperations extends java.lang.Object implements CoherenceRepositoryOperations
RepositoryOperations
implementation for Coherence.Modifier | Constructor and Description |
---|---|
protected |
DefaultCoherenceRepositoryOperations(java.lang.String mapName,
io.micronaut.context.BeanContext beanContext)
Constructs a new operations instance.
|
Modifier and Type | Method and Description |
---|---|
<T> long |
count(io.micronaut.data.model.runtime.PagedQuery<T> pagedQuery) |
protected java.util.Map<java.lang.String,java.lang.Object> |
createBindingMap(io.micronaut.data.model.runtime.PreparedQuery preparedQuery)
Creates a map of binding parameters names and their values.
|
protected com.tangosol.coherence.dslquery.Statement |
createStatement(com.tangosol.coherence.dslquery.ExecutionContext context,
io.micronaut.data.model.runtime.PreparedQuery preparedQuery)
Creates a CohQL statement based on the provided
PreparedQuery . |
<T> int |
delete(io.micronaut.data.model.runtime.DeleteOperation<T> operation) |
<T> java.util.Optional<java.lang.Number> |
deleteAll(io.micronaut.data.model.runtime.DeleteBatchOperation<T> operation) |
protected com.tangosol.coherence.dslquery.ExecutionContext |
ensureExecutionContext()
Ensures a single
ExecutionContext is available for CohQL execution. |
protected io.micronaut.data.model.runtime.RuntimePersistentEntity |
ensureMeta(java.lang.Class entityType)
Used to obtain
RuntimePersistentEntity information about an entity type. |
protected com.tangosol.net.NamedMap |
ensureNamedMap()
Return the
NamedMap that should be used by this repository . |
protected com.tangosol.net.Session |
ensureSession()
Return the
Session that should be used by this repository . |
protected java.lang.Object |
execute(io.micronaut.data.model.runtime.PreparedQuery preparedQuery)
Executes the provided
PreparedQuery . |
java.util.Optional<java.lang.Number> |
executeUpdate(io.micronaut.data.model.runtime.PreparedQuery<?,java.lang.Number> preparedQuery) |
<T> boolean |
exists(io.micronaut.data.model.runtime.PreparedQuery<T,java.lang.Boolean> preparedQuery) |
<T> java.lang.Iterable<T> |
findAll(io.micronaut.data.model.runtime.PagedQuery<T> query) |
<T,R> java.lang.Iterable<R> |
findAll(io.micronaut.data.model.runtime.PreparedQuery<T,R> preparedQuery) |
<T> T |
findOne(java.lang.Class<T> type,
java.io.Serializable id) |
<T,R> R |
findOne(io.micronaut.data.model.runtime.PreparedQuery<T,R> preparedQuery) |
<R> io.micronaut.data.model.Page<R> |
findPage(io.micronaut.data.model.runtime.PagedQuery<R> query) |
<T> java.util.stream.Stream<T> |
findStream(io.micronaut.data.model.runtime.PagedQuery<T> query) |
<T,R> java.util.stream.Stream<R> |
findStream(io.micronaut.data.model.runtime.PreparedQuery<T,R> preparedQuery) |
<ID,T> ID |
getId(T entity)
Return the id associated with the specified entity.
|
<ID,T> com.tangosol.net.NamedMap<ID,T> |
getNamedMap()
Obtain the
NamedMap associated this this repository . |
protected void |
logQuery(com.tangosol.coherence.dslquery.ExecutionContext ctx,
com.tangosol.coherence.dslquery.Statement statement,
java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> bindingParams)
Logs the specified query and binding parameters.
|
<T> T |
persist(io.micronaut.data.model.runtime.InsertOperation<T> operation) |
<T> java.lang.Iterable<T> |
persistAll(io.micronaut.data.model.runtime.InsertBatchOperation<T> operation) |
protected <T> java.lang.String |
replaceTarget(java.lang.String query,
java.lang.Class<? extends T> entityClass)
Replaces the generated target of the statement with the name
NamedMap associated
with this RepositoryOperations instance. |
protected void |
setSession(java.lang.String sessionName)
Configure the name of the
Session . |
<T> T |
update(io.micronaut.data.model.runtime.UpdateOperation<T> operation) |
protected DefaultCoherenceRepositoryOperations(@Parameter java.lang.String mapName, io.micronaut.context.BeanContext beanContext)
mapName
- the name of the NamedMap
(from configuration)beanContext
- the BeanContext
used to look up a Session
instancepublic <ID,T> com.tangosol.net.NamedMap<ID,T> getNamedMap()
CoherenceRepositoryOperations
NamedMap
associated this this repository
.getNamedMap
in interface CoherenceRepositoryOperations
ID
- the type of the entity idT
- the entity typeNamedMap
associated this this repository
public <ID,T> ID getId(T entity)
CoherenceRepositoryOperations
getId
in interface CoherenceRepositoryOperations
ID
- the type of the entity idT
- the entity typeentity
- the entity to interrogateprotected void setSession(java.lang.String sessionName)
Session
. This is called during configuration.sessionName
- the name of the Session
@Nullable public <T> T findOne(@NonNull java.lang.Class<T> type, @NonNull java.io.Serializable id)
findOne
in interface io.micronaut.data.operations.RepositoryOperations
@Nullable public <T,R> R findOne(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T,R> preparedQuery)
findOne
in interface io.micronaut.data.operations.RepositoryOperations
public <T> boolean exists(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T,java.lang.Boolean> preparedQuery)
exists
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public <T> java.lang.Iterable<T> findAll(@NonNull io.micronaut.data.model.runtime.PagedQuery<T> query)
findAll
in interface io.micronaut.data.operations.RepositoryOperations
public <T> long count(io.micronaut.data.model.runtime.PagedQuery<T> pagedQuery)
count
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public <T,R> java.lang.Iterable<R> findAll(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T,R> preparedQuery)
findAll
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public <T,R> java.util.stream.Stream<R> findStream(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T,R> preparedQuery)
findStream
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public <T> java.util.stream.Stream<T> findStream(@NonNull io.micronaut.data.model.runtime.PagedQuery<T> query)
findStream
in interface io.micronaut.data.operations.RepositoryOperations
public <R> io.micronaut.data.model.Page<R> findPage(@NonNull io.micronaut.data.model.runtime.PagedQuery<R> query)
findPage
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public <T> T persist(@NonNull io.micronaut.data.model.runtime.InsertOperation<T> operation)
persist
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public <T> T update(@NonNull io.micronaut.data.model.runtime.UpdateOperation<T> operation)
update
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public java.util.Optional<java.lang.Number> executeUpdate(@NonNull io.micronaut.data.model.runtime.PreparedQuery<?,java.lang.Number> preparedQuery)
executeUpdate
in interface io.micronaut.data.operations.RepositoryOperations
public <T> java.util.Optional<java.lang.Number> deleteAll(@NonNull io.micronaut.data.model.runtime.DeleteBatchOperation<T> operation)
deleteAll
in interface io.micronaut.data.operations.RepositoryOperations
public <T> int delete(@NonNull io.micronaut.data.model.runtime.DeleteOperation<T> operation)
delete
in interface io.micronaut.data.operations.RepositoryOperations
@NonNull public <T> java.lang.Iterable<T> persistAll(@NonNull io.micronaut.data.model.runtime.InsertBatchOperation<T> operation)
persistAll
in interface io.micronaut.data.operations.RepositoryOperations
protected com.tangosol.coherence.dslquery.Statement createStatement(com.tangosol.coherence.dslquery.ExecutionContext context, io.micronaut.data.model.runtime.PreparedQuery preparedQuery)
PreparedQuery
.context
- the ExecutionContext
preparedQuery
- the PreparedQuery
to create a CohQL statement fromprotected java.lang.Object execute(io.micronaut.data.model.runtime.PreparedQuery preparedQuery)
PreparedQuery
.preparedQuery
- the PreparedQuery
to executeprotected io.micronaut.data.model.runtime.RuntimePersistentEntity ensureMeta(java.lang.Class entityType)
RuntimePersistentEntity
information about an entity type.
This is primarily used to obtain the ID associated with any given entity.entityType
- the type of the entityRuntimePersistentEntity
for the given typeprotected com.tangosol.coherence.dslquery.ExecutionContext ensureExecutionContext()
ExecutionContext
is available for CohQL execution.ExecutionContext
protected com.tangosol.net.NamedMap ensureNamedMap()
NamedMap
that should be used by this repository
.NamedMap
that should be used by this repository
protected com.tangosol.net.Session ensureSession()
Session
that should be used by this repository
.Session
that should be used by this repository
protected <T> java.lang.String replaceTarget(java.lang.String query, java.lang.Class<? extends T> entityClass)
NamedMap
associated
with this RepositoryOperations
instance.T
- the entity typequery
- the query as provided by MicronautentityClass
- the entity typeprotected java.util.Map<java.lang.String,java.lang.Object> createBindingMap(io.micronaut.data.model.runtime.PreparedQuery preparedQuery)
preparedQuery
- the PreparedQuery
to build the binding map fromprotected void logQuery(com.tangosol.coherence.dslquery.ExecutionContext ctx, com.tangosol.coherence.dslquery.Statement statement, java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> bindingParams)
ctx
- the ExecutionContext
statement
- the Statement
query
- the querybindingParams
- the binding parameters