/** * Add field sort criteria. * * @param collateName optional collation name * @param isAscending sort direction */ @Override public void sortSpecification(String collateName, boolean isAscending) { // collationName is ignored for now PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); checkAnalyzed(property, false); //todo [anistor] cannot sort on analyzed field? if (sortFields == null) { sortFields = new ArrayList<>(ARRAY_INITIAL_LENGTH); } sortFields.add(new IckleParsingResult.SortFieldImpl<>(property, isAscending)); }
@Override public void predicateFullTextTerm(String term, String fuzzyFlop) { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } String comparisonValue = (String) parameterValue(term); if (phase == Phase.WHERE) { checkAnalyzed(property, true); whereBuilder.addFullTextTerm(property, comparisonValue, fuzzyFlop == null ? null : (fuzzyFlop.equals("~") ? 2 : Integer.parseInt(fuzzyFlop))); } else if (phase == Phase.HAVING) { throw log.getFullTextQueriesNotAllowedInHavingClauseException(); } else { throw new IllegalStateException(); } }
@Override public void predicateIsNull() { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } checkAnalyzed(property, false); if (phase == Phase.WHERE) { whereBuilder.addIsNull(property); } else if (phase == Phase.HAVING) { havingBuilder.addIsNull(property); } else { throw new IllegalStateException(); } }
@Override public void predicateFullTextRegexp(String term) { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } if (phase == Phase.WHERE) { checkAnalyzed(property, true); whereBuilder.addFullTextRegexp(property, term); } else if (phase == Phase.HAVING) { throw log.getFullTextQueriesNotAllowedInHavingClauseException(); } else { throw new IllegalStateException(); } }
@Override public void predicateLike(String patternValue, Character escapeCharacter) { ensureLeftSideIsAPropertyPath(); Object pattern = parameterValue(patternValue); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } checkAnalyzed(property, false); if (phase == Phase.WHERE) { whereBuilder.addLike(property, pattern, escapeCharacter); } else if (phase == Phase.HAVING) { havingBuilder.addLike(property, pattern, escapeCharacter); } else { throw new IllegalStateException(); } }
private void addComparisonPredicate(String value, ComparisonExpr.Type comparisonType) { ensureLeftSideIsAPropertyPath(); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } Object comparisonValue = parameterValue(value); checkAnalyzed(property, false); if (phase == Phase.WHERE) { whereBuilder.addComparison(property, comparisonType, comparisonValue); } else if (phase == Phase.HAVING) { havingBuilder.addComparison(property, comparisonType, comparisonValue); } else { throw new IllegalStateException(); } }
@Override public void predicateBetween(String lowerValue, String upperValue) { ensureLeftSideIsAPropertyPath(); Object lowerComparisonValue = parameterValue(lowerValue); Object upperComparisonValue = parameterValue(upperValue); PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); if (property.isEmpty()) { throw log.getPredicatesOnEntityAliasNotAllowedException(propertyPath.asStringPath()); } checkAnalyzed(property, false); if (phase == Phase.WHERE) { whereBuilder.addRange(property, lowerComparisonValue, upperComparisonValue); } else if (phase == Phase.HAVING) { havingBuilder.addRange(property, lowerComparisonValue, upperComparisonValue); } else { throw new IllegalStateException(); } }