本文整理汇总了Java中com.parse.ParseQuery.whereGreaterThan方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.whereGreaterThan方法的具体用法?Java ParseQuery.whereGreaterThan怎么用?Java ParseQuery.whereGreaterThan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.whereGreaterThan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadInternal
import com.parse.ParseQuery; //导入方法依赖的package包/类
private Observable<LoadResult<ExampleMessage>> loadInternal(@NonNull String conversationId, @NonNull LoadQuery.Type type, long timestamp) {
final ParseQuery<ParseObject> parseQuery = new ParseQuery<>(MessagesTable.NAME);
parseQuery.whereEqualTo(MessagesTable.Fields.CHAT, ParseObject.createWithoutData(ChatTable.NAME, conversationId));
parseQuery.addDescendingOrder(MessagesTable.Fields.CREATED_AT);
if (type == Type.OLDER) {
parseQuery.whereLessThan(MessagesTable.Fields.CREATED_AT, new Date(timestamp));
}
else if (type == Type.NEWER) {
parseQuery.whereGreaterThan(MessagesTable.Fields.CREATED_AT, new Date(timestamp));
}
parseQuery.setLimit(MAX_CHUNK_SIZE);
parseQuery.include(MessagesTable.Fields.IMAGE);
return mParseHelper.find(parseQuery)
.doOnNext(mSortMessagesAscending)
.flatMap(Observable::from)
.map(in -> ParseUtils.from(in, mParseHelper))
.toList()
.map(messages -> {
final boolean canLoadOlder;
final boolean canLoadNewer;
if (type == Type.OLDER) {
canLoadOlder = !messages.isEmpty();
canLoadNewer = true; // This will be ignored in any case since we are loading older messages
}
else if (type == Type.NEWER) {
canLoadOlder = true; // This will be ignored in any case since we are loading newer messages
canLoadNewer = !messages.isEmpty();
}
else {
canLoadOlder = !messages.isEmpty();
canLoadNewer = !messages.isEmpty();
}
return new LoadResult<>(messages, canLoadOlder, canLoadNewer);
})
.subscribeOn(Schedulers.io());
}
示例2: loadConversation
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void loadConversation() {
ParseQuery<ParseObject> chatquery = new ParseQuery<ParseObject>("Chat");
if (convList.size() == 0) {
ArrayList<String> chatl = new ArrayList<>();
chatquery.whereContainedIn("sender", chatl);
chatquery.whereContainedIn("receiver", chatl);
} else {
if (lastmsgDate != null) {
chatquery.whereGreaterThan("createdAt", lastmsgDate);
chatquery.whereEqualTo("sender", UserList.user.getUsername());
chatquery.whereEqualTo("receiver", UserList.nameFromList);
}
}
chatquery.orderByDescending("createdAt");
chatquery.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> objects, ParseException e) {
if (objects != null && objects.size() > 0) {
for (int i = objects.size() - 1; i >= 0; i--) {
ParseObject pobject = objects.get(i);
Conversation c = new Conversation(pobject.get("message").toString(),
pobject.get("sender").toString(), pobject.getCreatedAt());
convList.add(c);
if (lastmsgDate == null || lastmsgDate.before(c.getDate())) {
lastmsgDate = c.getDate();
}
adapter.notifyDataSetChanged();
}
}
}
});
}
示例3: Build
import com.parse.ParseQuery; //导入方法依赖的package包/类
public static ParseQuery Build(String className, HashMap[] conditions) {
ParseQuery<ParseObject> query = new ParseQuery(className);
// Create a composite query via chaining
for (int i = 0; i < conditions.length; ++i) {
HashMap map = conditions[i];
// These fields must be named exactly the same in the calling application
String key = (String)map.get("key");
String condition = (String)map.get("condition");
Object value = map.get("value");
if (HasValidConditions(map)) {
// This sucks, but I don't really want to try to be clever and use
// reflection to map conditions to method names. It's not by any means
// a complete implementation, as it only contains condition matching
// for basic operations.
if (condition.equals("==")) {
query = query.whereEqualTo(key, value);
}
else if (condition.equals("!=")) {
query = query.whereNotEqualTo(key, value);
}
else if (condition.equals(">")) {
query = query.whereGreaterThan(key, value);
}
else if (condition.equals("<")) {
query = query.whereLessThan(key, value);
}
else if (condition.equals(">=")) {
query = query.whereGreaterThanOrEqualTo(key, value);
}
else if (condition.equals("<=")) {
query = query.whereLessThanOrEqualTo(key, value);
}
else if (condition.equals("exists")) {
query = query.whereExists(key);
}
else if (condition.equals("notexists")) {
query = query.whereDoesNotExist(key);
}
else if (condition.equals("orderby")) {
if (value.equals("asc")) {
query = query.orderByAscending(key);
}
else if (value.equals("desc")) {
query = query.orderByDescending(key);
}
else {
Log.e(TAG, "Unrecognized sorting order, use 'asc' or 'desc'.");
}
}
else {
Log.e(TAG, "The condition '"+ condition + "' was not recognized by " +
"the module. Create a request for implementation on GitHub, or " +
"implemented it and create a pull request.");
}
}
}
return query;
}
示例4: loadConversationList
import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
* Load the conversation list from Parse server and save the date of last
* message that will be used to load only recent new messages
*/
private void loadConversationList()
{
ParseQuery<ParseObject> q = ParseQuery.getQuery("Chat");
if (convList.size() == 0)
{
// load all messages...
ArrayList<String> al = new ArrayList<String>();
al.add(buddy);
al.add(UserList.user.getUsername());
q.whereContainedIn("sender", al);
q.whereContainedIn("receiver", al);
}
else
{
// load only newly received message..
if (lastMsgDate != null)
q.whereGreaterThan("createdAt", lastMsgDate);
q.whereEqualTo("sender", buddy);
q.whereEqualTo("receiver", UserList.user.getUsername());
}
q.orderByDescending("createdAt");
q.setLimit(30);
q.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> li, ParseException e)
{
if (li != null && li.size() > 0)
{
for (int i = li.size() - 1; i >= 0; i--)
{
ParseObject po = li.get(i);
Conversation c = new Conversation(po
.getString("message"), po.getCreatedAt(), po
.getString("sender"));
convList.add(c);
if (lastMsgDate == null
|| lastMsgDate.before(c.getDate()))
lastMsgDate = c.getDate();
adp.notifyDataSetChanged();
}
}
handler.postDelayed(new Runnable() {
@Override
public void run()
{
if (isRunning)
loadConversationList();
}
}, 1000);
}
});
}