Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.PreparedQuery.asSingleEntity()


   
    Query q_to = new Query(ACCOUNT_KIND);
    q_to.setKeysOnly();
    q_to.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, to);
    PreparedQuery to_key = datastore.prepare(q_to);
    Entity e_to = to_key.asSingleEntity();
    if(e_to == null)
      return false;
    Key key_to = e_to.getKey();
   
   
View Full Code Here


    Query s_to = new Query(SUBSCRIPTION_KIND);
    s_to.setAncestor(key_to);
    s_to.addFilter(SUBSCRIPTION_EMAIL_PROPERTY, FilterOperator.EQUAL, from);
    s_to.setKeysOnly();
    PreparedQuery pq_to = datastore.prepare(s_to);
    Entity sub_to = pq_to.asSingleEntity();
    if(sub_to == null || !sub_to.getProperty(SUBSCRIPTION_STATUS_PROPERTY).equals(SUBSCRIPTION_STATUS_WAITING))
      return false;
   
    Query s_from = new Query(SUBSCRIPTION_KIND);
    s_from.setAncestor(key_from);
View Full Code Here

    Query s_from = new Query(SUBSCRIPTION_KIND);
    s_from.setAncestor(key_from);
    s_from.addFilter(SUBSCRIPTION_EMAIL_PROPERTY, FilterOperator.EQUAL, to);
    s_from.setKeysOnly();
    PreparedQuery pq_from = datastore.prepare(s_from);
    Entity sub_from = pq_from.asSingleEntity();
    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());
View Full Code Here

    List<SubscriptionInformationObject> subl = new ArrayList<SubscriptionInformationObject>();
    Query key_query = new Query(ACCOUNT_KIND);
    key_query.setKeysOnly();
    key_query.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, user);
    PreparedQuery pq_key = datastore.prepare(key_query);
    Entity e_user = pq_key.asSingleEntity();
    if(e_user == null)
      return subl;
    Key key = e_user.getKey();
    Query q_sub = new Query(SUBSCRIPTION_KIND);
    q_sub.setAncestor(key);
View Full Code Here

  public boolean publishFeed(String email, String message){
    Query key_query = new Query(ACCOUNT_KIND);
    key_query.setKeysOnly();
    key_query.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, email);
    PreparedQuery pq_key = datastore.prepare(key_query);
    Entity e_from = pq_key.asSingleEntity();
    if(e_from == null)
      return false;
    Key key = e_from.getKey();
    Query q_sub = new Query(SUBSCRIPTION_KIND);
    q_sub.setAncestor(key);
View Full Code Here

  private boolean addFeed(String subscriber, String sender, String message){
    Query key_query = new Query(ACCOUNT_KIND);
    key_query.setKeysOnly();
    key_query.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, subscriber);
    PreparedQuery pq_key = datastore.prepare(key_query);
    Entity e_subscriber = pq_key.asSingleEntity();
    if(e_subscriber == null)
      return false;
    Key sub_key = e_subscriber.getKey();
    Query q_sub_sender = new Query(SUBSCRIPTION_KIND);
    q_sub_sender.setAncestor(sub_key);
View Full Code Here

    q_sub_sender.setAncestor(sub_key);
    q_sub_sender.setKeysOnly();
    q_sub_sender.addFilter(SUBSCRIPTION_EMAIL_PROPERTY, FilterOperator.EQUAL, sender);
    q_sub_sender.addFilter(SUBSCRIPTION_STATUS_PROPERTY, FilterOperator.EQUAL, "Active");
    PreparedQuery pq_sender = datastore.prepare(q_sub_sender);
    Entity sender_entity = pq_sender.asSingleEntity();
    if(sender_entity == null)
      return false;
    Key sender_key = sender_entity.getKey();
    Transaction txn = datastore.beginTransaction();
    Entity sender_feed = new Entity(FEED_KIND, sender_key);
View Full Code Here

    List<SubscriptionFeedObject> feeds = new ArrayList<SubscriptionFeedObject>();
    Query q = new Query(ACCOUNT_KIND);
    q.setKeysOnly();
    q.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, email);
    PreparedQuery pq = datastore.prepare(q);
    Entity e = pq.asSingleEntity();
    if(e == null) {
      return feeds;
    }
    Key k = e.getKey();
    Query q_feed = new Query(FEED_KIND);
View Full Code Here

    if (!checkWorklistItemExists(user, wio)) {
      Query q_user = new Query(ACCOUNT_KIND);
      q_user.setKeysOnly();
      q_user.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, user);
      PreparedQuery pq = datastore.prepare(q_user);
      Entity e_user = pq.asSingleEntity();
      if (e_user == null)
        return false;
      Key k = e_user.getKey();
      Transaction txn = datastore.beginTransaction();
      Entity e_wli = new Entity(WORKLIST_ITEM_KIND, k);
View Full Code Here

  public boolean checkWorklistItemExists(String user, WorklistItemObject wio){
    Query q_user = new Query(ACCOUNT_KIND);
    q_user.setKeysOnly();
    q_user.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, user);
    PreparedQuery pq = datastore.prepare(q_user);
    Entity e_user = pq.asSingleEntity();
    if(e_user == null)
      return false;
    Key k = e_user.getKey();
    Query q_wio = new Query(WORKLIST_ITEM_KIND);
    q_wio.setAncestor(k);
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.