Java Code Examples for de.greenrobot.dao.query.QueryBuilder#orderAsc()

The following examples show how to use de.greenrobot.dao.query.QueryBuilder#orderAsc() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DB.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
public static List<DisplayForum> getACForums(boolean onlyVisible, boolean autoSorting) {
    ACForumDao dao = sDaoSession.getACForumDao();
    QueryBuilder<ACForumRaw> query = dao.queryBuilder();
    if (autoSorting) {
        query = query.orderDesc(ACForumDao.Properties.Frequency);
    }
    query = query.orderAsc(ACForumDao.Properties.Priority);
    List<ACForumRaw> list = query.list();
    List<DisplayForum> result = new ArrayList<>();
    for (ACForumRaw raw : list) {
        if (onlyVisible && !raw.getVisibility()) {
            continue;
        }

        DisplayForum dForum = new DisplayForum();
        dForum.site = ACSite.getInstance();
        dForum.id = raw.getForumid();
        dForum.displayname = raw.getDisplayname();
        dForum.priority = raw.getPriority();
        dForum.visibility = raw.getVisibility();
        dForum.msg = raw.getMsg();
        dForum.official = raw.getOfficial();
        result.add(dForum);
    }

    return result;
}
 
Example 2
Source File: DB.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
public static LazyList<ACForumRaw> getACForumLazyList(boolean autoSorting) {
    QueryBuilder<ACForumRaw> query = sDaoSession.getACForumDao().queryBuilder();
    if (autoSorting) {
        query = query.orderDesc(ACForumDao.Properties.Frequency);
    }
    query = query.orderAsc(ACForumDao.Properties.Priority);
    return query.listLazy();
}
 
Example 3
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param isAsc
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example 4
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example 5
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param isAsc
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example 6
Source File: CheckingFragment.java    From android-sholi with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected LazyList<Item> createList(Context context) {
    QueryBuilder builder = getSession().getItemDao().queryBuilder();
    builder.where(builder.or(ItemDao.Properties.Status.eq(Checkable.CHECKED),
            ItemDao.Properties.Status.eq(Checkable.UNCHECKED)));
    builder.orderAsc(ItemDao.Properties.Name);
    return builder.listLazy();
}