Package com.google.appengine.api.datastore

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


    List<SectionInformationObject> siol = new ArrayList<SectionInformationObject>();
    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 siol;
    Key k = e_user.getKey();
    Query q = new Query(WORKLIST_ITEM_KIND);
    q.setAncestor(k);
    PreparedQuery pq_wl = datastore.prepare(q);
    List<Entity> el = pq_wl.asList(FetchOptions.Builder.withDefaults());
    for(Iterator<Entity> i = el.iterator(); i.hasNext(); ) {
      Entity e = i.next();
      String dept = (String) e.getProperty(WORKLIST_ITEM_DEPT_PROPERTY);
      String course = (String)e.getProperty(WORKLIST_ITEM_COURSE_PROPERTY);
      String section = (String)e.getProperty(WORKLIST_ITEM_SECTION_PROPERTY);
      SectionInformationObject sio = spiderDatastore.querySectionFromId(dept, course, section);
      siol.add(sio);
    }
   
    return siol;
View Full Code Here


    List<WorklistItemObject> wiol = new ArrayList<WorklistItemObject>();
    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 wiol;
    Key k = e_user.getKey();
    Query q = new Query(WORKLIST_ITEM_KIND);
    q.setAncestor(k);
    PreparedQuery pq_wl = datastore.prepare(q);
    List<Entity> el = pq_wl.asList(FetchOptions.Builder.withDefaults());
    for(Iterator<Entity> i = el.iterator(); i.hasNext(); ) {
      Entity e = i.next();
      String dept = (String) e.getProperty(WORKLIST_ITEM_DEPT_PROPERTY);
      String course = (String)e.getProperty(WORKLIST_ITEM_COURSE_PROPERTY);
      String section = (String)e.getProperty(WORKLIST_ITEM_SECTION_PROPERTY);
      WorklistItemObject wio = new WorklistItemObject(dept,course,section);
      wiol.add(wio);
    }
    return wiol;
  }
View Full Code Here

 
  public void doGet(HttpServletRequest req, HttpServletResponse resp) {

      QueryResultIterator<Entity> i = NoSignupDatastore.getAll();
      while(i.hasNext()){
        Entity e = i.next();
 
          String email = (String) e.getProperty(NoSignupDatastore.EMAIL_PROPERTY);
          String phone = (String) e.getProperty(NoSignupDatastore.PHONE_NUMBER_PROPERTY);
          String dept = (String) e.getProperty(NoSignupDatastore.DEPT_PROPERTY);
          String course = (String) e.getProperty(NoSignupDatastore.COURSE_PROPERTY);
          String section = (String) e.getProperty(NoSignupDatastore.SECTION_PROPERTY);
         
        if((Boolean)e.getProperty(NoSignupDatastore.ACTIVATED_PROPERTY)){
          UBCSectionDetailService details = new UBCSectionDetailService();
          details.init(dept, course, section);
          if(details.getGenSeatsRemain() > 0) {
            String email_str = EMAIL_NOTIFICATION.replaceAll("<DEPARTMENT>", dept).replaceAll("<COURSE>", course).replaceAll("<SECTION>", section).replaceAll("<NUMBER_OF_SEATS>", ""+details.getGenSeatsRemain()).replaceAll("<TIMESTAMP>", Calendar.getInstance(TimeZone.getTimeZone("PST")).getTime().toString());
            String phone_str = SMS_NOTIFICATION.replaceAll("<DEPARTMENT>", dept).replaceAll("<COURSE>", course).replaceAll("<SECTION>", section).replaceAll("<NUMBER_OF_SEATS>", ""+details.getGenSeatsRemain()).replaceAll("<TIMESTAMP>", Calendar.getInstance(TimeZone.getTimeZone("PST")).getTime().toString());
View Full Code Here

                List<Key> retryKeys = Lists.newArrayList();
                int offset = 0;
                final ActivationFilter filter = ActivationFilter.compile(activatePatterns);
                for (Key key : currentKeys)
                {
                  Entity entity = map.get(key);
                  if (entity == null)
                  {
                    retryKeys.add(key);
                    if (offset >= result.size())
                      result.add(null);
View Full Code Here

    {
      key = existingKey;
      if (!cache.isActivated(object))
        throw new IllegalArgumentException("Attempt to store unactivated instance!");
    }
    final Entity e = new Entity(key);

    register(object, key, true);

    encoder.encode(new InstanceStore()
    {
      @Override
      public Key toKey(Object instance, Object parent)
      {
        if (instance == null)
          return null;

        Key key = cache.getKey(instance);
        if (key == null)
        {
          result.addAll(toEntities(instance, null, parent));
          key = cache.getKey(instance);
        }
        return key;
      }
    }, object, new PropertyStore()
    {
      @Override
      public void setProperty(String key, Object value, boolean index)
      {
        if (index)
          e.setProperty(key, value);
        else
          e.setUnindexedProperty(key, value);
      }
    });

    result.add(e);
View Full Code Here

          Iterable<Key> keys = Iterables.transform(refreshList, cKeyFunction);
          Map<Key, Entity> entityMap = FutureUtils.safeGet(service.get(keys));
          List<RefreshEntry> retryPairs = Lists.newArrayList();
          for (RefreshEntry entry : refreshList)
          {
            Entity e = entityMap.get(entry.key);
            if (e == null)
              retryPairs.add(entry);
            else
              refreshObject(entry.object, e, next, entry.path, activationFilter);
          }
View Full Code Here

              @SuppressWarnings("unchecked")
              @Override
              public T next()
              {
                Entity entity = nested.next();
                if (activated)
                {
                  return toObject(type, entity, refresh, retries, filter);
                }
                else
                {
                  Key key = entity.getKey();
                  T object = (T) cache.getKey(key);
                  if (object == null)
                    object = createShell(type, key);
                  return object;
                }
View Full Code Here

    Query q = new Query();
    q.setKeysOnly();
    List<Entity> l = datastore.prepare(q).asList(
        FetchOptions.Builder.withDefaults());
    for (Iterator i = l.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
      log.info("deleting " + e.getKey());
      System.out.println("deleting " + e.getKey());
      datastore.delete(e.getKey());
    }
  }
View Full Code Here

    }
  }


  public void initSchema() {
    Entity e = new Entity("Unique Course Set", "COURSE_ID_SET");
    datastore.put(e);
    e = new Entity("Cache List", "CACHE_LIST");
    datastore.put(e);
    e = new Entity("Contact Information Set", "CONTACT_SET");
    datastore.put(e);
    e = new Entity("Login Information Set", "LOGIN_SET");
    datastore.put(e);
    e = new Entity("Account Information Set", "ACCOUNT_SET");
    datastore.put(e);
  }
View Full Code Here

  public List<UniqueCourseObject> getCacheUniqueCourseObjectList()
      throws EntityNotFoundException {
    List<Entity> cel = getCacheEntityList();
    List<UniqueCourseObject> cl = new ArrayList<UniqueCourseObject>();
    for (Iterator i = cel.iterator(); i.hasNext();) {
      Entity e = (Entity) i.next();
      cl.add(getUniqueCourse((Key) e.getProperty("courseKey")));
    }
    return cl;
  }
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.