@Override public String toString() { String rule = null; for (int i = 0; i < criterionList.size(); i++) { Criterion criterion = criterionList.get(i); if (rule == null) { rule = criterion.toString(); } else { rule += " and " + criterion.toString(); } } for (int i = 0; i < orderList.size(); i++) { Order order = orderList.get(i); rule += " " + order.toString(); } return rule; }
private List<TypedValue> buildWhereClause( StringBuilder queryStringBuilder, QueryModel queryModel, Criteria criteria, CriteriaQueryTranslator criteriaQueryTranslator) { List<TypedValue> parameters = new ArrayList<TypedValue>(); queryStringBuilder.append(" where "); if (queryModel.getConditions() != null) { for (Condition condition : queryModel.getConditions()) { Criterion criterion = (Criterion) condition.getConstraint(); queryStringBuilder.append(criterion.toSqlString(criteria, criteriaQueryTranslator)); queryStringBuilder.append(" and "); parameters.addAll( Arrays.asList(criterion.getTypedValues(criteria, criteriaQueryTranslator))); } } if (queryModel.getAssociationConditions() != null) { for (Map.Entry<String, List<Condition>> associationCriteriaEntry : queryModel.getAssociationConditions().entrySet()) { CriteriaImpl.Subcriteria associationCriteria = (CriteriaImpl.Subcriteria) criteriaQueryTranslator.getCriteria(associationCriteriaEntry.getKey()); for (Condition condition : associationCriteriaEntry.getValue()) { Criterion criterion = (Criterion) condition.getConstraint(); queryStringBuilder.append( criterion.toSqlString(associationCriteria, criteriaQueryTranslator)); queryStringBuilder.append(" and "); parameters.addAll( Arrays.asList( criterion.getTypedValues(associationCriteria, criteriaQueryTranslator))); } } } queryStringBuilder.append(" ace.objectType = '"); queryStringBuilder.append(persistentClass.getSimpleName()); queryStringBuilder.append("' and ace.objectId = "); queryStringBuilder.append(criteriaQueryTranslator.getRootSQLALias()); queryStringBuilder.append('.'); queryStringBuilder.append(idField); queryStringBuilder.append(" and ace.accessibleBy = ? "); return parameters; }
public String getWithClause(String path) { final Criterion crit = withClauseMap.get(path); return crit == null ? null : crit.toSqlString(getCriteria(path), this); }
public String toString() { return criterion.toString(); }