Package com.jdkcn.myblog.util

Examples of com.jdkcn.myblog.util.Sorter


    int start = 0;
    if (p != null && p > 1) {
      start = (p - 1) * size;
    }
    Range range = new Range(start, size);
    ps = entryService.search(condition, range, new Sorter().desc("createDate"));
    entries = ps.getItems();
  }
View Full Code Here


    String content = "Content";
    for (int i = 0; i < 30; i++) {
      createEntry(title + i, content + i);
    }
    EntryCondition condition = new EntryCondition();
    PaginationSupport<Entry> ps = entryService.search(condition, new Range(0, 10), new Sorter().asc("publishDate"));
    assertEquals(30, ps.getTotalCount());
   
    title = "Android";
    for (int j = 0; j < 5; j ++) {
      createEntry(title + j, content + j);
    }
   
    condition.setKeyword("Android");
    ps = entryService.search(condition, new Range(0, 5), new Sorter().asc("title"));
    assertEquals(5, ps.getTotalCount());
  }
View Full Code Here

public class SorterTest {

 
  @Test
  public void testSorter() throws Exception {
    Sorter sorter = new Sorter().desc("name").asc("property").desc("createDate");
    String hql = "from Entry entry";
    String orderedHql = "from Entry entry order by name desc,property asc,createDate desc";
    assertEquals(sorter.decorate(hql), orderedHql);
  }
View Full Code Here

    assertEquals(sorter.decorate(hql), orderedHql);
  }
 
  @Test
  public void testSorterWithExistOrderBy() throws Exception {
    Sorter sorter = new Sorter().desc("name").asc("property").desc("createDate");
    String hql = "from Entry entry order by entry.title desc";
    String orderedHql = "from Entry entry order by entry.title desc,name desc,property asc,createDate desc";
    assertEquals(sorter.decorate(hql), orderedHql);
  }
View Full Code Here

TOP

Related Classes of com.jdkcn.myblog.util.Sorter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.