本文整理汇总了Java中com.avos.avoscloud.AVUser.getQuery方法的典型用法代码示例。如果您正苦于以下问题:Java AVUser.getQuery方法的具体用法?Java AVUser.getQuery怎么用?Java AVUser.getQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVUser
的用法示例。
在下文中一共展示了AVUser.getQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCurrentAVuser
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void initCurrentAVuser(final ActionCallback callback){
if (mCurrentUser == null) {
AVQuery<AVUser> query = AVUser.getQuery();
query.whereEqualTo("objectId",AVUser.getCurrentUser().getObjectId());
query.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
query.getFirstInBackground(new GetCallback<AVUser>() {
@Override
public void done(AVUser avUser, AVException e) {
if (avUser != null){
mCurrentUser = avUser;
callback.onSuccess();
}else {
mCurrentUser = AVUser.getCurrentUser();
callback.onError(0,e.getMessage());
}
}
});
}
}
示例2: fetchUsers
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public void fetchUsers(final List<String> ids, final CacheUserCallback cacheUserCallback) {
Set<String> uncachedIds = new HashSet<String>();
for (String id : ids) {
if (!mAvUsersCache.containsKey(id)) {
uncachedIds.add(id);
}
}
if (uncachedIds.isEmpty()) {
if (null != cacheUserCallback) {
cacheUserCallback.done(getUsersFromCache(ids), null);
return;
}
}
AVQuery<AVUser> q = AVUser.getQuery();
q.whereContainedIn(OBJECT_ID, uncachedIds);
q.setLimit(1000);
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(new FindCallback<AVUser>() {
@Override
public void done(List<AVUser> list, AVException e) {
if (null == e) {
for (AVUser user : list) {
mAvUsersCache.put(user.getObjectId(), user);
}
}
if (null != cacheUserCallback) {
cacheUserCallback.done(getUsersFromCache(ids), e);
}
}
});
}
示例3: queryCurrentUser
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
/**
* you can get a user carried with full info.
* @return
*/
public AVUser queryCurrentUser(){
AVQuery<AVUser> query = AVUser.getQuery();
query.whereEqualTo("objectId",AVUser.getCurrentUser().getObjectId());
query.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
try {
return query.getFirst();
} catch (AVException e) {
NLog.e(TagUtil.makeTag(HiTalkHelper.class),e);
}
return getCurrentUser();
}
示例4: findUsers
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static List<AVUser> findUsers(List<String> userIds) throws AVException {
if (userIds.size() <= 0) {
return Collections.EMPTY_LIST;
}
AVQuery<AVUser> q = AVUser.getQuery();
q.whereContainedIn("objectId", userIds);
q.setLimit(1000);
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
return q.find();
}
示例5: searchUser
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public void searchUser(String searchName, int skip,
FindCallback<AVUser> findCallback) {
AVQuery<AVUser> q = AVUser.getQuery(AVUser.class);
q.whereContains("username", searchName);
q.limit(10);
q.skip(skip);
AVUser user = AVUser.getCurrentUser();
List<String> friendIds = getFriendIds();
friendIds.add(user.getObjectId());
q.whereNotContainedIn("objectId", friendIds);
q.orderByDescending("updateAt");
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(findCallback);
}