Package com.google.appengine.api.datastore

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


    datastore.put(e);
    txn.commit();
  }

  public void traceSchema() {
    Query q = new Query();
    Key k = KeyFactory.createKey(DATASTORE_ENTITY_SET_NAME,
        DATASTORE_ENTITY_KEY_NAME);
    q.setAncestor(k);
    q.setKeysOnly();
    List<Entity> l = datastore.prepare(q).asList(
        FetchOptions.Builder.withDefaults());
    for (Iterator i = l.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
      System.out.println(e.getKey().toString());
View Full Code Here


      System.out.println(e.getKey().toString());
    }
  }

  public void dropSchema() {
    Query q = new Query();
    Key k = KeyFactory.createKey(DATASTORE_ENTITY_SET_NAME,
        DATASTORE_ENTITY_KEY_NAME);
    q.setAncestor(k);
    q.setKeysOnly();
    List<Entity> l = datastore.prepare(q).asList(
        FetchOptions.Builder.withDefaults());
    for (Iterator i = l.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
      System.out.println("deleting " + e.getKey());
View Full Code Here


  // helper query methods

  private PreparedQuery queryDepartment(DepartmentInformationObject dio) {
    Query q = new Query(DEPARTMENT_KIND);
    Key k = KeyFactory.createKey(DATASTORE_ENTITY_SET_NAME,
        DATASTORE_ENTITY_KEY_NAME);
    q.setAncestor(k);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL,
        dio.getDepartmentId());
    return datastore.prepare(q);
  }
View Full Code Here

        dio.getDepartmentId());
    return datastore.prepare(q);
  }

  private PreparedQuery queryCourse(CourseInformationObject cio) {
    Query q = new Query(COURSE_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL,
        cio.getDepartmentId());
    q.addFilter(COURSE_ID_PROPERTY, FilterOperator.EQUAL, cio.getCourseId());
    return datastore.prepare(q);
  }
View Full Code Here

    q.addFilter(COURSE_ID_PROPERTY, FilterOperator.EQUAL, cio.getCourseId());
    return datastore.prepare(q);
  }

  private PreparedQuery querySection(SectionInformationObject sio) {
    Query q = new Query(SECTION_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL,
        sio.getDepartmentId());
    q.addFilter(COURSE_ID_PROPERTY, FilterOperator.EQUAL, sio.getCourseId());
    q.addFilter(SECTION_ID_PROPERTY, FilterOperator.EQUAL,
        sio.getSectionId());
    return datastore.prepare(q);
  }
View Full Code Here

        sio.getSectionId());
    return datastore.prepare(q);
  }

  private PreparedQuery queryBook(BookInformationObject bio) {
    Query q = new Query(BOOK_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL,
        bio.getDepartmentId());
    q.addFilter(COURSE_ID_PROPERTY, FilterOperator.EQUAL, bio.getCourseId());
    q.addFilter(SECTION_ID_PROPERTY, FilterOperator.EQUAL,
        bio.getSectionId());
    q.addFilter(BOOK_ISBN_PROPERTY, FilterOperator.EQUAL, bio.getIsbn());
    return datastore.prepare(q);
  }
View Full Code Here

    }
    return ciol;
  }

  public List<CourseInformationObject> getCourseList(DepartmentInformationObject dio) {
    Query q = new Query(COURSE_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL, dio.getDepartmentId());
    q.addSort(DEPARTMENT_ID_PROPERTY, SortDirection.ASCENDING);
    q.addSort(COURSE_ID_PROPERTY, SortDirection.ASCENDING);
    List<Entity> cel = datastore.prepare(q).asList(FetchOptions.Builder.withDefaults());
    List<CourseInformationObject> ciol = new ArrayList<CourseInformationObject>();
    for (Iterator i = cel.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
      CourseInformationObject cio = getCourseFromEntity(e);
View Full Code Here

  public NoSignupDatastore(){
    initSchema();
  }
 
  private static void initSchema(){
    Query q = new Query(DATASTORE_ENTITY_SET_NAME);
    q.setKeysOnly();
    if(datastore.prepare(q).asSingleEntity() == null) {
      Transaction txn = datastore.beginTransaction();   
      Entity e = new Entity(DATASTORE_ENTITY_SET_NAME, DATASTORE_ENTITY_KEY_NAME);
      datastore.put(e);
      txn.commit();
View Full Code Here

    }
    return "";
  }
 
  public static boolean verify(String key){
    Query q = new Query(ENTRY_KIND);
    q.addFilter(VERIFY_KEY_PROPERTY, FilterOperator.EQUAL, key);
    q.addFilter(ACTIVATED_PROPERTY, FilterOperator.EQUAL, false);
    PreparedQuery pq = datastore.prepare(q);
      try {
        Entity e = pq.asSingleEntity();
        if(e != null ) {
          e.setProperty(ACTIVATED_PROPERTY, true);
View Full Code Here

      }
    return false;
  }
 
  public static void deleteNotifier(String email, String pNum, String dept, String course, String section){
    Query q = new Query(ENTRY_KIND);
    q.setKeysOnly();
    q.addFilter(EMAIL_PROPERTY, FilterOperator.EQUAL, email);
    q.addFilter(DEPT_PROPERTY, FilterOperator.EQUAL, dept);
    q.addFilter(COURSE_PROPERTY, FilterOperator.EQUAL, course);
    q.addFilter(SECTION_PROPERTY, FilterOperator.EQUAL, section);
    PreparedQuery pq = datastore.prepare(q);
    Iterator<Entity> it = pq.asIterable().iterator();
    while(it.hasNext())
      datastore.delete(it.next().getKey());
   
View Full Code Here

TOP

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

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.