Examples of SaveContext


Examples of com.googlecode.objectify.impl.translate.SaveContext

        // We are looking at a brand-new arrangement for something that already existed in the session.
        // We need to go through any Ref<?>s that might be in need of loading. We find those refs by
        // actually saving the entity into a custom SaveContext.
        T thing = sv.getResult().now();
        if (thing != null) {
          SaveContext saveCtx = new SaveContext() {
            @Override
            public boolean skipLifecycle() {
              return true;
            }
View Full Code Here

Examples of com.googlecode.objectify.impl.translate.SaveContext

    if (pojo instanceof Entity) {
      return (Entity)pojo;
    } else {
      @SuppressWarnings("unchecked")
      EntityMetadata<Object> meta = (EntityMetadata<Object>)ofy.factory().getMetadata(pojo.getClass());
      return meta.save(pojo, new SaveContext());
    }
  }
View Full Code Here

Examples of com.googlecode.objectify.impl.translate.SaveContext

  public <E> Result<Map<Key<E>, E>> save(Iterable<? extends E> entities) {

    if (log.isLoggable(Level.FINEST))
      log.finest("Saving " + entities);

    final SaveContext ctx = new SaveContext();

    final List<Entity> entityList = new ArrayList<>();
    for (E obj: entities) {
      if (obj == null)
        throw new NullPointerException("Attempted to save a null entity");
View Full Code Here

Examples of com.googlecode.objectify.impl.translate.SaveContext

      if (value.getClass().isAnnotationPresent(Entity.class)) {
        return factory().keys().getMetadataSafe(value).getRawKey(value);
      } else {
        // Run it through a translator
        Translator<Object, Object> translator = factory().getTranslators().get(new TypeKey<>(value.getClass()), new CreateContext(factory()), Path.root());
        return translator.save(value, false, new SaveContext(), Path.root());
      }
    }
  }
View Full Code Here

Examples of com.googlecode.objectify.impl.translate.SaveContext

   */
  private com.google.appengine.api.datastore.Key getParentRaw(P pojo) {
    if (parentMeta == null)
      return null;

    return (com.google.appengine.api.datastore.Key)parentMeta.getValue(pojo, new SaveContext(), Path.root());
  }
View Full Code Here

Examples of com.googlecode.objectify.impl.translate.SaveContext

    SimpleEntityPOJO pojo = new SimpleEntityPOJO();
    pojo.id = 123L;
    pojo.foo = "bar";

    SaveContext saveCtx = new SaveContext();
    Entity ent = (Entity)translator.save(pojo, false, saveCtx, Path.root());

    assert ent.getKey().getKind().equals(SimpleEntityPOJO.class.getSimpleName());
    assert ent.getKey().getId() == pojo.id;
    assert ent.getProperties().size() == 1;
View Full Code Here

Examples of com.googlecode.objectify.impl.translate.SaveContext

    ClassTranslator<Thing> translator = ClassTranslatorFactory.createEmbeddedClassTranslator(Thing.class, createCtx, thingPath);

    Thing thing = new Thing();
    thing.foo = "bar";

    SaveContext saveCtx = new SaveContext();
    EmbeddedEntity ent = (EmbeddedEntity)translator.save(thing, false, saveCtx, thingPath);

    assert ent.getKey() == null;
    assert ent.getProperties().size() == 1;
    assert ent.getProperty("foo").equals("bar");
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.