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

The following examples show how to use de.greenrobot.dao.query.QueryBuilder#list() . 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: PushDbService.java    From anetty_client with Apache License 2.0 6 votes vote down vote up
/**
 * 从数据库中获取设备信息
 * 
 * @return
 */
public Map<String, Device> queryDevicesForMap() {
	QueryBuilder<Device> qb = this.deviceDao.queryBuilder();
	List<Device> list = qb.list();
	if (list != null && list.size() > 0) {
		Map<String, Device> map = new HashMap<String, Device>();
		for (Device device : list) {
			if (device != null) {
				// 设备从数据库中取出来默认为已经离线
				device.setIsOnline(ApplicationContextClient.DEVICE_OFFLINE);
				map.put(device.getAppPackage(), device);
			}
		}
		return map;
	}
	return null;
}
 
Example 2
Source File: CompletionDataSource.java    From BrainPhaser with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get all completion objects depending on the user and the stage
 * @param user the user
 * @param stage the stage
 * @return List of completion objects
 */
public List<Completion> findByUserAndStage(User user, int stage) {
    QueryBuilder<Completion> completed = mDaoSession.getCompletionDao().queryBuilder()
        .where(CompletionDao.Properties.UserId.eq(user.getId()),
            CompletionDao.Properties.Stage.eq(stage));
    return completed.list();
}
 
Example 3
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 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: 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: 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 7
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;
}