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 ofQueryin 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_acceptDocWithNolangprivate Constructor<? extends Query>_noArgConstructorprivate 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.Operatorand an array ofStringvalues in order to testequalityof the current language. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Queryproduce(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.Operatorand an array ofStringvalues in order to testequalityof the current language. 
- Parameters:
 languageQueryClass- The implementation ofQueryfor testing the langacceptDocWithNolang-trueto 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 theContextLangand the real current language- Returns:
 - a 
Query - Throws:
 Exception- if an error occurs
 
 - 
 
 -