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


Java ParseQuery.whereGreaterThan方法代碼示例

本文整理匯總了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());
}
 
開發者ID:badoo,項目名稱:Chateau,代碼行數:38,代碼來源:ParseMessageDataSource.java

示例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();
                }
            }
        }
    });
}
 
開發者ID:getsadzeg,項目名稱:mtredi,代碼行數:33,代碼來源:Chat.java

示例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;
  }
 
開發者ID:E2010,項目名稱:android-parse-module-titanium-3-5,代碼行數:65,代碼來源:QueryFactory.java

示例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);
		}
	});

}
 
開發者ID:tamzi,項目名稱:sophia,代碼行數:60,代碼來源:Chat.java


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