Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Transaction.commit()


    if(e.getProperty(ACTIVATED_PROPERTY).equals(true))
      return false;
    Transaction txn = datastore.beginTransaction();
    e.setProperty(ACTIVATED_PROPERTY, true);
    datastore.put(e);
    txn.commit();
    return true;
  }
 
  private PreparedQuery queryAccount(String email){
    Query q = new Query(ACCOUNT_KIND);
View Full Code Here


    qe.setProperty(AUTHENTICATION_KEY_PROPERTY, lao.getAuthkey());
    qe.setProperty(PREFERENCE_NOTIFY_CONFIG_PROPERTY, lao.getNotifyConfig());
    qe.setProperty(PREFERENCE_PHONE_NUMBER_PROPERTY, lao.getPhoneNumber());
    qe.setProperty(PREFERENCE_CARRIER_PROPERTY, lao.getCarrier().getGateway());
    datastore.put(qe);
    txn.commit();
    return true;
  }
 
  //Bi-directional subscription adding
  public boolean addSubscription(String from, String to){
View Full Code Here

    datastore.put(sub_from);
    Entity sub_to = new Entity(SUBSCRIPTION_KIND, k_to);
    sub_to.setProperty(SUBSCRIPTION_EMAIL_PROPERTY, from);
    sub_to.setProperty(SUBSCRIPTION_STATUS_PROPERTY, "Pending");
    datastore.put(sub_to);
    txn.commit();
    return true;
  }
 
  //Bidirectional email check
  public boolean checkSubscriptionExists(String from, String to){
View Full Code Here

      return false;
    sub_from.setProperty(SUBSCRIPTION_STATUS_PROPERTY, SUBSCRIPTION_STATUS_ACTIVE);
    Transaction txn = datastore.beginTransaction();
    datastore.put(sub_to);
    datastore.put(sub_from);
    txn.commit();
    return true;
  }
 
  public boolean declineSubscription(String from, String to){
    Query q_from = new Query(ACCOUNT_KIND);
View Full Code Here

    if(sub_from == null || !sub_from.getProperty(SUBSCRIPTION_STATUS_PROPERTY).equals(SUBSCRIPTION_STATUS_PENDING))
      return false;
    Transaction txn = datastore.beginTransaction();
    datastore.delete(sub_to.getKey());
    datastore.delete(sub_from.getKey());
    txn.commit();
    return true;
  }
 
  public List<SubscriptionInformationObject> getSubscriptions(String user, String type){
    List<SubscriptionInformationObject> subl = new ArrayList<SubscriptionInformationObject>();
View Full Code Here

    Entity sender_feed = new Entity(FEED_KIND, sender_key);
    sender_feed.setProperty(FEED_READ_STATUS_PROPERTY, false);
    sender_feed.setProperty(FEED_MESSAGE_PROPERTY, new Text(message));
    sender_feed.setProperty(FEED_TIMESTAMP_PROPERTY, new Date());
    datastore.put(sender_feed);
    txn.commit();
    return true;
  }
 
  public List<SubscriptionFeedObject> readFeeds(String email, boolean setRead, boolean getUnreadOnly){
    List<SubscriptionFeedObject> feeds = new ArrayList<SubscriptionFeedObject>();
View Full Code Here

      e_wli.setProperty(WORKLIST_ITEM_COURSE_PROPERTY, wio.getCourseId());
      e_wli.setProperty(WORKLIST_ITEM_SECTION_PROPERTY, wio.getSectionId());
      if(spiderDatastore.querySectionFromId( wio.getDeptId(), wio.getCourseId(),wio.getSectionId()) == null)
        return false;
      datastore.put(e_wli);
      txn.commit();
    } else
      return false;
    return true;
  }
 
View Full Code Here

      PreparedQuery pq_wio = datastore.prepare(q_wio);
      if(pq_wio.asSingleEntity() == null)
        return false;
      Transaction txn = datastore.beginTransaction();
      datastore.delete(pq_wio.asSingleEntity().getKey());
      txn.commit();
      return true;
  }
 
  public List<SectionInformationObject> getWorklistAsSIO(String user){
    List<SectionInformationObject> siol = new ArrayList<SectionInformationObject>();
View Full Code Here

    Key k = KeyFactory.createKey("Login Information Set", "LOGIN_SET");
    Entity e = new Entity("Login Information", k);
    e.setProperty("username", lio.getUsername());
    e.setProperty("password", lio.getPassword());
    datastore.put(e);
    txn.commit();
   
  }
 
  public boolean addLogin(LoginInformationObject lio){
    boolean b = checkLoginExist(lio);
View Full Code Here

        FetchOptions.Builder.withDefaults());
    for (Iterator i = results.iterator(); i.hasNext();) {
      Transaction txn = datastore.beginTransaction();
      Entity e = (Entity) i.next();
      datastore.delete(e.getKey());
      txn.commit();
    }
  }

  private List<Entity> getCacheEntityList() {
    Query q = new Query("Cache");
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.