use of org.hisp.dhis.parser.expression.literal.SqlLiteral in project dhis2-core by dhis2.
the class DefaultProgramIndicatorService method _getAnalyticsSql.
private String _getAnalyticsSql(String expression, ProgramIndicator programIndicator, Date startDate, Date endDate, String tableAlias) {
Set<String> uids = getDataElementAndAttributeIdentifiers(expression, programIndicator.getAnalyticsType());
ProgramExpressionParams params = ProgramExpressionParams.builder().programIndicator(programIndicator).reportingStartDate(startDate).reportingEndDate(endDate).dataElementAndAttributeIdentifiers(uids).build();
CommonExpressionVisitor visitor = newVisitor(ITEM_GET_SQL, params);
visitor.setExpressionLiteral(new SqlLiteral());
String sql = castString(Parser.visit(expression, visitor));
return (tableAlias != null ? sql.replaceAll(ANALYTICS_TBL_ALIAS + "\\.", tableAlias + "\\.") : sql);
}
Aggregations