public SQLInfoSelection(SelectionType selType) {
this.type = selType;
Table table = database.getTable(selType.tableName);
SQLInfoSelect selectAll;
SQLInfoSelect selectFiltered;
String from = table.getQuotedName();
List<String> clauses;
if (selType.tableName.equals(Model.HIER_TABLE_NAME)) {
clauses = null;
} else {
Table hierTable = database.getTable(Model.HIER_TABLE_NAME);
Join join = new Join(Join.INNER, hierTable.getQuotedName(), null, null,
hierTable.getColumn(Model.MAIN_KEY), table.getColumn(Model.MAIN_KEY));
from += join.toSql(dialect);
String clause = getSoftDeleteClause();
clauses = clause == null ? null : Collections.singletonList(clause);
}
if (selType.criterionKey == null) {
selectAll = makeSelect(table, from, clauses, NO_ORDER_BY, selType.selKey);
selectFiltered = makeSelect(table, from, clauses, NO_ORDER_BY, selType.selKey, selType.filterKey);
} else {
selectAll = makeSelect(table, from, clauses, NO_ORDER_BY, selType.selKey, selType.criterionKey);
selectFiltered = makeSelect(table, from, clauses, NO_ORDER_BY, selType.selKey, selType.filterKey,
selType.criterionKey);
}
this.selectAll = selectAll;
this.selectFiltered = selectFiltered;
}