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
SearchComponentfor 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 classMatchingSubprogramSearchComponent.NoSubprogramSearchAdditionalParameterValueMap
-
Field Summary
Fields Modifier and Type Field Description private static String__MATCHING_SUBPROGRAM_IDS_ATTR_NAMEprotected ContentSearcherFactory_contentSearcherfactoryThe 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 QuerybuildQuery(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 treevoidexecute(SearchComponentArguments args)Executes the component.intpriority()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, theSubPrograms that match the same query than thePrograms, for further special display.voidservice(ServiceManager manager)protected QuerysingleCriterionToQuery(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 criterionbooleansupports(SearchComponentArguments args)Returnstrueif 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:
servicein interfaceServiceable- Overrides:
servicein classCriterionTreeSearchComponent- Throws:
ServiceException
-
priority
public int priority()
Description copied from interface:SearchComponentGet the priority of the component. The lowest one will be executed first, and so on.- Specified by:
priorityin interfaceSearchComponent- Overrides:
priorityin classCriterionTreeSearchComponent- Returns:
- the priority of the component
-
supports
public boolean supports(SearchComponentArguments args)
Description copied from interface:SearchComponentReturnstrueif the component must beexecuted.- Specified by:
supportsin interfaceSearchComponent- Overrides:
supportsin classCriterionTreeSearchComponent- Parameters:
args- the arguments- Returns:
trueif 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:SearchComponentExecutes the component.- Specified by:
executein interfaceSearchComponent- Overrides:
executein 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, theSubPrograms that match the same query than thePrograms, for further special display.- Parameters:
serviceInstance- The service instanceuserCriteria- The user criterialang- The current lang- Returns:
- the
SubPrograms that match the same query than thePrograms - 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:CriterionTreeSearchComponentBuilds the query of the criterion tree- Overrides:
buildQueryin 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:CriterionTreeSearchComponentBuilds the query of the single criterion- Overrides:
singleCriterionToQueryin 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)
-
-