@Test public void testOrder() { final List<Order> orders = new ArrayList<Order>(); final CriteriaBuilder cb = new CriteriaBuilder(OnmsAlarm.class); cb.orderBy("firstEventTime"); orders.add(Order.asc("firstEventTime")); assertArrayEquals(orders.toArray(EMPTY_ORDER_ARRAY), cb.toCriteria().getOrders().toArray(EMPTY_ORDER_ARRAY)); cb.clearOrder(); orders.clear(); cb.orderBy("firstEventTime").desc(); orders.add(Order.desc("firstEventTime")); assertArrayEquals(orders.toArray(), cb.toCriteria().getOrders().toArray()); cb.clearOrder(); orders.clear(); cb.orderBy("firstEventTime").desc(); cb.orderBy("id").desc(); orders.add(Order.desc("firstEventTime")); orders.add(Order.desc("id")); assertArrayEquals(orders.toArray(), cb.toCriteria().getOrders().toArray()); assertEquals(Order.asc("firstEventTime"), Order.desc("firstEventTime")); cb.clearOrder(); orders.clear(); cb.orderBy("firstEventTime").desc(); cb.orderBy("id").desc(); orders.add(Order.desc("firstEventTime")); orders.add(Order.desc("id")); cb.orderBy("firstEventTime").asc(); assertArrayEquals(orders.toArray(), cb.toCriteria().getOrders().toArray()); cb.orderBy("id").asc(); assertArrayEquals(orders.toArray(), cb.toCriteria().getOrders().toArray()); cb.clearOrder().orderBy("id").asc(); orders.clear(); orders.add(Order.asc("id")); assertArrayEquals(orders.toArray(), cb.toCriteria().getOrders().toArray()); }
public Collection<Order> getOrders() { return Collections.unmodifiableList(m_orders); }
Criteria implements Cloneable { public Collection<Order> getOrders() { return Collections.unmodifiableList(m_orders); } }
Criteria implements Cloneable { public Collection<Order> getOrders() { return Collections.unmodifiableList(m_orders); } Criteria(final Class<?> clazz); }
Criteria implements Cloneable { public Collection<Order> getOrders() { return Collections.unmodifiableList(m_orders); } Criteria(final Class<?> clazz); void visit(final CriteriaVisitor visitor); Class<?> getCriteriaClass(); Collection<Order> getOrders(); void setOrders(final Collection<? extends Order> orderCollection); Collection<Fetch> getFetchTypes(); void setFetchTypes(final Collection<? extends Fetch> fetchTypes); Collection<Alias> getAliases(); void setAliases(final Collection<? extends Alias> aliases); Collection<Restriction> getRestrictions(); void setRestrictions(Collection<? extends Restriction> restrictions); void addRestriction(final Restriction restriction); boolean isDistinct(); void setDistinct(final boolean distinct); Integer getLimit(); void setLimit(final Integer limit); Integer getOffset(); void setOffset(final Integer offset); Class<?> getType(final String path); @Override String toString(); @Override Criteria clone(); }
Criteria implements Cloneable { public Collection<Order> getOrders() { return Collections.unmodifiableList(m_orders); } Criteria(final Class<?> clazz); void visit(final CriteriaVisitor visitor); Class<?> getCriteriaClass(); Collection<Order> getOrders(); void setOrders(final Collection<? extends Order> orderCollection); Collection<Fetch> getFetchTypes(); void setFetchTypes(final Collection<? extends Fetch> fetchTypes); Collection<Alias> getAliases(); void setAliases(final Collection<? extends Alias> aliases); Collection<Restriction> getRestrictions(); void setRestrictions(Collection<? extends Restriction> restrictions); void addRestriction(final Restriction restriction); boolean isDistinct(); void setDistinct(final boolean distinct); Integer getLimit(); void setLimit(final Integer limit); Integer getOffset(); void setOffset(final Integer offset); Class<?> getType(final String path); @Override String toString(); @Override Criteria clone();  }