• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java QueryResultIterable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.appengine.api.datastore.QueryResultIterable的典型用法代码示例。如果您正苦于以下问题:Java QueryResultIterable类的具体用法?Java QueryResultIterable怎么用?Java QueryResultIterable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QueryResultIterable类属于com.google.appengine.api.datastore包,在下文中一共展示了QueryResultIterable类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validateRequest

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
private void validateRequest(Long timehash, String cert) throws ForbiddenException {
    if (timehash != null && cert != null) {
        try {
            QueryResultIterable<PrivateInfo> allPrivate = ObjectifyService.ofy().load().type(PrivateInfo.class).iterable();
            for (PrivateInfo info : allPrivate) {
                String key = doSHA1(String.format("%s;%s;%d", info.getFingerprint().toLowerCase(), info.getPackageName().toLowerCase(), timehash));
                if (cert.equalsIgnoreCase(key)) {
                    return;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    throw new ForbiddenException("Cannot access by: " + cert + " at: " + timehash);
}
 
开发者ID:kimkha,项目名称:triethocduongpho,代码行数:18,代码来源:Article2Endpoint.java


示例2: deletePackage

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
/**
 * Deletes a package
 *
 * @param ofy Objectify
 * @param name package name
 */
public static void deletePackage(Objectify ofy, String name) {
    Package p = ofy.get(new Key<Package>(Package.class, name));
    ofy.delete(p);
    QueryResultIterable<Key<PackageVersion>> k =
            ofy.query(PackageVersion.class).filter("package_ =", name)
            .fetchKeys();
    ofy.delete(k);
    NWUtils.decrementPackageNumber();
    Index index = NWUtils.getIndex();
    index.delete(p.name);
    NWUtils.incDataVersion();
}
 
开发者ID:tim-lebedkov,项目名称:npackd-gae-web,代码行数:19,代码来源:NWUtils.java


示例3: deleteAllContinuously

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
/**
 * Deletes all device subscription entities continuously using task push queue.
 *
 * @param time Threshold time before which entities created will be deleted. If time is null,
 *             current time is used and set as Threshold time.
 * @param cursor Query cursor indicates last query result set position
 */
protected void deleteAllContinuously(Date time, String cursor) {
  if (time == null) {
    time = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime();
  }

  Query.FilterPredicate timeFilter = new Query.FilterPredicate(PROPERTY_TIMESTAMP,
      FilterOperator.LESS_THAN_OR_EQUAL, time);
  QueryResultIterable<Entity> entities;
  List<Key> keys = new ArrayList<Key> ();
  List<String> subIds = new ArrayList<String> ();
  Query queryAll;

  queryAll = new Query(DeviceSubscription.SUBSCRIPTION_KIND).setFilter(timeFilter);
  FetchOptions options = FetchOptions.Builder.withLimit(BATCH_DELETE_SIZE);
  if (!StringUtility.isNullOrEmpty(cursor)) {
    options.startCursor(Cursor.fromWebSafeString(cursor));
  }

  entities = this.datastoreService.prepare(queryAll).asQueryResultIterable(options);
  if (entities != null && entities.iterator() != null) {
    for (Entity entity : entities) {
      keys.add(entity.getKey());
      String[] ids = new Gson().fromJson((String) entity.getProperty(PROPERTY_SUBSCRIPTION_IDS),
          String[].class);
      subIds.addAll(Arrays.asList(ids));
    }
  }

  if (keys.size() > 0) {
    deleteInBatch(keys);
    enqueueDeleteDeviceSubscription(time, entities.iterator().getCursor().toWebSafeString());
  }
  if (subIds.size() > 0) {
    deletePsiSubscriptions(subIds);
  }
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:44,代码来源:DeviceSubscription.java


示例4: testAsQueryResultIterable

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
@Test
public void testAsQueryResultIterable() throws Exception {
    QueryResultIterable<Entity> iterable = preparedQuery.asQueryResultIterable();
    assertNotNull(iterable);
    assertNotNull(iterable.iterator());
    assertTrue(iterable.iterator().hasNext());
    assertEquals(john, iterable.iterator().next());
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:9,代码来源:PreparedQueryTest.java


示例5: testAsQueryResultIterableWithOptions

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
@Test
public void testAsQueryResultIterableWithOptions() throws Exception {
    QueryResultIterable<Entity> iterable = preparedQuery.asQueryResultIterable(withDefaults());
    assertNotNull(iterable);
    assertNotNull(iterable.iterator());
    assertTrue(iterable.iterator().hasNext());
    assertEquals(john, iterable.iterator().next());
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:9,代码来源:PreparedQueryTest.java


示例6: iterator

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
@Override
public final Iterator<? extends Person> iterator(long start, long end) {
    // TODO: use start + end
    QueryResultIterable<Person> personIterable = getLoadType().iterable();
    QueryResultIterator<Person> personIt = personIterable.iterator();
    return personIt;
}
 
开发者ID:tkruse,项目名称:wickapp2,代码行数:8,代码来源:PersonProvider.java


示例7: executeQueryForIterable

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
private QueryResultIterable<Entity> executeQueryForIterable(FetchOptions fetchOptions) {
    Query query = new Query("Foo").addSort("bar");
    return service.prepare(query).asQueryResultIterable(fetchOptions);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:5,代码来源:QueryFetchOptionsTest.java


示例8: getExportableRecords

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
public static QueryResultIterable<RideRecord> getExportableRecords() {
    return OfyService.ofy().query(RideRecord.class)
            .filter("isExportable", true)
            .fetch();
}
 
开发者ID:openmash,项目名称:mashmesh,代码行数:6,代码来源:RideRecord.java


示例9: listAll

import com.google.appengine.api.datastore.QueryResultIterable; //导入依赖的package包/类
public static QueryResultIterable<UserProfile> listAll() {
    return OfyService.ofy().query(UserProfile.class).fetch();
}
 
开发者ID:openmash,项目名称:mashmesh,代码行数:4,代码来源:UserProfile.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Node类代码示例发布时间:2022-05-23
下一篇:
Java SAX2DOM类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap