Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Query


  @Override
  public List<PageEntity> getCurrentHourPublishedPages() {
    Date endDate = new Date();
    Date startDate = DateUtils.addHours(endDate, -1);
    Query q = newQuery();
    q.addFilter("publishDate", FilterOperator.GREATER_THAN_OR_EQUAL,
        startDate);
    q.addFilter("publishDate", FilterOperator.LESS_THAN_OR_EQUAL,
        endDate);
    return select(q, "getCurrentHourPublishedPages",
        params(startDate, endDate));
  }
View Full Code Here


 
  @Override
  public List<PageEntity> getCurrentHourUnpublishedPages() {
    Date endDate = new Date();
    Date startDate = DateUtils.addHours(endDate, -1);
    Query q = newQuery();
    q.addFilter("endPublishDate", FilterOperator.GREATER_THAN_OR_EQUAL,
        startDate);
    q.addFilter("endPublishDate", FilterOperator.LESS_THAN_OR_EQUAL,
        endDate);
    return select(q, "getCurrentHourUnpublishedPages",
        params(startDate, endDate));
  }
View Full Code Here

    super(PluginResourceEntity.class);
  }

  @Override
  public PluginResourceEntity getByUrl(String plugin, String url) {
    Query q = newQuery();
    q.addFilter("url", FilterOperator.EQUAL, url);
    q.addFilter("pluginName", FilterOperator.EQUAL, plugin);
    return selectOne(q, "getByUrl", params(url));
  }
View Full Code Here

  private static final String ATTRIBUTES = "attributes";
  private static final String ATTRIBUTES_JSON = "attributesJSON";
 
  private void updateConfig() {
    Query query = new Query("ConfigEntity");
    for (Entity e : getBusiness().getSystemService().getDatastore()
        .prepare(query).asIterable()) {
      Map<String, String> map = EntityUtil.getMapProperty(e, ATTRIBUTES);
      String attributes = convertAttributes(map);
      e.removeProperty(ATTRIBUTES);
View Full Code Here

    business.getSystemService().getCache().clear();
    return result.toString();
  }
 
  private Entity getConfig() {
    Query query = new Query("ConfigEntity");
    return datastore.prepare(query).asIterator().next();
  }
View Full Code Here

    super(UserGroupEntity.class);
  }

  @Override
  public List<UserGroupEntity> selectByUser(Long userId) {
    Query q = newQuery();
    q.addFilter("userId", EQUAL, userId);
    return select(q, "selectByUser", params(userId));
  }
View Full Code Here

    return select(q, "selectByUser", params(userId));
  }

  @Override
  public List<UserGroupEntity> selectByGroup(Long groupId) {
    Query q = newQuery();
    q.addFilter("groupId", EQUAL, groupId);
    return select(q, "selectByGroup", params(groupId));
  }
View Full Code Here

    return select(q, "selectByGroup", params(groupId));
  }

  @Override
  public UserGroupEntity getByUserGroup(Long groupId, Long userId) {
    Query q = newQuery();
    q.addFilter("userId", EQUAL, userId);
    q.addFilter("groupId", EQUAL, groupId);
    return selectOne(q, "getByUserGroup", params(groupId, userId));
  }
View Full Code Here

        long expire = new Date().getTime();
        try {
            DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
            // Vaadin stuff first
            {
                Query q = new Query(AC_BASE);
                q.setKeysOnly();

                q.addFilter(PROPERTY_EXPIRES,
                        FilterOperator.LESS_THAN_OR_EQUAL, expire);
                PreparedQuery pq = ds.prepare(q);
                List<Entity> entities = pq.asList(Builder
                        .withLimit(CLEANUP_LIMIT));
                if (entities != null) {
                    getLogger()
                            .log(Level.INFO,
                                    "Vaadin cleanup deleting {0} expired Vaadin sessions.",
                                    entities.size());
                    List<Key> keys = new ArrayList<Key>();
                    for (Entity e : entities) {
                        keys.add(e.getKey());
                    }
                    ds.delete(keys);
                }
            }
            // Also cleanup GAE sessions
            {
                Query q = new Query(APPENGINE_SESSION_KIND);
                q.setKeysOnly();
                q.addFilter(PROPERTY_APPENGINE_EXPIRES,
                        FilterOperator.LESS_THAN_OR_EQUAL, expire);
                PreparedQuery pq = ds.prepare(q);
                List<Entity> entities = pq.asList(Builder
                        .withLimit(CLEANUP_LIMIT));
                if (entities != null) {
View Full Code Here

    }
    return siol;
  }

  public List<SectionInformationObject> getSectionList(CourseInformationObject cio) {
    Query q = new Query(SECTION_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL, cio.getDepartmentId());
    q.addFilter(COURSE_ID_PROPERTY, FilterOperator.EQUAL, cio.getCourseId());
    q.addSort(DEPARTMENT_ID_PROPERTY, SortDirection.ASCENDING);
    q.addSort(COURSE_ID_PROPERTY, SortDirection.ASCENDING);
    q.addSort(SECTION_ID_PROPERTY, SortDirection.ASCENDING);   
    List<Entity> sel = datastore.prepare(q).asList(FetchOptions.Builder.withDefaults());
    List<SectionInformationObject> siol = new ArrayList<SectionInformationObject>();
    for (Iterator i = sel.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
        SectionInformationObject sio = getSectionFromEntity(e);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.