當前位置: 首頁>>代碼示例>>Java>>正文


Java QueryBuilder類代碼示例

本文整理匯總了Java中de.greenrobot.dao.query.QueryBuilder的典型用法代碼示例。如果您正苦於以下問題:Java QueryBuilder類的具體用法?Java QueryBuilder怎麽用?Java QueryBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


QueryBuilder類屬於de.greenrobot.dao.query包,在下文中一共展示了QueryBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSchoolmateFriendState

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
public Task<Integer> getSchoolmateFriendState(String uid){
    if (caches.get(uid) == null){
        return Task.callInBackground(() -> {
            QueryBuilder<Schoolmate> schoolmateQueryBuilder = DaoHelper.getInstance().getSchoolmateDao().queryBuilder();
            schoolmateQueryBuilder.where(schoolmateQueryBuilder.and(SchoolmateDao.Properties.UserId.eq(uid),
                    SchoolmateDao.Properties.ReleatedId.eq(HiTalkHelper.getInstance().getCurrentUserId())));
            Query<Schoolmate> build = schoolmateQueryBuilder.build();
            int friendState = REQUEST_STATE_FAILED;
            try{
                friendState = build.unique().getFriendState();
            }catch (Exception e){
                NLog.e(TagUtil.makeTag(getClass()),"getSchoolmateFriendState failed ",e);
            }
            caches.put(uid,friendState);
            return friendState;
        });
    }else {
        return Task.forResult(caches.get(uid));
    }
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:21,代碼來源:SchoolmatesCacheHelper.java

示例2: getMessagesForThreadForEntityID

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * Get all messages for given thread id ordered Ascending/Descending
 */
public List<BMessage> getMessagesForThreadForEntityID(Long id, int limit) {
    List<BMessage> list ;

    QueryBuilder<BMessage> qb = DaoCore.daoSession.queryBuilder(BMessage.class);
    qb.where(BMessageDao.Properties.ThreadDaoId.eq(id));

    // Making sure no null messages infected the sort.
    qb.where(BMessageDao.Properties.Date.isNotNull());
    qb.where(BMessageDao.Properties.Sender.isNotNull());

    qb.orderDesc(BMessageDao.Properties.Date);

    if (limit != -1)
        qb.limit(limit);

    list = qb.list();

    return list;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:23,代碼來源:ChatSDKChatHelper.java

示例3: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
@Override
public ArrayList<FreshNews> getCacheByPage(int page) {

    QueryBuilder<com.do79.greendao.FreshNewsCache> query = mFreshNewsCacheDao.queryBuilder().where(FreshNewsCacheDao
            .Properties.Page.eq("" + page));

    if (query.list().size() > 0) {
        try {
            return FreshNews.parseCache(new JSONArray(query.list().get(0)
                    .getResult()));
        } catch (JSONException e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    } else {
        return new ArrayList<>();
    }

}
 
開發者ID:niuzehai,項目名稱:Sxumiro_AndroidClient,代碼行數:20,代碼來源:FreshNewsCache.java

示例4: getGBActivitySamples

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
protected List<T> getGBActivitySamples(int timestamp_from, int timestamp_to, int activityType) {
    if (getRawKindSampleProperty() == null && activityType != ActivityKind.TYPE_ALL) {
        // if we do not have a raw kind property we cannot query anything else then TYPE_ALL
        return Collections.emptyList();
    }
    QueryBuilder<T> qb = getSampleDao().queryBuilder();
    Property timestampProperty = getTimestampSampleProperty();
    Device dbDevice = DBHelper.findDevice(getmDevice(), getSession());
    if (dbDevice == null) {
        // no device, no samples
        return Collections.emptyList();
    }
    Property deviceProperty = getDeviceIdentifierSampleProperty();
    qb.where(deviceProperty.eq(dbDevice.getId()), timestampProperty.ge(timestamp_from))
        .where(timestampProperty.le(timestamp_to), getClauseForActivityType(qb, activityType));
    List<T> samples = qb.build().list();
    for (T sample : samples) {
        sample.setProvider(this);
    }
    return samples;
}
 
開發者ID:scifiswapnil,項目名稱:gadgetbridge_artikcloud,代碼行數:22,代碼來源:AbstractSampleProvider.java

示例5: getActivityTypeConditions

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
private WhereCondition getActivityTypeConditions(QueryBuilder qb, int[] dbActivityTypes) {
    // What a crappy QueryBuilder API ;-( QueryBuilder.or(WhereCondition[]) with a runtime array length
    // check would have worked just fine.
    if (dbActivityTypes.length == 0) {
        return null;
    }
    Property rawKindProperty = getRawKindSampleProperty();
    if (dbActivityTypes.length == 1) {
        return rawKindProperty.eq(dbActivityTypes[0]);
    }
    if (dbActivityTypes.length == 2) {
        return qb.or(rawKindProperty.eq(dbActivityTypes[0]),
                rawKindProperty.eq(dbActivityTypes[1]));
    }
    final int offset = 2;
    int len = dbActivityTypes.length - offset;
    WhereCondition[] trailingConditions = new WhereCondition[len];
    for (int i = 0; i < len; i++) {
        trailingConditions[i] = rawKindProperty.eq(dbActivityTypes[i + offset]);
    }
    return qb.or(rawKindProperty.eq(dbActivityTypes[0]),
            rawKindProperty.eq(dbActivityTypes[1]),
            trailingConditions);
}
 
開發者ID:scifiswapnil,項目名稱:gadgetbridge_artikcloud,代碼行數:25,代碼來源:AbstractSampleProvider.java

示例6: queryUnFinished

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * @description: 查詢未完成的軌跡
 * @author: chenshiqiang E-mail:[email protected]
 * @return
 */
public Track queryUnFinished(){
	QueryBuilder<Track> qb = dao.queryBuilder();
	qb.where(Properties.RecordStatus.notEq(RecordStatus.finished.getValue()));
	qb.orderDesc(Properties.BeginTime);
	List<Track> ls = qb.list();
	if(ls != null && !ls.isEmpty()){
		if(ls.size() == 1){
			return ls.get(0);
		}else{
			Track uf = ls.remove(0);
			//停止最近以前的所有軌跡
			List<Long> cs = new ArrayList<Long>();
			for(Track t : ls){
				cs.add(t.getId());
			}
			stopTracks(cs);
			
			return uf;
		}
	}
	return null;
}
 
開發者ID:jp1017,項目名稱:TheSceneryAlong,代碼行數:28,代碼來源:TrackDb.java

示例7: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * 根據頁碼獲取緩存數據
 *
 * @param page
 * @return
 */
@Override
public ArrayList<BackNews> getCacheByPage(int page) {

    QueryBuilder<JavaCache> query = mJavaCacheDao.queryBuilder().where(JavaCacheDao
            .Properties.Page.eq("" + page));

    if (query.list().size() > 0) {
        return (ArrayList<BackNews>) JSONParser.toObject(query.list().get(0).getResult(),
                new TypeToken<ArrayList<BackNews>>() {
                }.getType());
    } else {
        return new ArrayList<BackNews>();
    }

}
 
開發者ID:pomelo4,項目名稱:DevNews,代碼行數:22,代碼來源:JavaCacheUtil.java

示例8: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * 根據頁碼獲取緩存數據
 *
 * @param page
 * @return
 */
@Override
public ArrayList<Picture> getCacheByPage(int page) {

	QueryBuilder<PictureCache> query = mPictureCacheDao.queryBuilder().where(PictureCacheDao
			.Properties.Page.eq("" + page));

	if (query.list().size() > 0) {
		return (ArrayList<Picture>) JSONParser.toObject(query.list().get(0).getResult(),
				new TypeToken<ArrayList<Picture>>() {
				}.getType());
	} else {
		return new ArrayList<Picture>();
	}

}
 
開發者ID:pomelo4,項目名稱:DevNews,代碼行數:22,代碼來源:PictureCacheUtil.java

示例9: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * 根據頁碼獲取緩存數據
 *
 * @param page
 * @return
 */
@Override
public ArrayList<BackNews> getCacheByPage(int page) {

    QueryBuilder<PythonCache> query = mPythonCacheDao.queryBuilder().where(JavaCacheDao
            .Properties.Page.eq("" + page));

    if (query.list().size() > 0) {
        return (ArrayList<BackNews>) JSONParser.toObject(query.list().get(0).getResult(),
                new TypeToken<ArrayList<BackNews>>() {
                }.getType());
    } else {
        return new ArrayList<BackNews>();
    }

}
 
開發者ID:pomelo4,項目名稱:DevNews,代碼行數:22,代碼來源:PythonCacheUtil.java

示例10: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * 根據頁碼獲取緩存數據
 * @param page
 * @return
 */
@Override
public ArrayList getCacheByPage(int page) {
    QueryBuilder<AndroidCache> query = mAndroidCacheDao.queryBuilder().where(AndroidCacheDao
            .Properties.Page.eq("" + page));

    if (query.list().size() > 0) {
        try {
            return MobileNews.parseCache(new JSONArray(query.list().get(0)
                    .getResult()));
        } catch (JSONException e) {
            e.printStackTrace();
            return new ArrayList<MobileNews>();
        }
    } else {
        return new ArrayList<MobileNews>();
    }
}
 
開發者ID:pomelo4,項目名稱:DevNews,代碼行數:23,代碼來源:AndroidCacheUtil.java

示例11: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * 根據頁碼獲取緩存數據
 *
 * @param page
 * @return
 */
@Override
public ArrayList<MobileNews> getCacheByPage(int page) {

    QueryBuilder<iOSCache> query = mIOSCacheDao.queryBuilder().where(iOSCacheDao
            .Properties.Page.eq("" + page));

    if (query.list().size() > 0) {
        return (ArrayList<MobileNews>) JSONParser.toObject(query.list().get(0).getResult(),
                new TypeToken<ArrayList<MobileNews>>() {
                }.getType());
    } else {
        return new ArrayList<MobileNews>();
    }

}
 
開發者ID:pomelo4,項目名稱:DevNews,代碼行數:22,代碼來源:iOSCacheUtil.java

示例12: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
@Override
public ArrayList<FreshNews> getCacheByPage(int page) {

    QueryBuilder<com.socks.greendao.FreshNewsCache> query = mFreshNewsCacheDao.queryBuilder().where(FreshNewsCacheDao
            .Properties.Page.eq("" + page));

    if (query.list().size() > 0) {
        try {
            return FreshNews.parseCache(new JSONArray(query.list().get(0)
                    .getResult()));
        } catch (JSONException e) {
            e.printStackTrace();
            return new ArrayList<>();
        }
    } else {
        return new ArrayList<>();
    }

}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:20,代碼來源:FreshNewsCache.java

示例13: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * 根據頁碼獲取緩存數據
 *
 * @param page
 * @return
 */
@Override
public ArrayList<Picture> getCacheByPage(int page) {

	QueryBuilder<com.socks.greendao.PictureCache> query = mPictureCacheDao.queryBuilder().where(PictureCacheDao
			.Properties.Page.eq("" + page));

	if (query.list().size() > 0) {
		return (ArrayList<Picture>) JSONParser.toObject(query.list().get(0).getResult(),
				new TypeToken<ArrayList<Picture>>() {
				}.getType());
	} else {
		return new ArrayList<Picture>();
	}

}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:22,代碼來源:PictureCache.java

示例14: getCacheByPage

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
/**
 * 根據頁碼獲取緩存數據
 *
 * @param page
 * @return
 */
@Override
public ArrayList<Picture> getCacheByPage(int page) {

	QueryBuilder<com.socks.greendao.PictureCache> query = mPictureCacheDao.queryBuilder().where(PictureCacheDao
			.Properties.Page.eq("" + page));

	if (query.list().size() > 0) {
		return (ArrayList<Picture>) JSONParser.toObject(query.list().get(0).getResult(),
				new TypeToken<ArrayList<Picture>>() {
				}.getType());
	} else {
		return new ArrayList<>();
	}

}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDanRxJava,代碼行數:22,代碼來源:PictureCache.java

示例15: delMsg4

import de.greenrobot.dao.query.QueryBuilder; //導入依賴的package包/類
public void delMsg4(WhereCondition wherecondition, WhereCondition wherecondition1, WhereCondition wherecondition2, WhereCondition wherecondition3)
{
    QueryBuilder querybuilder = DaoManager.getInstance().getLuaListDao().queryBuilder();
    querybuilder.where(wherecondition, new WhereCondition[0]);
    if (wherecondition1 != null)
    {
        querybuilder.where(wherecondition1, new WhereCondition[0]);
    }
    if (wherecondition2 != null)
    {
        querybuilder.where(wherecondition2, new WhereCondition[0]);
    }
    if (wherecondition3 != null)
    {
        querybuilder.where(wherecondition3, new WhereCondition[0]);
    }
    querybuilder.buildDelete().executeDeleteWithoutDetachingEntities();
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:19,代碼來源:LuaAction.java


注:本文中的de.greenrobot.dao.query.QueryBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。