Package com.saperion.ngc.model.resultset
Class QueryModifier
java.lang.Object
com.saperion.ngc.model.resultset.QueryModifier
Utility class for query modification.
-
Method Summary
Modifier and TypeMethodDescriptionCreates count(*) query from provided query string.static QueryModifierdefineAs()Defines QueryModifier instance.static StringextendWithOrderBy(com.saperion.rmi.SaQueryInfo originalQuery, Map<String, String> cols) Extends the provided hql query with order by clause.static StringextractAliasForDefinition(String definition, String query) Extracts the alias for the specified definition.static StringextractDefinitionName(String query) Extracts the definition name from a query string.Extracts the from-part of a query.static StringExtracts the from-part of a query.static StringremoveOrderByClause(String originalQuery) Removes the order-by clause from a query string.
-
Method Details
-
defineAs
Defines QueryModifier instance.- Returns:
QueryModifierobject.
-
extractFromForCount
Extracts the from-part of a query.- Parameters:
hql- query string- Returns:
- string with from-part
-
createCountQuery
Creates count(*) query from provided query string.- Returns:
- query string.
-
extractFromPartForCount
Extracts the from-part of a query.- Parameters:
hql- query string- Returns:
- string with from-part
-
extendWithOrderBy
public static String extendWithOrderBy(com.saperion.rmi.SaQueryInfo originalQuery, Map<String, String> cols) Extends the provided hql query with order by clause.- Parameters:
originalQuery- original querycols- column names used as sorting criteria.- Returns:
- modifyed query for sorting.
-
extractDefinitionName
Extracts the definition name from a query string.- Parameters:
query- query string- Returns:
- definition name or empty string if no definition name was found
-
extractAliasForDefinition
Extracts the alias for the specified definition.- Parameters:
definition- the definitionquery- the query-string- Returns:
- the alias or an empty string if not found
-
removeOrderByClause
Removes the order-by clause from a query string.- Parameters:
originalQuery- original query string- Returns:
- query string without order-by clause
-