Examples of GqlQuery


Examples of com.googlecode.gql4j.GqlQuery

  public List<EntityInfo> loadEntities(String kind, String filter, int start, int length
      ) throws YaacException {
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
   
    Query q = isNullOrEmpty(filter) ?
      new Query(kind) : new GqlQuery("select * from " + kind + " " + filter).query();
   
    FetchOptions options = FetchOptions.Builder.withLimit(length).offset(start);
   
    try {
      Iterable<Entity> entities = datastore.prepare(q).asIterable(options);
View Full Code Here

Examples of com.googlecode.gql4j.GqlQuery

  @Override
  public List<BlobInfoDTO> load(String filterStr) throws YaacException {
    // step 1 : parse query
    String strQuery = "select * from " + Blobstore.BLOB_INFO_KIND + " " + filterStr;
    GqlQuery gql = new GqlQuery(strQuery);
    Query query = gql.query();
   
    logger.info("loading blobs, filter = " + filterStr);
    logger.info("parsed query = " + strQuery);
   
    // step 2 : validate query
    for (FilterPredicate filter : query.getFilterPredicates()) {
      if (! Blobstore.BLOB_INFO_ALL_PROPERTIES.contains(filter.getPropertyName())) {
        throw new YaacException(ErrorCode.E201, null);
      }
    }
   
    for (SortPredicate sort : query.getSortPredicates()) {
      if (! Blobstore.BLOB_INFO_ALL_PROPERTIES.contains(sort.getPropertyName())) {
        throw new YaacException(ErrorCode.E201, null);
      }
    }
   
    // step3 : execute query
    AsyncDatastoreService datastore = DatastoreServiceFactory.getAsyncDatastoreService();
    Iterable<Entity> entities = datastore.prepare(gql.query()).asIterable(gql.fetchOptions());
   
    List<BlobInfoDTO> result = newLinkedList();
    for (Entity e : entities) {
      result.add(new BlobInfoDTO(e.getKey().getName(),
                (Date) e.getProperty(Blobstore.BLOB_INFO_CREATION),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.