public class CriterionTreeSearchComponent extends Object implements SearchComponent, Serviceable
| Modifier and Type | Field and Description |
|---|---|
protected static Query |
__EMPTY_QUERY
The
Query building to the empty string |
protected AdvancedQueryBuilder |
_advancedQueryBuilder
The builder of advanced queries
|
protected I18nUtils |
_i18nUtils
The utils for i18nizable texts
|
protected TreeMaker |
_treeMaker
The Advanced tree maker
|
DISABLE_DEFAULT_SAX_PARAMETER_NAME, MAX_PRIORITY, MIN_PRIORITY, SEARCH_PRIORITY| Constructor and Description |
|---|
CriterionTreeSearchComponent() |
| Modifier and Type | Method and Description |
|---|---|
private Map<String,Object> |
_contextualParameters(Site currentSite) |
private void |
_logTree(Logger logger,
AbstractTreeNode<FOSearchCriterion> tree,
Map<String,Object> userCriteria) |
private Query |
_queryFromTransformedValAndRealOperator(SearchCriterionDefinition criterionDefinition,
Object transformedVal,
Query.Operator realOperator,
Collection<Returnable> returnables,
Collection<Searchable> searchables,
AdditionalParameterValueMap additionalParameters,
String currentLang,
Map<String,Object> contextualParameters) |
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 tree
|
protected void |
checkValidInputs(AbstractTreeNode<FOSearchCriterion> criterionTree,
Map<String,Object> userCriteria)
Checks the user inputs are valid
|
protected void |
checkValidInputSingleValue(Object userCriterionSingleValue,
String criterionId,
FOSearchCriterionMode mode,
Optional<EnumeratedValues.RestrictedValues> optionalRestrictedValues,
Validator validator)
Checks a single value of one user input for one criterion is valid
|
protected void |
checkValidInputValues(Object userCriterionValues,
String criterionId,
FOSearchCriterionMode mode,
Optional<EnumeratedValues.RestrictedValues> optionalRestrictedValues,
Validator validator)
Checks the user inputs for one criterion (can be multiple) are valid
|
void |
execute(SearchComponentArguments args)
Executes the component.
|
int |
priority()
Get the priority of the component.
|
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 criterion
|
boolean |
supports(SearchComponentArguments args)
Returns
true if the component must be executed. |
protected static final Query __EMPTY_QUERY
Query building to the empty stringprotected I18nUtils _i18nUtils
protected AdvancedQueryBuilder _advancedQueryBuilder
protected TreeMaker _treeMaker
public CriterionTreeSearchComponent()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionpublic int priority()
SearchComponentpriority in interface SearchComponentpublic boolean supports(SearchComponentArguments args)
SearchComponenttrue if the component must be executed.supports in interface SearchComponentargs - the argumentstrue if the component must be executed.public void execute(SearchComponentArguments args) throws Exception
SearchComponentexecute in interface SearchComponentargs - the argumentsException - if an exception occurs. Other search components will be attempted to be executedprivate Map<String,Object> _contextualParameters(Site currentSite)
protected void checkValidInputs(AbstractTreeNode<FOSearchCriterion> criterionTree, Map<String,Object> userCriteria) throws InvalidUserInputException
criterionTree - The criterion tree of the service instanceuserCriteria - The user input criteriaInvalidUserInputException - if at least one user input is invalidprotected void checkValidInputValues(Object userCriterionValues, String criterionId, FOSearchCriterionMode mode, Optional<EnumeratedValues.RestrictedValues> optionalRestrictedValues, Validator validator) throws InvalidUserInputException
userCriterionValues - The multiple user values (then it is a List) or the single user valuecriterionId - The criterion idmode - The criterion modeoptionalRestrictedValues - The EnumeratedValues.RestrictedValues if mode is FOSearchCriterionMode.RESTRICTED_USER_INPUTvalidator - The criterion validatorInvalidUserInputException - if at least one user input is invalidprotected void checkValidInputSingleValue(Object userCriterionSingleValue, String criterionId, FOSearchCriterionMode mode, Optional<EnumeratedValues.RestrictedValues> optionalRestrictedValues, Validator validator) throws InvalidUserInputException
userCriterionSingleValue - The single user valuecriterionId - The criterion idmode - The criterion modeoptionalRestrictedValues - The EnumeratedValues.RestrictedValues if mode is FOSearchCriterionMode.RESTRICTED_USER_INPUTvalidator - The criterion validatorInvalidUserInputException - if the user input is invalidprivate void _logTree(Logger logger, AbstractTreeNode<FOSearchCriterion> tree, Map<String,Object> userCriteria)
protected Query buildQuery(AbstractTreeNode<FOSearchCriterion> criterionTree, Map<String,Object> userCriteria, Collection<Returnable> returnables, Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameters, String currentLang, Map<String,Object> contextualParameters)
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.protected Query singleCriterionToQuery(FOSearchCriterion searchCriterion, Map<String,Object> userCriteria, Collection<Returnable> returnables, Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameters, String currentLang, Map<String,Object> contextualParameters)
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.private Query _queryFromTransformedValAndRealOperator(SearchCriterionDefinition criterionDefinition, Object transformedVal, Query.Operator realOperator, Collection<Returnable> returnables, Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameters, String currentLang, Map<String,Object> contextualParameters)