Class BaseMyBatisFilterableDao<T extends net.solarnetwork.dao.Entity<PK>,M extends FilterMatch<PK>,F extends Filter,PK extends Serializable>

java.lang.Object
org.springframework.dao.support.DaoSupport
org.mybatis.spring.support.SqlSessionDaoSupport
net.solarnetwork.central.dao.mybatis.support.BaseMyBatisDao
net.solarnetwork.central.dao.mybatis.support.BaseMyBatisGenericDao<T,PK>
net.solarnetwork.central.dao.mybatis.support.BaseMyBatisFilterableDao<T,M,F,PK>
All Implemented Interfaces:
FilterableDao<M,PK,F>, GenericDao<T,PK>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
MyBatisSolarLocationDao, MyBatisSolarNodeDao

public abstract class BaseMyBatisFilterableDao<T extends net.solarnetwork.dao.Entity<PK>,M extends FilterMatch<PK>,F extends Filter,PK extends Serializable> extends BaseMyBatisGenericDao<T,PK> implements FilterableDao<M,PK,F>
Base MyBatis FilterableDao implementation.
  • Field Details

    • FILTER_PROPERTY

      public static final String FILTER_PROPERTY
      A query property for a general Filter object value.
      See Also:
  • Constructor Details

    • BaseMyBatisFilterableDao

      public BaseMyBatisFilterableDao(Class<? extends T> domainClass, Class<? extends PK> pkClass, Class<? extends M> filterResultClass)
      Constructor.
      Parameters:
      domainClass - the domain class
      pkClass - the primary key class
      filterResultClass - the filter result class
  • Method Details

    • getFilteredQuery

      protected String getFilteredQuery(String filterDomain, F filter)
      Get the filter query name for a given domain.
      Parameters:
      filterDomain - the domain
      filter - the filter
      Returns:
      query name
    • postProcessFilterProperties

      protected void postProcessFilterProperties(F filter, Map<String,Object> sqlProps)
      Callback to alter the default SQL properties set up by findFiltered(Filter, List, Integer, Integer).
      Parameters:
      filter - the current filter
      sqlProps - the properties
    • findFiltered

      public FilterResults<M> findFiltered(F filter, List<net.solarnetwork.domain.SortDescriptor> sortDescriptors, Integer offset, Integer max)
      Description copied from interface: FilterableDao
      API for querying for a filtered set of results from all possible results.
      Specified by:
      findFiltered in interface FilterableDao<T extends net.solarnetwork.dao.Entity<PK>,M extends FilterMatch<PK>,F extends Filter>
      Parameters:
      filter - the query filter
      sortDescriptors - the optional sort descriptors
      offset - an optional result offset
      max - an optional maximum number of returned results
      Returns:
      the results, never null
    • executeFilterCountQuery

      protected Long executeFilterCountQuery(String countQueryName, F filter, Map<String,?> sqlProps)
      Execute a count query for a filter.

      If the query throws an IllegalArgumentException this method assumes that means the query name was not found, and will simply return null.

      Parameters:
      countQueryName - the query name
      filter - the filter
      sqlProps - the SQL properties
      Returns:
      the count