Class MatchingSubprogramSearchComponent
- java.lang.Object
-
- org.ametys.web.frontoffice.search.requesttime.impl.CriterionTreeSearchComponent
-
- org.ametys.plugins.odfweb.service.search.MatchingSubprogramSearchComponent
-
- All Implemented Interfaces:
SearchComponent
,Serviceable
public class MatchingSubprogramSearchComponent extends CriterionTreeSearchComponent
SearchComponent
for getting subprograms matching search
Note for developpers: This SearchComponent extends CriterionTreeSearchComponent just to have access to some of its protected method (#buildQuery() ...).
But it is an additional SearchComponent aiming at executing another independent Solr query, and it is not meant at all to override and replace CriterionTreeSearchComponent.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MatchingSubprogramSearchComponent.NoSubprogramSearchAdditionalParameterValueMap
-
Field Summary
Fields Modifier and Type Field Description private static String
__MATCHING_SUBPROGRAM_IDS_ATTR_NAME
protected ContentSearcherFactory
_contentSearcherfactory
The content searcher factory-
Fields inherited from class org.ametys.web.frontoffice.search.requesttime.impl.CriterionTreeSearchComponent
__EMPTY_QUERY, _advancedQueryBuilder, _i18nUtils, _treeMaker
-
Fields inherited from interface org.ametys.web.frontoffice.search.requesttime.SearchComponent
DISABLE_DEFAULT_SAX_PARAMETER_NAME, MAX_PRIORITY, MIN_PRIORITY, SEARCH_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description MatchingSubprogramSearchComponent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
_containsProgramReturnable(SearchServiceInstance serviceInstance)
(package private) static List<String>
_getMatchingSubProgramIds(Request request)
private boolean
_mustKeepCriterion(FOSearchCriterion criterion)
private boolean
_needSubprogramDiscrimination(SearchServiceInstance serviceInstance)
(package private) static void
_removeMatchingSubProgramIdsRequestAttribute(Request request)
private static void
_storeInReqMatchingSubProgramIds(Request request, List<String> subPrograms)
protected Query
buildQuery(AbstractTreeNode<FOSearchCriterion> criterionTree, Map<String,Object> userCriteria, Collection<Returnable> returnables, Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameters, String currentLang, Map<String,Object> contextualParameters)
Builds the query of the criterion treevoid
execute(SearchComponentArguments args)
Executes the component.int
priority()
Get the priority of the component.protected List<String>
retrieveSubProgramsMatchingSearch(SearchServiceInstance serviceInstance, Map<String,Object> userCriteria, String lang)
Retrieves, thanks to a (independent but close to the main one) Solr search, theSubProgram
s that match the same query than theProgram
s, for further special display.void
service(ServiceManager manager)
protected Query
singleCriterionToQuery(FOSearchCriterion searchCriterion, Map<String,Object> userCriteria, Collection<Returnable> returnables, Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameters, String currentLang, Map<String,Object> contextualParameters)
Builds the query of the single criterionboolean
supports(SearchComponentArguments args)
Returnstrue
if the component must beexecuted
.-
Methods inherited from class org.ametys.web.frontoffice.search.requesttime.impl.CriterionTreeSearchComponent
checkValidInputs, checkValidInputSingleValue, checkValidInputValues
-
-
-
-
Field Detail
-
__MATCHING_SUBPROGRAM_IDS_ATTR_NAME
private static final String __MATCHING_SUBPROGRAM_IDS_ATTR_NAME
-
_contentSearcherfactory
protected ContentSearcherFactory _contentSearcherfactory
The content searcher factory
-
-
Constructor Detail
-
MatchingSubprogramSearchComponent
public MatchingSubprogramSearchComponent()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classCriterionTreeSearchComponent
- Throws:
ServiceException
-
priority
public int priority()
Description copied from interface:SearchComponent
Get the priority of the component. The lowest one will be executed first, and so on.- Specified by:
priority
in interfaceSearchComponent
- Overrides:
priority
in classCriterionTreeSearchComponent
- Returns:
- the priority of the component
-
supports
public boolean supports(SearchComponentArguments args)
Description copied from interface:SearchComponent
Returnstrue
if the component must beexecuted
.- Specified by:
supports
in interfaceSearchComponent
- Overrides:
supports
in classCriterionTreeSearchComponent
- Parameters:
args
- the arguments- Returns:
true
if the component must beexecuted
.
-
_containsProgramReturnable
private boolean _containsProgramReturnable(SearchServiceInstance serviceInstance)
-
_needSubprogramDiscrimination
private boolean _needSubprogramDiscrimination(SearchServiceInstance serviceInstance)
-
execute
public void execute(SearchComponentArguments args) throws Exception
Description copied from interface:SearchComponent
Executes the component.- Specified by:
execute
in interfaceSearchComponent
- Overrides:
execute
in classCriterionTreeSearchComponent
- Parameters:
args
- the arguments- Throws:
Exception
- if an exception occurs. Other search components will be attempted to be executed
-
retrieveSubProgramsMatchingSearch
protected List<String> retrieveSubProgramsMatchingSearch(SearchServiceInstance serviceInstance, Map<String,Object> userCriteria, String lang) throws Exception
Retrieves, thanks to a (independent but close to the main one) Solr search, theSubProgram
s that match the same query than theProgram
s, for further special display.- Parameters:
serviceInstance
- The service instanceuserCriteria
- The user criterialang
- The current lang- Returns:
- the
SubProgram
s that match the same query than theProgram
s - Throws:
Exception
- If an exception occured during the Solr search
-
buildQuery
protected Query buildQuery(AbstractTreeNode<FOSearchCriterion> criterionTree, Map<String,Object> userCriteria, Collection<Returnable> returnables, Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameters, String currentLang, Map<String,Object> contextualParameters)
Description copied from class:CriterionTreeSearchComponent
Builds the query of the criterion tree- Overrides:
buildQuery
in classCriterionTreeSearchComponent
- Parameters:
criterionTree
- The criterion tree of the service instanceuserCriteria
- The user input criteriareturnables
- The returnables of the service instancesearchables
- The searchables of the service instanceadditionalParameters
- The values of additional parameters of the service instancecurrentLang
- The current langcontextualParameters
- the search contextual parameters.- Returns:
- The query of the criterion tree
-
singleCriterionToQuery
protected Query singleCriterionToQuery(FOSearchCriterion searchCriterion, Map<String,Object> userCriteria, Collection<Returnable> returnables, Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameters, String currentLang, Map<String,Object> contextualParameters)
Description copied from class:CriterionTreeSearchComponent
Builds the query of the single criterion- Overrides:
singleCriterionToQuery
in classCriterionTreeSearchComponent
- Parameters:
searchCriterion
- The criterionuserCriteria
- The user input criteriareturnables
- The returnables of the service instancesearchables
- The searchables of the service instanceadditionalParameters
- The values of additional parameters of the service instancecurrentLang
- The current langcontextualParameters
- the search contextual parameters.- Returns:
- The query of the single criterion
-
_mustKeepCriterion
private boolean _mustKeepCriterion(FOSearchCriterion criterion)
-
_storeInReqMatchingSubProgramIds
private static void _storeInReqMatchingSubProgramIds(Request request, List<String> subPrograms)
-
_getMatchingSubProgramIds
static List<String> _getMatchingSubProgramIds(Request request)
-
_removeMatchingSubProgramIdsRequestAttribute
static void _removeMatchingSubProgramIdsRequestAttribute(Request request)
-
-