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

    Constructors
    Constructor
    Description
    DefaultCoherenceRepositoryOperations(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 Type
    Method
    Description
    @NonNull io.micronaut.data.operations.async.AsyncRepositoryOperations
     
    <T> long
    count(io.micronaut.data.model.runtime.PagedQuery<T> pagedQuery)
     
    protected Map<String,Object>
    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 the Session that should be used by this repository.
    @NonNull Optional<Number>
    executeUpdate(@NonNull io.micronaut.data.model.runtime.PreparedQuery<?,Number> preparedQuery)
     
    <T> boolean
    exists(@NonNull io.micronaut.data.model.runtime.PreparedQuery<T,Boolean> preparedQuery)
     
    <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
    findOne(@NonNull Class<T> type, @NonNull Object id)
     
    <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 the NamedMap associated with this repository.
    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 name NamedMap associated with this RepositoryOperations instance.
    protected void
    setSession(String sessionName)
    Configure the name of the Session.
    <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 the NamedMap (from configuration)
      applicationContext - the ApplicationContext
      conversionService - the ConversionService
      beanContext - the BeanContext used to look up a Session instance
  • Method Details

    • getApplicationContext

      public io.micronaut.context.ApplicationContext getApplicationContext()
      Specified by:
      getApplicationContext in interface io.micronaut.context.ApplicationContextProvider
    • getNamedMap

      public <ID, T> com.tangosol.net.NamedMap<ID,T> getNamedMap()
      Description copied from interface: CoherenceRepositoryOperations
      Obtain the NamedMap associated with this repository.
      Specified by:
      getNamedMap in interface CoherenceRepositoryOperations
      Type Parameters:
      ID - the type of the entity id
      T - the entity type
      Returns:
      the NamedMap associated this this repository
    • 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 interface CoherenceRepositoryOperations
      Type Parameters:
      ID - the type of the entity id
      T - the entity type
      Parameters:
      entity - the entity to interrogate
      Returns:
      the id associated with the specified entity
    • setSession

      protected void setSession(String sessionName)
      Configure the name of the Session. This is called during configuration.
      Parameters:
      sessionName - the name of the Session
    • async

      @NonNull public @NonNull io.micronaut.data.operations.async.AsyncRepositoryOperations async()
      Specified by:
      async in interface io.micronaut.data.operations.async.AsyncCapableRepository
    • findOne

      @Nullable public <T> T findOne(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id)
      Specified by:
      findOne in interface io.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 interface io.micronaut.data.operations.RepositoryOperations
    • exists

      public <T> boolean exists(@NonNull @NonNull io.micronaut.data.model.runtime.PreparedQuery<T,Boolean> preparedQuery)
      Specified by:
      exists in interface io.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 interface io.micronaut.data.operations.RepositoryOperations
    • count

      public <T> long count(io.micronaut.data.model.runtime.PagedQuery<T> pagedQuery)
      Specified by:
      count in interface io.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 interface io.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 interface io.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 interface io.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 interface io.micronaut.data.operations.RepositoryOperations
    • persist

      @NonNull public <T> T persist(@NonNull @NonNull io.micronaut.data.model.runtime.InsertOperation<T> operation)
      Specified by:
      persist in interface io.micronaut.data.operations.RepositoryOperations
    • update

      @NonNull public <T> T update(@NonNull @NonNull io.micronaut.data.model.runtime.UpdateOperation<T> operation)
      Specified by:
      update in interface io.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 interface io.micronaut.data.operations.RepositoryOperations
    • deleteAll

      public <T> Optional<Number> deleteAll(@NonNull @NonNull io.micronaut.data.model.runtime.DeleteBatchOperation<T> operation)
      Specified by:
      deleteAll in interface io.micronaut.data.operations.RepositoryOperations
    • delete

      public <T> int delete(@NonNull @NonNull io.micronaut.data.model.runtime.DeleteOperation<T> operation)
      Specified by:
      delete in interface io.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 interface io.micronaut.data.operations.RepositoryOperations
    • ensureSession

      protected com.tangosol.net.Session ensureSession()
      Return the Session that should be used by this repository.
      Returns:
      return the Session that should be used by this repository
    • replaceTarget

      protected <T> String replaceTarget(String query, Class<? extends T> entityClass)
      Replaces the generated target of the statement with the name NamedMap associated with this RepositoryOperations instance.
      Type Parameters:
      T - the entity type
      Parameters:
      query - the query as provided by Micronaut
      entityClass - 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 - the PreparedQuery 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 - the ExecutionContext
      statement - the Statement
      query - the query
      bindingParams - the binding parameters
    • getConversionService

      public io.micronaut.core.convert.ConversionService getConversionService()
      Specified by:
      getConversionService in interface io.micronaut.core.convert.ConversionServiceProvider