Package com.google.appengine.api.datastore

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


   * @return boolean value whether add was successful or not
   */
  public boolean addCourse(CourseInformationObject cio) {
    if (!checkCourseExists(cio)) {
      Transaction txn = datastore.beginTransaction();
      Key k = makeParentKey(cio);
      Entity e = new Entity(COURSE_KIND, k);
      e.setProperty(DEPARTMENT_ID_PROPERTY, cio.getDepartmentId());
      e.setProperty(COURSE_ID_PROPERTY, cio.getCourseId());
      e.setProperty(COURSE_TITLE_PROPERTY, cio.getCourseTitle());
      e.setProperty(PREREQ_PROPERTY, cio.getPrereqString());
View Full Code Here


   *            SectionInformationObject - section data to be added
   * @return boolean value whether add was successful or not
   */
  public boolean addSection(SectionInformationObject sio) {
    if (!checkSectionExists(sio)) {
      Key k = makeParentKey(sio);
      Transaction txn = datastore.beginTransaction();
      Entity e = new Entity(SECTION_KIND, k);
      e.setProperty(DEPARTMENT_ID_PROPERTY, sio.getDepartmentId());
      e.setProperty(COURSE_ID_PROPERTY, sio.getCourseId());
      e.setProperty(SECTION_ID_PROPERTY, sio.getSectionId());
View Full Code Here

    return true;
  }

  public boolean addBooks(BookInformationObject bio) {
    if (!checkBookExists(bio)) {
      Key k = makeParentKey(bio);
      Transaction txn = datastore.beginTransaction();
      Entity e = new Entity(BOOK_KIND, k);
      e.setProperty(DEPARTMENT_ID_PROPERTY, bio.getDepartmentId());
      e.setProperty(COURSE_ID_PROPERTY, bio.getCourseId());
      e.setProperty(SECTION_ID_PROPERTY, bio.getSectionId());
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

    }
  }
 
  public static String addNotifier(String email, String pNum, String dept, String course, String section){
    String verifyKey = generateVerificationKey();
    Key k = KeyFactory.createKey(DATASTORE_ENTITY_SET_NAME, DATASTORE_ENTITY_KEY_NAME);
    Transaction txn = datastore.beginTransaction();                               
    Entity e = new Entity(ENTRY_KIND,k);                                      
    e.setProperty(EMAIL_PROPERTY, email);    
    e.setProperty(ACTIVATED_PROPERTY, false);
    e.setProperty(VERIFY_KEY_PROPERTY, verifyKey);
View Full Code Here

  }

 
  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();) {
View Full Code Here

    }
  }
 
  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();) {
View Full Code Here

 
 
  public boolean addAccount(AccountObject ao){
    if(!this.checkAccountExist(ao.getEmail())){
      //create and commit this entry
      Key k = KeyFactory.createKey(DATASTORE_ENTITY_SET_NAME, DATASTORE_ENTITY_KEY_NAME);
      Transaction txn = datastore.beginTransaction();                               
      Entity e = new Entity(ACCOUNT_KIND,k);                                      
      e.setProperty(ACCOUNT_ID_PROPERTY, ao.getEmail());    
      e.setProperty(PASSWORD_PROPERTY, ao.getPassword());
      e.setProperty(ACTIVATED_PROPERTY, ao.isActivated());
View Full Code Here

    PreparedQuery pq_to = datastore.prepare(q_to);
    Entity e_to = pq_to.asSingleEntity();
   
    if(e_from == null || e_to == null)
      return false;
    Key k_from = e_from.getKey();
    Key k_to = e_to.getKey();
    if(checkSubscriptionExists(k_from, from, k_to, to))
      return false;
    Transaction txn = datastore.beginTransaction();
    Entity sub_from = new Entity(SUBSCRIPTION_KIND, k_from);
    sub_from.setProperty(SUBSCRIPTION_EMAIL_PROPERTY, to);
View Full Code Here

    Query q_from = new Query(ACCOUNT_KIND);
    q_from.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, from);
    q_from.setKeysOnly();
    PreparedQuery pq_from = datastore.prepare(q_from);
    Entity e_from = pq_from.asSingleEntity();
    Key from_key = e_from.getKey();
   
    Query q_to = new Query(ACCOUNT_KIND);
    q_to.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, to);
    q_to.setKeysOnly();
    PreparedQuery pq_to = datastore.prepare(q_to);
    Entity e_to = pq_to.asSingleEntity();
    Key to_key = e_to.getKey();
   
    Query sub_from = new Query(SUBSCRIPTION_KIND);
    sub_from.setAncestor(from_key);
    sub_from.addFilter(SUBSCRIPTION_EMAIL_PROPERTY, FilterOperator.EQUAL, to);
    sub_from.addFilter(SUBSCRIPTION_STATUS_PROPERTY, FilterOperator.EQUAL, SUBSCRIPTION_STATUS_ACTIVE);
View Full Code Here

TOP

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

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.