Class SQLBuilder
java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.data.builder.AbstractQueryBuilder
com.almis.awe.service.data.builder.SQLBuilder
- All Implemented Interfaces:
QueryBuilder
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
SQLMaintainBuilder
,SQLQueryBuilder
Generates sql codes
-
Field Summary
Fields inherited from class com.almis.awe.service.data.builder.AbstractQueryBuilder
componentSortList, parameters, queryUtil, variableIndex, variables
-
Constructor Summary
ModifierConstructorDescriptionprotected
SQLBuilder
(QueryUtil queryUtil, EncodeService encodeService) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected com.querydsl.core.types.dsl.PathBuilder<Object>
Build a path with pathbuilderprotected com.querydsl.core.types.dsl.PathBuilder<Object>
Build a path with pathbuilderprotected com.querydsl.core.types.dsl.SimpleExpression<Object>
Build a path with pathbuilderprotected com.querydsl.core.types.Expression
generateOperationExpression
(Operation operation, com.querydsl.core.types.Expression... operands) Apply operand into operationprotected com.querydsl.core.types.Expression
getCaseExpression
(Case field) Retrieve case expressionprotected com.querydsl.core.types.Expression
getConstantExpression
(Constant field) Retrieve field expressionprotected com.querydsl.core.types.Expression
getExpressionCast
(com.querydsl.core.types.Expression fieldExpression, String cast) Add cast to expressionprotected com.querydsl.core.types.Expression
getExpressionFunction
(com.querydsl.core.types.Expression fieldExpression, String function) Add function to expressionprotected com.querydsl.sql.SQLQueryFactory
Retrieve sql factoryprotected com.querydsl.core.types.Expression
getFieldAliasExpression
(SqlField field, String table) Retrieve field expressionprotected com.querydsl.core.types.Expression
getFieldExpression
(Field field) Retrieve field expressionprotected com.querydsl.core.types.dsl.BooleanExpression
getFilterGroups
(FilterGroup group) Adds filter groups conditionsprotected com.querydsl.core.types.Expression
getOperandExpression
(SqlField operand) Retrieve operand templateprotected com.querydsl.core.types.Expression
getOperationExpression
(Operation operation) Retrieve operation expressionprotected com.querydsl.core.types.OrderSpecifier
getOrderByExpression
(OrderBy orderBy) Retrieve order by expressionprotected com.querydsl.core.types.Expression
getOverExpression
(Over field) Retrieve over expressionprotected com.querydsl.core.types.Expression
getSimpleFieldExpression
(String table, String field, String function) Retrieve field expression from table, field and functionprotected com.querydsl.core.types.Expression
getSqlFieldExpression
(SqlField field) Retrieve operand templateprotected com.querydsl.core.types.Expression
getStringExpression
(String value) Retrieve string expression with quotesprotected com.querydsl.sql.SQLQuery<com.querydsl.core.Tuple>
getSubquery
(String queryId) Generates a SQLQuery as a subqueryprotected com.querydsl.sql.RelationalPath
Get table expression with schemaprotected Object
getTableExpression
(Table table, boolean withAlias) Retrieve table expressionprotected com.querydsl.core.types.Expression
getVariableAsExpression
(String value, ParameterType type) Generate variable for parameterprotected com.querydsl.core.types.Expression
getVariableAsExpressionOrEmpty
(String value, ParameterType type) Generate variable for parameterprotected com.querydsl.core.types.Expression
getVariableAsExpressionOrNull
(String value, ParameterType type) Generate variable for parameterprotected com.querydsl.core.types.Expression
getVariableExpression
(String variableName) Retrieve a single variable as an ExpressionsetFactory
(com.querydsl.sql.SQLQueryFactory factory) Sets the SQLQueryFactory used by QueryDSL to create the SQLQueryMethods inherited from class com.almis.awe.service.data.builder.AbstractQueryBuilder
addComponentSort, extractValuesFromParameters, getVariableAsString, getVariables, setVariables, transformFromJsonNode
Methods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.almis.awe.service.data.builder.QueryBuilder
build, setQuery
-
Constructor Details
-
SQLBuilder
Autowired constructor- Parameters:
queryUtil
- Query utilitiesencodeService
- Encode service
-
-
Method Details
-
getFactory
protected com.querydsl.sql.SQLQueryFactory getFactory()Retrieve sql factory- Returns:
- SQL Factory
-
setFactory
Sets the SQLQueryFactory used by QueryDSL to create the SQLQuery- Parameters:
factory
- Factory- Returns:
- this
-
getSubquery
protected com.querydsl.sql.SQLQuery<com.querydsl.core.Tuple> getSubquery(String queryId) throws AWException Generates a SQLQuery as a subquery- Parameters:
queryId
- Id of the query to generate- Returns:
- subquery
- Throws:
AWException
- Error retrieving subquery
-
getFieldExpression
Retrieve field expression- Parameters:
field
- Field to retrieve- Returns:
- Expression field expression
- Throws:
AWException
- Error retrieving field expression
-
getSimpleFieldExpression
protected com.querydsl.core.types.Expression getSimpleFieldExpression(String table, String field, String function) Retrieve field expression from table, field and function- Parameters:
table
- tablefield
- fieldfunction
- function- Returns:
- Field expression
-
getConstantExpression
protected com.querydsl.core.types.Expression getConstantExpression(Constant field) throws AWException Retrieve field expression- Parameters:
field
- Field to retrieve- Returns:
- Expression field expression
- Throws:
AWException
- Error retrieving field expression
-
getVariableExpression
protected com.querydsl.core.types.Expression getVariableExpression(String variableName) throws AWException Retrieve a single variable as an Expression- Parameters:
variableName
- Variable name- Returns:
- Expression
- Throws:
AWException
-
getFieldAliasExpression
Retrieve field expression- Parameters:
field
- Field to retrievetable
- Table of the field- Returns:
- Expression field expression
-
getOperationExpression
protected com.querydsl.core.types.Expression getOperationExpression(Operation operation) throws AWException Retrieve operation expression- Parameters:
operation
- Operation to manage- Returns:
- Expression concat expression
- Throws:
AWException
-
generateOperationExpression
protected com.querydsl.core.types.Expression generateOperationExpression(Operation operation, com.querydsl.core.types.Expression... operands) Apply operand into operation- Parameters:
operation
- Operationoperands
- Operand list- Returns:
- Operation expression
-
getOperandExpression
protected com.querydsl.core.types.Expression getOperandExpression(SqlField operand) throws AWException Retrieve operand template- Parameters:
operand
- Operand to retrieve template- Returns:
- Expression concat expression
- Throws:
AWException
-
getSqlFieldExpression
protected com.querydsl.core.types.Expression getSqlFieldExpression(SqlField field) throws AWException Retrieve operand template- Parameters:
field
- Operand to retrieve template- Returns:
- Expression concat expression
- Throws:
AWException
-
getCaseExpression
Retrieve case expression- Parameters:
field
- Field to apply the case when condition- Returns:
- Expression caseWhen expression
- Throws:
AWException
-
getOverExpression
Retrieve over expression- Parameters:
field
- Field to apply the case when condition- Returns:
- Expression caseWhen expression
- Throws:
AWException
-
getOrderByExpression
Retrieve order by expression- Parameters:
orderBy
- Order by- Returns:
- Expression
-
getTableExpression
Retrieve table expression- Parameters:
table
- Table- Returns:
- Table expression
- Throws:
AWException
- Error generating table expression
-
getTable
Get table expression with schema- Parameters:
table
- Table- Returns:
- Table expression
-
getVariableAsExpression
protected com.querydsl.core.types.Expression getVariableAsExpression(String value, ParameterType type) throws AWException Generate variable for parameter- Parameters:
value
- Variable valuetype
- Variable type- Returns:
- Variable as expression
- Throws:
AWException
- Variable replacement was wrong
-
getVariableAsExpressionOrEmpty
protected com.querydsl.core.types.Expression getVariableAsExpressionOrEmpty(String value, ParameterType type) throws AWException Generate variable for parameter- Parameters:
value
- Variable valuetype
- Variable type- Returns:
- Variable as expression
- Throws:
AWException
- Variable replacement was wrong
-
getVariableAsExpressionOrNull
protected com.querydsl.core.types.Expression getVariableAsExpressionOrNull(String value, ParameterType type) Generate variable for parameter- Parameters:
value
- Variable valuetype
- Variable type- Returns:
- Variable as expression
-
getExpressionFunction
protected com.querydsl.core.types.Expression getExpressionFunction(com.querydsl.core.types.Expression fieldExpression, String function) Add function to expression- Parameters:
fieldExpression
- Current field expressionfunction
- Function- Returns:
- Expression
-
getExpressionCast
protected com.querydsl.core.types.Expression getExpressionCast(com.querydsl.core.types.Expression fieldExpression, String cast) Add cast to expression- Parameters:
fieldExpression
- Current field expressioncast
- Function- Returns:
- Expression
-
getFilterGroups
protected com.querydsl.core.types.dsl.BooleanExpression getFilterGroups(FilterGroup group) throws AWException Adds filter groups conditions- Parameters:
group
- FilterGroup to add- Returns:
- BooleanExpression result of filter
- Throws:
AWException
- Filter group statement generation error
-
getStringExpression
Retrieve string expression with quotes- Parameters:
value
- String value- Returns:
- String expression with quotes
-
buildPath
protected com.querydsl.core.types.dsl.SimpleExpression<Object> buildPath(String parent, String node, String alias) Build a path with pathbuilder- Parameters:
parent
- Parentnode
- Nodealias
- Alias- Returns:
- Field path
-
buildPath
Build a path with pathbuilder- Parameters:
parent
- Parent nodenode
- Node- Returns:
- path
-
buildPath
Build a path with pathbuilder- Parameters:
node
- Node- Returns:
- path
-