Package com.saperion.util
Class FederatedQueryBuilder
java.lang.Object
com.saperion.util.FederatedQueryBuilder
The FederatedQueryBuilder can be used to build QueryStrategy dependent HQL
queries based on the users search term.
- Author:
- sts
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected QueryStrategyThe QueryStrategy used by this query builder. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildQueryReplacement(Properties templateProperties, String ddc, String query) Builds the HQL query with the configured QueryStrategy by the given parameters.booleanisSpecialQuery(String query) Indicates if the given query is a 'special' query on basis of the configured strategy.voidsetQueryStrategy(QueryStrategy queryStrategy) Sets the query strategy.voidsetQueryStrategy(String className) Sets the query strategy as classname.
-
Field Details
-
strategy
The QueryStrategy used by this query builder.
-
-
Constructor Details
-
FederatedQueryBuilder
public FederatedQueryBuilder()
-
-
Method Details
-
setQueryStrategy
Sets the query strategy as classname. The given className will be used to load according class.- Parameters:
className- The class name to be used to dynamically load the query strategy.
-
setQueryStrategy
Sets the query strategy. The given className will be used to load according class.- Parameters:
queryStrategy- The QueryStrategy to be used by this query builder.
-
isSpecialQuery
Indicates if the given query is a 'special' query on basis of the configured strategy. Special queries need to be replaced by the methodbuildQueryReplacementbefore they can be invoked.- Parameters:
query- The query in question.- Returns:
- true the given query is a special query.
- Throws:
Exception- if no QueryStrategy is set.
-
buildQueryReplacement
public String buildQueryReplacement(Properties templateProperties, String ddc, String query) throws Exception Builds the HQL query with the configured QueryStrategy by the given parameters. According to the QueryStrategy and properties a HQL query will be build from the given query.- Parameters:
templateProperties- The properties to be used.ddc- The DDC name to be used.query- The original query to be replaced.- Returns:
- The built HQL query.
- Throws:
Exception- if no QueryStrategy is set.
-