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

The following examples show how to use de.greenrobot.dao.query.QueryBuilder#orderDesc() . 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: LuaManager.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private String getDBLuaFileByVersion(String s)
{
    LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
    int j = (int)luazipfiledao.count();
    Debug.i("chenee", (new StringBuilder()).append("lzipDao.count:").append(j).toString());
    if (j > 0)
    {
        QueryBuilder querybuilder = luazipfiledao.queryBuilder();
        Property aproperty[] = new Property[1];
        aproperty[0] = de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version;
        querybuilder.orderDesc(aproperty);
        querybuilder.where(de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version.eq(s), new WhereCondition[0]);
        LuaZipFile luazipfile = (LuaZipFile)querybuilder.listLazy().get(0);
        String s1 = luazipfile.getVersion();
        Debug.i("chenee", (new StringBuilder()).append("luaZipFile.version:").append(s1).toString());
        return unzip(luazipfile.getZipFile());
    } else
    {
        Debug.e("chenee", (new StringBuilder()).append("read DB zip failed,version:").append(s).toString());
        return null;
    }
}
 
Example 2
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 3
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 4
Source File: LuaAction.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public LuaList queryLastItem(QueryBuilder querybuilder)
{
    Property aproperty[] = new Property[1];
    aproperty[0] = de.greenrobot.daobracelet.LuaListDao.Properties.Id;
    querybuilder.orderDesc(aproperty);
    List list = querybuilder.list();
    if (list.size() > 0)
    {
        return (LuaList)list.get(0);
    } else
    {
        return null;
    }
}
 
Example 5
Source File: LuaManager.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private String getLatestDBLuaFile()
{
    LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
    int j = (int)luazipfiledao.count();
    Debug.i("chenee", (new StringBuilder()).append("lzipDao.count:").append(j).toString());
    if (j > 0)
    {
        QueryBuilder querybuilder = luazipfiledao.queryBuilder();
        Property aproperty[] = new Property[1];
        aproperty[0] = de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version;
        querybuilder.orderDesc(aproperty);
        LuaZipFile luazipfile = (LuaZipFile)querybuilder.listLazy().get(0);
        String s = luazipfile.getVersion();
        String s1 = getDefaultLuaFileVersion();
        if (s.compareTo(s1) <= 0)
        {
            Debug.e("chenee", (new StringBuilder()).append("version compare failed: version:").append(s).append(" default version is:").append(s1).toString());
            return null;
        } else
        {
            Debug.i("chenee", (new StringBuilder()).append("use latest script, version:").append(s).append(" (default version is:").append(s1).append(")").toString());
            return unzip(luazipfile.getZipFile());
        }
    } else
    {
        Debug.e("chenee", "read DB zip file failed");
        return null;
    }
}
 
Example 6
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 7
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 8
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;
}