Package com.google.appengine.api.datastore

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


    List<Entity> entities = new ArrayList<Entity>(objects.length);
    for(int i=0; i<objects.length;i++){
      Class<?> clazz = objects[i].getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      Field idField = info.getIdField();
      Entity entity = GaeMappingUtils.createEntityInstance(idField, info, objects[i]);
      GaeMappingUtils.fillEntity(objects[i], entity);
      entities.add(entity);
    }
       
    Future<List<Key>> future = ds.put(entities);
View Full Code Here


    List<Entity> entities = new ArrayList<Entity>();
    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      Field idField = info.getIdField();
      Entity entity = GaeMappingUtils.createEntityInstance(idField, info, obj);
      GaeMappingUtils.fillEntity(obj, entity);
      entities.add(entity);
    }   
   
    Future<List<Key>> future = ds.put(entities);
View Full Code Here

    //throw new NotImplementedException("update not implemented for GAE yet");
    List<Entity> entities = new ArrayList<Entity>();
    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      Entity entity = GaeMappingUtils.createEntityInstanceForUpdate(info, obj);
      GaeMappingUtils.fillEntity(obj, entity);
      entities.add(entity);
    }
       
    Future<List<Key>> future = ds.put(entities);
View Full Code Here

    //throw new NotImplementedException("update not implemented for GAE yet");
    List<Entity> entities = new ArrayList<Entity>();
    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      Entity entity = GaeMappingUtils.createEntityInstanceForUpdate(info, obj);
      GaeMappingUtils.fillEntity(obj, entity);
      entities.add(entity);
    }
       
    Future<List<Key>> future = ds.put(entities);
View Full Code Here

  public SienaFuture<Void> save(final Object obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
    final Field idField = info.getIdField();
   
    final Entity entity;
    final Object idVal = Util.readField(obj, idField);
    // id with null value means insert
    if(idVal == null){
      entity = GaeMappingUtils.createEntityInstance(idField, info, obj);
    }
    // id with not null value means update
    else{
      entity = GaeMappingUtils.createEntityInstanceForUpdate(info, obj);     
    }
   
    GaeMappingUtils.fillEntity(obj, entity);
    Future<Key> future = ds.put(entity);
   
    Future<Void> wrapped = new SienaFutureWrapper<Key, Void>(future) {
            @Override
            protected Void wrap(Key generatedKey) throws Exception
            {
              if(idVal == null){
              GaeMappingUtils.setIdFromKey(idField, obj, entity.getKey());
            }
              return null;
            }
    };
   
View Full Code Here

    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      Field idField = info.getIdField();
     
      Entity entity;
      Object idVal = Util.readField(obj, idField);
      // id with null value means insert
      if(idVal == null){
        entity = GaeMappingUtils.createEntityInstance(idField, info, obj);
      }
View Full Code Here

    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      Field idField = info.getIdField();
     
      Entity entity;
      Object idVal = Util.readField(obj, idField);
      // id with null value means insert
      if(idVal == null){
        entity = GaeMappingUtils.createEntityInstance(idField, info, obj);
      }
View Full Code Here

    public boolean hasNext() {
      return gaeIterator.hasNext();
    }

    public T next() {
      Entity entity = gaeIterator.next();
      QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext)query.option(QueryOptionGaeContext.ID);
      // overrides current cursor with the current iterator cursor
      // sets the current cursor (in stateful mode, cursor is always kept for further use)
      Cursor cursor = gaeIterator.getCursor();
      if(cursor!=null) {
View Full Code Here

    public boolean hasNext() {
      return gaeIterator.hasNext();
    }

    public T next() {
      Entity entity = gaeIterator.next();
      T obj = pm.map(query, entity);
      return obj;
    }
View Full Code Here

    public boolean hasNext() {
      return gaeIterator.hasNext();
    }

    public T next() {
      Entity entity = gaeIterator.next();
      QueryOptionGaeContext gaeCtx = (QueryOptionGaeContext)query.option(QueryOptionGaeContext.ID);
      // overrides current cursor with the current iterator cursor
      // sets the current cursor (in stateful mode, cursor is always kept for further use)
      Cursor cursor = gaeIterator.getCursor();
      if(cursor!=null) {
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.