Package com.google.appengine.api.datastore

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


  public List<SectionInformationObject> getSectionList() {
    List<Entity> sel = getKindEntityList(SECTION_KIND);
    List<SectionInformationObject> siol = new ArrayList<SectionInformationObject>();
    for (Iterator i = sel.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
      SectionInformationObject sio = getSectionFromEntity(e);
      siol.add(sio);
    }
    return siol;
  }
View Full Code Here


    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);
        siol.add(sio);
    }
    return siol;
  }
View Full Code Here

  public List<BookInformationObject> getBookList(SectionInformationObject sio) {
    List<Entity> bel = getKindEntityList(BOOK_KIND);
    List<BookInformationObject> biol = new ArrayList<BookInformationObject>();
    for (Iterator i = bel.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
      if (e.getProperty(DEPARTMENT_ID_PROPERTY).equals(
          sio.getDepartmentId())
          && e.getProperty(COURSE_ID_PROPERTY).equals(
              sio.getCourseId())
          && e.getProperty(SECTION_ID_PROPERTY).equals(
              sio.getCourseId())) {
        BookInformationObject bio = getBookFromEntity(e);
        biol.add(bio);
      }
    }
View Full Code Here

  public DepartmentInformationObject queryDepartmentFromId(String departmentId) {
    Query q = new Query(DEPARTMENT_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL, departmentId);
    PreparedQuery pq = datastore.prepare(q);
    Entity e = pq.asSingleEntity();
    if (e == null)
      return null;
    return getDepartmentFromEntity(e);
  }
View Full Code Here

      String courseId) {
    Query q = new Query(COURSE_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL, departmentId);
    q.addFilter(COURSE_ID_PROPERTY, FilterOperator.EQUAL, courseId);
    PreparedQuery pq = datastore.prepare(q);
    Entity e = pq.asSingleEntity();
    if (e == null)
      return null;
    return getCourseFromEntity(e);
  }
View Full Code Here

    Query q = new Query(SECTION_KIND);
    q.addFilter(DEPARTMENT_ID_PROPERTY, FilterOperator.EQUAL, departmentId);
    q.addFilter(COURSE_ID_PROPERTY, FilterOperator.EQUAL, courseId);
    q.addFilter(SECTION_ID_PROPERTY, FilterOperator.EQUAL, sectionId);
    PreparedQuery pq = datastore.prepare(q);
    Entity e = pq.asSingleEntity();
    if (e == null)
      return null;
    return getSectionFromEntity(e);
  }
View Full Code Here

    q.addSort(DEPARTMENT_ID_PROPERTY,SortDirection.ASCENDING);
    PreparedQuery pq = datastore.prepare(q);
    List<Entity> results = pq.asList(FetchOptions.Builder.withLimit(10));
    List<DepartmentInformationObject> diol = new ArrayList<DepartmentInformationObject>();
    for(Iterator<Entity> i = results.iterator(); i.hasNext();) {
      Entity e = i.next();
      String deptId = (String)e.getProperty(DEPARTMENT_ID_PROPERTY);
      if(deptId.startsWith(prefix))
        diol.add(getDepartmentFromEntity(e));
    }
    return diol;
  }
View Full Code Here

    q.addSort(COURSE_ID_PROPERTY, SortDirection.ASCENDING);
    PreparedQuery pq = datastore.prepare(q)
    List<Entity> results = pq.asList(FetchOptions.Builder.withLimit(10));
    List<CourseInformationObject> ciol = new ArrayList<CourseInformationObject>();
    for(Iterator<Entity> i = results.iterator(); i.hasNext();) {
      Entity e = i.next();
      String courseId = (String)e.getProperty(COURSE_ID_PROPERTY);
      if(courseId.startsWith(prefix))
        ciol.add(getCourseFromEntity(e));
    }
    return ciol;
  }
View Full Code Here

    q.addSort(SECTION_ID_PROPERTY, SortDirection.ASCENDING);
    PreparedQuery pq = datastore.prepare(q);
    List<Entity> results = pq.asList(FetchOptions.Builder.withLimit(10));
    List<SectionInformationObject> siol = new ArrayList<SectionInformationObject>();
    for(Iterator<Entity> i = results.iterator(); i.hasNext();){
      Entity e = i.next();
      String sectionId = (String)e.getProperty(SECTION_ID_PROPERTY);
      if(sectionId.startsWith(prefix))
        siol.add(getSectionFromEntity(e));
    }
    return siol;
  }
View Full Code Here

  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

TOP

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

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.