Class AbstractElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
- java.lang.Object
-
- org.openiam.esb.elasticsearch.repository.impl.AbstractElasticSearchRepository<T,ID,S>
-
- All Implemented Interfaces:
AbstractCustomElasticSearchRepository<T,S,ID>
- Direct Known Subclasses:
AbstractAttributeElasticSearchRepositoryImpl
,AbstractKeyNameElasticSearchRepository
,AuditLogElasticSearchRepositoryImpl
,EmailElasticSearchRepositoryImpl
,LoginElasticSearchRepositoryImpl
,OrphanElasticSearchRepositoryImpl
,PhoneElasticSearchRepositoryImpl
,UserElasticSearchRepositoryImpl
public abstract class AbstractElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean> extends Object implements AbstractCustomElasticSearchRepository<T,S,ID>
-
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.data.elasticsearch.annotations.Document
document
protected org.springframework.data.elasticsearch.core.ElasticsearchOperations
elasticsearchTemplate
protected org.apache.commons.logging.Log
logger
protected static CriteriaQueryProcessor
PROCESSOR
protected Set<String>
validSortFields
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractElasticSearchRepository()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.elasticsearch.index.query.BoolQueryBuilder
addAdditionalCriteria(S searchBean, org.elasticsearch.index.query.BoolQueryBuilder queryBuilder)
protected void
addNestedQuery(org.elasticsearch.index.query.BoolQueryBuilder queryBuilder, List<org.elasticsearch.index.query.QueryBuilder> builders, String fieldName, boolean mustMatch)
boolean
allowReindex(org.springframework.data.elasticsearch.repository.ElasticsearchRepository repo)
protected org.springframework.data.elasticsearch.core.query.Criteria
between(String term, Date from, Date to)
protected org.springframework.data.elasticsearch.core.query.CriteriaQuery
build(UserSearchBean searchBean, List<SearchParam> params, org.springframework.data.elasticsearch.core.query.CriteriaQuery query, String fieldName)
protected org.springframework.data.elasticsearch.core.query.Criteria
buildContainsCriteria(String field, String value)
protected org.springframework.data.elasticsearch.core.query.NativeSearchQuery
buildNativeSearchQuery(S searchBean, org.elasticsearch.index.query.BoolQueryBuilder queryBuilder)
protected org.springframework.data.elasticsearch.core.query.Criteria
buildStartsWithCritria(String field, String value)
protected org.springframework.data.elasticsearch.core.query.Criteria
contains(String term, String value)
int
count(S searchBean)
protected org.springframework.data.elasticsearch.core.query.Criteria
eq(String term, boolean value)
protected org.springframework.data.elasticsearch.core.query.Criteria
eq(String term, String value)
protected org.springframework.data.elasticsearch.core.query.Criteria
eq(String term, Date value)
protected org.springframework.data.elasticsearch.core.query.Criteria
exactCriteria(String term, String value)
protected org.elasticsearch.index.query.QueryBuilder
exists(String term)
protected org.springframework.data.domain.Page<T>
find(org.springframework.data.elasticsearch.core.query.Query query, org.springframework.data.domain.Pageable pageable)
org.springframework.data.domain.Page<T>
findAll(int from, int size)
org.springframework.data.domain.Page<T>
findAllPageable(org.springframework.data.domain.Pageable pageable)
org.springframework.data.domain.Page<T>
findBeans(S searchBean, int from, int size)
List<T>
findByIds(Collection<String> ids, org.springframework.data.domain.Pageable pageable)
org.springframework.data.domain.Page<T>
findByIdsPage(Collection<String> ids, org.springframework.data.domain.Pageable pageable)
List<String>
findIds(S searchBean, int from, int size)
String
format(Date d)
protected org.springframework.data.elasticsearch.core.query.Criteria
getAttributeCriteria(List<Tuple<String,String>> attributes)
protected abstract org.springframework.data.elasticsearch.core.query.CriteriaQuery
getCriteria(S searchBean)
org.springframework.data.domain.Pageable
getPageable(S searchBean, int from, int size)
protected org.elasticsearch.index.query.QueryBuilder
getQueryBuilder(String term, String value, MatchType matchType)
protected org.springframework.data.domain.Sort
getSort(S searchBean)
protected org.springframework.data.elasticsearch.core.query.Criteria
getWhereCriteria(String term, String value, MatchType matchType)
protected org.springframework.data.elasticsearch.core.query.Criteria
getWhereCriteria(String term, DateSearchParam param)
protected org.springframework.data.elasticsearch.core.query.Criteria
gt(String term, Date value)
protected <A extends Serializable>
org.springframework.data.elasticsearch.core.query.Criteriain(String term, Set<A> values)
protected boolean
isSortByValid(String sortBy)
boolean
isValidSearchBean(S searchBean)
protected org.springframework.data.elasticsearch.core.query.Criteria
lt(String term, Date value)
protected boolean
mustMatch(S searchBean)
protected org.springframework.data.elasticsearch.core.query.Criteria
neq(String term, String value)
protected <A extends Serializable>
org.springframework.data.elasticsearch.core.query.CriterianotIn(String term, Set<A> values)
protected List<String>
parse(String str)
protected String
replaceReservedCharacters(String str)
protected List<String>
replaceReservedCharacters(List<String> strs)
protected org.springframework.data.elasticsearch.core.query.Criteria
startsWith(String term, String value)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openiam.esb.elasticsearch.repository.AbstractCustomElasticSearchRepository
getDocumentClass, prepare
-
-
-
-
Field Detail
-
PROCESSOR
protected static final CriteriaQueryProcessor PROCESSOR
-
elasticsearchTemplate
@Autowired @Qualifier("elasticsearchTemplate") protected org.springframework.data.elasticsearch.core.ElasticsearchOperations elasticsearchTemplate
-
logger
protected final org.apache.commons.logging.Log logger
-
document
protected org.springframework.data.elasticsearch.annotations.Document document
-
-
Method Detail
-
getCriteria
protected abstract org.springframework.data.elasticsearch.core.query.CriteriaQuery getCriteria(S searchBean)
-
allowReindex
public boolean allowReindex(org.springframework.data.elasticsearch.repository.ElasticsearchRepository repo)
- Specified by:
allowReindex
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
isValidSearchBean
public boolean isValidSearchBean(S searchBean)
- Specified by:
isValidSearchBean
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
exactCriteria
protected org.springframework.data.elasticsearch.core.query.Criteria exactCriteria(String term, String value)
-
exists
protected org.elasticsearch.index.query.QueryBuilder exists(String term)
-
between
protected org.springframework.data.elasticsearch.core.query.Criteria between(String term, Date from, Date to)
-
gt
protected org.springframework.data.elasticsearch.core.query.Criteria gt(String term, Date value)
-
lt
protected org.springframework.data.elasticsearch.core.query.Criteria lt(String term, Date value)
-
eq
protected org.springframework.data.elasticsearch.core.query.Criteria eq(String term, boolean value)
-
eq
protected org.springframework.data.elasticsearch.core.query.Criteria eq(String term, Date value)
-
in
protected <A extends Serializable> org.springframework.data.elasticsearch.core.query.Criteria in(String term, Set<A> values)
-
notIn
protected <A extends Serializable> org.springframework.data.elasticsearch.core.query.Criteria notIn(String term, Set<A> values)
-
eq
protected org.springframework.data.elasticsearch.core.query.Criteria eq(String term, String value)
-
neq
protected org.springframework.data.elasticsearch.core.query.Criteria neq(String term, String value)
-
startsWith
protected org.springframework.data.elasticsearch.core.query.Criteria startsWith(String term, String value)
-
contains
protected org.springframework.data.elasticsearch.core.query.Criteria contains(String term, String value)
-
find
protected org.springframework.data.domain.Page<T> find(org.springframework.data.elasticsearch.core.query.Query query, org.springframework.data.domain.Pageable pageable)
-
buildStartsWithCritria
protected org.springframework.data.elasticsearch.core.query.Criteria buildStartsWithCritria(String field, String value)
-
buildContainsCriteria
protected org.springframework.data.elasticsearch.core.query.Criteria buildContainsCriteria(String field, String value)
-
getWhereCriteria
protected org.springframework.data.elasticsearch.core.query.Criteria getWhereCriteria(String term, String value, MatchType matchType)
-
getWhereCriteria
protected org.springframework.data.elasticsearch.core.query.Criteria getWhereCriteria(String term, DateSearchParam param)
-
getQueryBuilder
protected org.elasticsearch.index.query.QueryBuilder getQueryBuilder(String term, String value, MatchType matchType)
-
isSortByValid
protected boolean isSortByValid(String sortBy)
-
getSort
protected org.springframework.data.domain.Sort getSort(S searchBean)
-
getAttributeCriteria
protected org.springframework.data.elasticsearch.core.query.Criteria getAttributeCriteria(List<Tuple<String,String>> attributes)
-
getPageable
public org.springframework.data.domain.Pageable getPageable(S searchBean, int from, int size)
- Specified by:
getPageable
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
findIds
public List<String> findIds(S searchBean, int from, int size)
- Specified by:
findIds
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
findByIds
public List<T> findByIds(Collection<String> ids, org.springframework.data.domain.Pageable pageable)
- Specified by:
findByIds
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
findByIdsPage
public org.springframework.data.domain.Page<T> findByIdsPage(Collection<String> ids, org.springframework.data.domain.Pageable pageable)
- Specified by:
findByIdsPage
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
addAdditionalCriteria
protected org.elasticsearch.index.query.BoolQueryBuilder addAdditionalCriteria(S searchBean, org.elasticsearch.index.query.BoolQueryBuilder queryBuilder)
-
mustMatch
protected boolean mustMatch(S searchBean)
-
buildNativeSearchQuery
protected org.springframework.data.elasticsearch.core.query.NativeSearchQuery buildNativeSearchQuery(S searchBean, org.elasticsearch.index.query.BoolQueryBuilder queryBuilder)
-
findAll
public org.springframework.data.domain.Page<T> findAll(int from, int size)
- Specified by:
findAll
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
findBeans
public org.springframework.data.domain.Page<T> findBeans(S searchBean, int from, int size)
- Specified by:
findBeans
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
count
public int count(S searchBean)
- Specified by:
count
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
build
protected org.springframework.data.elasticsearch.core.query.CriteriaQuery build(UserSearchBean searchBean, List<SearchParam> params, org.springframework.data.elasticsearch.core.query.CriteriaQuery query, String fieldName)
-
findAllPageable
public org.springframework.data.domain.Page<T> findAllPageable(org.springframework.data.domain.Pageable pageable)
- Specified by:
findAllPageable
in interfaceAbstractCustomElasticSearchRepository<T extends BaseIdentity,ID extends Serializable,S extends AbstractSearchBean>
-
addNestedQuery
protected void addNestedQuery(org.elasticsearch.index.query.BoolQueryBuilder queryBuilder, List<org.elasticsearch.index.query.QueryBuilder> builders, String fieldName, boolean mustMatch)
-
-