当前位置: 首页>>代码示例>>Java>>正文


Java ParseQuery.whereGreaterThanOrEqualTo方法代码示例

本文整理汇总了Java中com.parse.ParseQuery.whereGreaterThanOrEqualTo方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.whereGreaterThanOrEqualTo方法的具体用法?Java ParseQuery.whereGreaterThanOrEqualTo怎么用?Java ParseQuery.whereGreaterThanOrEqualTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.parse.ParseQuery的用法示例。


在下文中一共展示了ParseQuery.whereGreaterThanOrEqualTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryParseForLast24Hours

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void queryParseForLast24Hours() {
    final int myUpdateNumber = ++mMostRecentMapUpdate;
    ParseQuery<Record> mapQuery = Record.getQuery();
    mapQuery.include("user");
    Date onDayAgo = getNowMinus24Hours();
    mapQuery.whereGreaterThanOrEqualTo("createdAt", onDayAgo);
    mapQuery.orderByDescending("createdAt");
    mapQuery.setLimit(100);
    // Kick off the query in the background
    mapQuery.findInBackground(new FindCallback<Record>() {
        @Override
        public void done(List<Record> records, ParseException e) {
            Log.e(TAG, "=== findInBackground === records = " + records);
            if (e != null) {
                Log.e(TAG, "=== findInBackground === records = " + records);
                return;
            }
            /*
             * Make sure we're processing results from
             * the most recent update, in case there
             * may be more than one in progress.
             */
            if (myUpdateNumber != mMostRecentMapUpdate) {
                return;
            }
            EventBus.getDefault()
                    .post(new LocationChangedEvent(records));
        }
    });
}
 
开发者ID:ralphpina,项目名称:ActivityMapper,代码行数:31,代码来源:Account.java

示例2: getSnacks

import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
 * Fetches the list of snack entries for a user using a specified mode. If the mode is not
 * recognized, the mode defaults to EXPORT_EVERYTHING.
 *
 * @param user Which user's entries to fetch.
 * @param mode The mode to use when fetching (EXPORT_LAST_24_HOURS, EXPORT_LAST_48_HOURS,
 *             EXPORT_EVERYTHING).
 * @param callback The callback to invoke upon completion.
 */
private static void getSnacks(ParseUser user, int mode, FindCallback<SnackEntry> callback){

    // Milliseconds in a day.
    final long millis24Hours = 1000 * 60 * 60 * 24;

    ParseQuery<SnackEntry> query = new ParseQuery<>(SnackEntry.class);
    query.whereEqualTo("owner", user);

    switch(mode){
        case EXPORT_LAST_24_HOURS:
            query.whereGreaterThanOrEqualTo("createdAt", new Date(System.currentTimeMillis() - millis24Hours));
            break;
        case EXPORT_LAST_48_HOURS:
            query.whereGreaterThanOrEqualTo("createdAt", new Date(System.currentTimeMillis() - millis24Hours * 2));
            break;

        // case EXPORT_EVERYTHING: no constraint on createdAt.

        // default: no constraint on createdAt (export everything)
    }
    query.findInBackground(callback);
}
 
开发者ID:SCCapstone,项目名称:diet,代码行数:32,代码来源:SnackExporter.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


注:本文中的com.parse.ParseQuery.whereGreaterThanOrEqualTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。