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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA query property for a general Filter object value.Fields inherited from class net.solarnetwork.central.dao.mybatis.support.BaseMyBatisGenericDao
BEAN_OBJECT_PROPERTY, CHILD_DELETE, CHILD_INSERT, CHILD_UPDATE, DATE_PROPERTY, DELETE_OBJECT, ERROR_CODE_INVALID_QUERY, ID_PROPERTY, INDEX_PROPERTY, INSERT_OBJECT, QUERY_FOR_ALL, QUERY_FOR_ID, RELATION_DELETE, RELATION_INSERT, RELATION_LIST_QUERY_FOR_PARENT, RELATION_OBJ_QUERY_FOR_PARENT, RELATION_UPDATE, SORT_DESCRIPTORS_PROPERTY, UPDATE_OBJECTFields inherited from class net.solarnetwork.central.dao.mybatis.support.BaseMyBatisDao
FIRST_ROW, logFields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LongexecuteFilterCountQuery(String countQueryName, F filter, Map<String, ?> sqlProps) Execute a count query for a filter.findFiltered(F filter, List<net.solarnetwork.domain.SortDescriptor> sortDescriptors, Integer offset, Integer max) API for querying for a filtered set of results from all possible results.protected StringgetFilteredQuery(String filterDomain, F filter) Get the filter query name for a given domain.protected voidpostProcessFilterProperties(F filter, Map<String, Object> sqlProps) Callback to alter the default SQL properties set up byfindFiltered(Filter, List, Integer, Integer).Methods inherited from class net.solarnetwork.central.dao.mybatis.support.BaseMyBatisGenericDao
delete, execute, get, getAll, getChildDelete, getChildInsert, getChildUpdate, getDelete, getDomainClass, getInsert, getMemberDomainKey, getMessageSource, getObjectType, getPrimaryKeyType, getQueryForAll, getQueryForId, getRelationDelete, getRelationInsert, getRelationObjectQueryForParent, getRelationQueryForParent, getRelationUpdate, getUpdate, handleAssignedPrimaryKeyStore, handleChildRelation, handleInsert, handleRelation, handleRelation, handleUpdate, mapSqlMapException, preprocessInsert, setChildDelete, setChildInsert, setChildUpdate, setDelete, setInsert, setMessageSource, setQueryForAll, setQueryForId, setRelationDelete, setRelationInsert, setRelationObjectQueryForParent, setRelationQueryForParent, setRelationUpdate, setUpdate, spaceAppend, storeMethods inherited from class net.solarnetwork.central.dao.mybatis.support.BaseMyBatisDao
executeCountQuery, selectFiltered, selectFiltered, selectFiltered, selectFiltered, selectFirst, selectList, selectLong, setSqlSessionFactoryMethods inherited from class org.mybatis.spring.support.SqlSessionDaoSupport
checkDaoConfig, createSqlSessionTemplate, getSqlSession, getSqlSessionFactory, getSqlSessionTemplate, setSqlSessionTemplateMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Field Details
-
FILTER_PROPERTY
A query property for a general Filter object value.- See Also:
-
-
Constructor Details
-
Method Details
-
getFilteredQuery
Get the filter query name for a given domain.- Parameters:
filterDomain- the domainfilter- the filter- Returns:
- query name
-
postProcessFilterProperties
Callback to alter the default SQL properties set up byfindFiltered(Filter, List, Integer, Integer).- Parameters:
filter- the current filtersqlProps- the properties
-
findFiltered
public FilterResults<M> findFiltered(F filter, List<net.solarnetwork.domain.SortDescriptor> sortDescriptors, Integer offset, Integer max) Description copied from interface:FilterableDaoAPI for querying for a filtered set of results from all possible results.- Specified by:
findFilteredin interfaceFilterableDao<T extends net.solarnetwork.dao.Entity<PK>,M extends FilterMatch<PK>, F extends Filter> - Parameters:
filter- the query filtersortDescriptors- the optional sort descriptorsoffset- an optional result offsetmax- an optional maximum number of returned results- Returns:
- the results, never null
-
executeFilterCountQuery
Execute a count query for a filter.If the query throws an
IllegalArgumentExceptionthis method assumes that means the query name was not found, and will simply return null.- Parameters:
countQueryName- the query namefilter- the filtersqlProps- the SQL properties- Returns:
- the count
-