public void addOrdering(String path, String descending, String ignoreCase) { if (orderings == null) { orderings = new ArrayList(); } if (path != null && path.trim().length() == 0) { path = null; } boolean isDescending = "true".equalsIgnoreCase(descending); boolean isIgnoringCase = "true".equalsIgnoreCase(ignoreCase); orderings.add(new Ordering(path, !isDescending, isIgnoringCase)); }
/** * Add an ascending ordering on the given property. If there is already an ordering * on this query then add this ordering with a lower priority. * * @param property the property to sort on * @return this object */ public ColumnSelect<T> orderBy(String property) { return orderBy(new Ordering(property)); }
/** * @return Descending case insensitive sort orderings on this property. */ public Ordering descInsensitive() { return new Ordering(getExpression(), SortOrder.DESCENDING_INSENSITIVE); }
/** * Add an ordering on the given property. If there is already an ordering * on this query then add this ordering with a lower priority. * * @param property the property to sort on * @param sortOrder the direction of the ordering * @return this object */ public ColumnSelect<T> orderBy(String property, SortOrder sortOrder) { return orderBy(new Ordering(property, sortOrder)); }
/** * Add an ordering on the given property. If there is already an ordering * on this query then add this ordering with a lower priority. * * @param property the property to sort on * @param sortOrder the direction of the ordering * @return this object */ public ObjectSelect<T> orderBy(String property, SortOrder sortOrder) { return orderBy(new Ordering(property, sortOrder)); }
/** * Adds ordering specification to this query orderings. * * @since 3.0 */ public void addOrdering(String sortPathSpec, SortOrder order) { addOrdering(new Ordering(sortPathSpec, order)); }
/** * Add an ascending ordering on the given property. If there is already an ordering * on this query then add this ordering with a lower priority. * * @param property the property to sort on * @return this object */ public ObjectSelect<T> orderBy(String property) { return orderBy(new Ordering(property)); }
/** * @return Descending sort orderings on this property. */ public Ordering desc() { return new Ordering(getExpression(), SortOrder.DESCENDING); }
/** * @return Ascending sort orderings on this property. */ public Ordering asc() { return new Ordering(getExpression(), SortOrder.ASCENDING); }
/** * @return Ascending case insensitive sort orderings on this property. */ public Ordering ascInsensitive() { return new Ordering(getExpression(), SortOrder.ASCENDING_INSENSITIVE); }
/** Adds ordering specification to this query orderings. */ public void addOrdering(String sortPathSpec, boolean isAscending, boolean ignoreCase) { this.addOrdering(new Ordering(sortPathSpec, isAscending, ignoreCase)); }
/** Adds ordering specification to this query orderings. */ public void addOrdering(String sortPathSpec, boolean isAscending) { this.addOrdering(new Ordering(sortPathSpec, isAscending)); }
void addOrdering(String path, String descending, String ignoreCase) { if (orderings == null) { orderings = new ArrayList<>(); } if (path != null && path.trim().length() == 0) { path = null; } boolean isDescending = "true".equalsIgnoreCase(descending); boolean isIgnoringCase = "true".equalsIgnoreCase(ignoreCase); SortOrder order; if (isDescending) { order = isIgnoringCase ? SortOrder.DESCENDING_INSENSITIVE : SortOrder.DESCENDING; } else { order = isIgnoringCase ? SortOrder.ASCENDING_INSENSITIVE : SortOrder.ASCENDING; } orderings.add(new Ordering(path, order)); }
String key = ordering.get("key"); if (key != null) { descriptor.addOrdering(new Ordering(key, asc ? SortOrder.ASCENDING : SortOrder.DESCENDING));
void addOrdering() { String orderingPath = getSelectedPath(); if (orderingPath == null) { return; } // check if such ordering already exists for (Ordering ord : selectQuery.getOrderings()) { if (orderingPath.equals(ord.getSortSpecString())) { return; } } selectQuery.addOrdering(new Ordering(orderingPath, SortOrder.ASCENDING)); int index = selectQuery.getOrderings().size() - 1; OrderingModel model = (OrderingModel) table.getModel(); model.fireTableRowsInserted(index, index); mediator.fireQueryEvent(new QueryEvent(SelectQueryOrderingTab.this, selectQuery)); }
private void collectOrdering(ResourceEntity<?> resourceEntity, Sort sort) { String property = sort.getProperty(); if (property != null && !property.isEmpty()) { // TODO: do we need to support nested ID? AgEntity<?> entity = resourceEntity.getAgEntity(); // note using "toString" instead of "getPath" to convert ASTPath to // String representation. This ensures "db:" prefix is preserved if // present property = pathCache.getPathDescriptor(entity, new ASTObjPath(sort.getProperty())).getPathExp().toString(); // check for dupes... for (Ordering o : resourceEntity.getOrderings()) { if (property.equals(o.getSortSpecString())) { return; } } Dir direction = sort.getDirection(); if (direction == null) { direction = Dir.ASC; } SortOrder so = direction == Dir.ASC ? SortOrder.ASCENDING : SortOrder.DESCENDING; resourceEntity.getOrderings().add(new Ordering(property, so)); } } }
boolean isDesc = d != null && d.toLowerCase().equals("desc"); Ordering ordering = new Ordering(prop, isDesc ? SortOrder.DESCENDING : SortOrder.ASCENDING); query.addOrdering(ordering);