diff --git a/src/main/java/de/metas/ui/web/view/descriptor/SqlViewBinding.java b/src/main/java/de/metas/ui/web/view/descriptor/SqlViewBinding.java index 89f86acea..86addfe67 100644 --- a/src/main/java/de/metas/ui/web/view/descriptor/SqlViewBinding.java +++ b/src/main/java/de/metas/ui/web/view/descriptor/SqlViewBinding.java @@ -370,7 +370,7 @@ public String getSqlCreateSelectionFrom( // // SELECT ... FROM ... WHERE 1=1 { IStringExpression sqlOrderBy = SqlDocumentOrderByBuilder.newInstance(this::getFieldOrderBy).buildSqlOrderBy(defaultOrderBys); - if (sqlOrderBy.isNullExpression()) + if (sqlOrderBy == null || sqlOrderBy.isNullExpression()) { sqlOrderBy = ConstantStringExpression.of(keyColumnNameFQ); } diff --git a/src/main/java/de/metas/ui/web/window/model/sql/SqlDocumentQueryBuilder.java b/src/main/java/de/metas/ui/web/window/model/sql/SqlDocumentQueryBuilder.java index a8d43b1e5..37b1fa235 100644 --- a/src/main/java/de/metas/ui/web/window/model/sql/SqlDocumentQueryBuilder.java +++ b/src/main/java/de/metas/ui/web/window/model/sql/SqlDocumentQueryBuilder.java @@ -7,7 +7,6 @@ import org.adempiere.ad.expression.api.IExpressionEvaluator.OnVariableNotFound; import org.adempiere.ad.expression.api.IStringExpression; import org.adempiere.ad.expression.api.impl.CompositeStringExpression; -import org.adempiere.ad.security.IUserRolePermissions; import org.adempiere.ad.security.UserRolePermissionsKey; import org.adempiere.ad.security.impl.AccessSqlStringExpression; import org.adempiere.exceptions.AdempiereException; @@ -113,7 +112,7 @@ public String toString() .toString(); } - public Evaluatee getEvaluationContext() + private Evaluatee getEvaluationContext() { if (_evaluationContext == null) { @@ -161,11 +160,6 @@ private String getPermissionsKey() return UserRolePermissionsKey.toPermissionsKeyString(getCtx()); } - public IUserRolePermissions getPermissions() - { - return Env.getUserRolePermissions(getCtx()); - } - public String getSql(final List outSqlParams) { final Evaluatee evalCtx = getEvaluationContext(); @@ -185,7 +179,7 @@ private IStringExpression getSql() return _sqlExpr; } - public List getSqlParams() + private List getSqlParams() { return _sqlParams; } @@ -215,7 +209,7 @@ private final void buildSql() if (isSorting()) { final IStringExpression sqlOrderBy = getSqlOrderByEffective(); - if (!sqlOrderBy.isNullExpression()) + if (sqlOrderBy != null && !sqlOrderBy.isNullExpression()) { sqlBuilder.append("\n ORDER BY ").append(sqlOrderBy); } @@ -247,7 +241,7 @@ private IStringExpression getSqlSelectFrom() return entityBinding.getSqlSelectAllFrom(); } - public IStringExpression getSqlWhere() + private IStringExpression getSqlWhere() { if (_sqlWhereExpr == null) { @@ -256,7 +250,7 @@ public IStringExpression getSqlWhere() return _sqlWhereExpr; } - public List getSqlWhereParams() + private List getSqlWhereParams() { if (_sqlWhereParams == null) { @@ -339,7 +333,7 @@ private void buildSqlWhereClause() _sqlWhereParams = sqlParams; } - public List getOrderBysEffective() + private List getOrderBysEffective() { if (noSorting) { @@ -355,18 +349,13 @@ public List getOrderBysEffective() return entityBinding.getDefaultOrderBys(); } - public IStringExpression getSqlOrderByEffective() + private IStringExpression getSqlOrderByEffective() { final List orderBys = getOrderBysEffective(); return SqlDocumentOrderByBuilder.newInstance(entityBinding::getFieldOrderBy).buildSqlOrderBy(orderBys); } - public SqlDocumentEntityDataBindingDescriptor getEntityBinding() - { - return entityBinding; - } - - public List getDocumentFilters() + private List getDocumentFilters() { return documentFilters == null ? ImmutableList.of() : ImmutableList.copyOf(documentFilters); }