Changeset 5061


Ignore:
Timestamp:
Aug 19, 2009, 11:24:43 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #108: Logging the change history of an item

  • Add 'id' as an extra sort column so that events that have the same timestamp are sorted in the order they were added.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/ItemContext.java

    r5047 r5061  
    14441444      Items are sorted in ascending order.
    14451445    */
    1446     ASC(0, "ascending"),
     1446    ASC(0, "ascending")
     1447    {
     1448      @Override
     1449      public Order sortBy(Expression e)
     1450      {
     1451        return Orders.asc(e);
     1452      }
     1453    },
     1454   
    14471455    /**
    14481456      Items are sorted in descending order.
    14491457    */
    1450     DESC(1, "descending");
     1458    DESC(1, "descending")   
     1459    {
     1460      @Override
     1461      public Order sortBy(Expression e)
     1462      {
     1463        return Orders.desc(e);
     1464      }
     1465    };
    14511466 
    14521467    /**
     
    14981513    }
    14991514   
     1515    /**
     1516      Create an order expression that can be used with
     1517      queries: {@link Query#order(Order)}.
     1518      @param e The expression to sort by
     1519      @return An order object
     1520      @since 2.13
     1521    */
     1522    public abstract Order sortBy(Expression e);
     1523   
    15001524    public String toString()
    15011525    {
  • trunk/www/common/history/list_history.jsp

    r5048 r5061  
    8686    final ItemQuery<ChangeHistory> query =
    8787      Base.getConfiguredQuery(dc, cc, true, ChangeHistory.getHistoryOf(source), mode);
     88    query.order(cc.getSortDirection().sortBy(Hql.property("id")));
    8889    history = query.iterate(dc);
    8990    //cc.setMessage(query.toString());
Note: See TracChangeset for help on using the changeset viewer.