Class SearchContext.LangQueryProducer
- java.lang.Object
-
- org.ametys.web.frontoffice.search.instance.model.SearchContext.LangQueryProducer
-
- Enclosing class:
- SearchContext
public static final class SearchContext.LangQueryProducer extends Object
Class wrapping an implementation ofQuery
in order toproduce(org.ametys.web.frontoffice.search.instance.model.SearchContext.ContextLangAndCurrentLang)
the final query executed for limiting the context language for a givenReturnable
.
Instances of this class should be created only inReturnable.filterReturnedDocumentQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, org.ametys.web.frontoffice.search.metamodel.AdditionalParameterValueMap)
methods, and then passed toContextQueriesWrapper.getQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<org.ametys.web.frontoffice.search.instance.model.SearchContext.LangQueryProducer>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>)
- See Also:
Returnable.filterReturnedDocumentQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, org.ametys.web.frontoffice.search.metamodel.AdditionalParameterValueMap)
,ContextQueriesWrapper.getQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<org.ametys.web.frontoffice.search.instance.model.SearchContext.LangQueryProducer>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>)
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
_acceptDocWithNolang
private Constructor<? extends Query>
_noArgConstructor
private Constructor<? extends Query>
_opAndStrConstructor
-
Constructor Summary
Constructors Constructor Description LangQueryProducer(Class<? extends Query> languageQueryClass, boolean acceptDocWithNolang)
Constructs aSearchContext.LangQueryProducer
The given class must have at least two constructors: one with no arguments in order to testexistence
; one with anQuery.Operator
and an array ofString
values in order to testequality
of the current language.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Query
produce(SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang)
Produces the Query for testing the context language
-
-
-
Field Detail
-
_noArgConstructor
private Constructor<? extends Query> _noArgConstructor
-
_opAndStrConstructor
private Constructor<? extends Query> _opAndStrConstructor
-
_acceptDocWithNolang
private boolean _acceptDocWithNolang
-
-
Constructor Detail
-
LangQueryProducer
public LangQueryProducer(Class<? extends Query> languageQueryClass, boolean acceptDocWithNolang)
Constructs aSearchContext.LangQueryProducer
The given class must have at least two constructors:- one with no arguments in order to test
existence
; - one with an
Query.Operator
and an array ofString
values in order to testequality
of the current language.
- Parameters:
languageQueryClass
- The implementation ofQuery
for testing the langacceptDocWithNolang
-true
to accept documents with no lang
- one with no arguments in order to test
-
-
Method Detail
-
produce
public final Query produce(SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang) throws Exception
Produces the Query for testing the context language- Parameters:
contextLangAndCurrentLang
- The wrapper of theContextLang
and the real current language- Returns:
- a
Query
- Throws:
Exception
- if an error occurs
-
-