Ejemplo n.º 1
0
 @Override
 public tutorial.global.cool.model.BaseFormObject entityToModel(
     com.google.appengine.api.datastore.Entity entity) {
   tutorial.global.cool.model.BaseFormObject model =
       new tutorial.global.cool.model.BaseFormObject();
   model.setEmail((java.lang.String) entity.getProperty("email"));
   model.setInsertDate((java.lang.String) entity.getProperty("insertDate"));
   model.setKey(entity.getKey());
   model.setUpdateDate((java.lang.String) entity.getProperty("updateDate"));
   model.setUserId((java.lang.String) entity.getProperty("userId"));
   model.setVersion((java.lang.Long) entity.getProperty("version"));
   return model;
 }
Ejemplo n.º 2
0
 @Override
 public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   com.google.appengine.api.datastore.Entity entity = null;
   if (m.getKey() != null) {
     entity = new com.google.appengine.api.datastore.Entity(m.getKey());
   } else {
     entity = new com.google.appengine.api.datastore.Entity(kind);
   }
   entity.setProperty("email", m.getEmail());
   entity.setProperty("insertDate", m.getInsertDate());
   entity.setProperty("updateDate", m.getUpdateDate());
   entity.setProperty("userId", m.getUserId());
   entity.setProperty("version", m.getVersion());
   entity.setProperty("slim3.schemaVersion", 1);
   return entity;
 }
Ejemplo n.º 3
0
 @Override
 protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
   validateKey(key);
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   m.setKey(key);
 }
Ejemplo n.º 4
0
 @Override
 protected com.google.appengine.api.datastore.Key getKey(Object model) {
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   return m.getKey();
 }
Ejemplo n.º 5
0
 @Override
 protected tutorial.global.cool.model.BaseFormObject jsonToModel(
     org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
   tutorial.global.cool.model.BaseFormObject m = new tutorial.global.cool.model.BaseFormObject();
   org.slim3.datastore.json.JsonReader reader = null;
   org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
   reader = rootReader.newObjectReader("email");
   m.setEmail(decoder0.decode(reader, m.getEmail()));
   reader = rootReader.newObjectReader("insertDate");
   m.setInsertDate(decoder0.decode(reader, m.getInsertDate()));
   reader = rootReader.newObjectReader("key");
   m.setKey(decoder0.decode(reader, m.getKey()));
   reader = rootReader.newObjectReader("updateDate");
   m.setUpdateDate(decoder0.decode(reader, m.getUpdateDate()));
   reader = rootReader.newObjectReader("userId");
   m.setUserId(decoder0.decode(reader, m.getUserId()));
   reader = rootReader.newObjectReader("version");
   m.setVersion(decoder0.decode(reader, m.getVersion()));
   return m;
 }
Ejemplo n.º 6
0
 @Override
 protected void modelToJson(
     org.slim3.datastore.json.JsonWriter writer,
     java.lang.Object model,
     int maxDepth,
     int currentDepth) {
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   writer.beginObject();
   org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
   if (m.getEmail() != null) {
     writer.setNextPropertyName("email");
     encoder0.encode(writer, m.getEmail());
   }
   if (m.getInsertDate() != null) {
     writer.setNextPropertyName("insertDate");
     encoder0.encode(writer, m.getInsertDate());
   }
   if (m.getKey() != null) {
     writer.setNextPropertyName("key");
     encoder0.encode(writer, m.getKey());
   }
   if (m.getUpdateDate() != null) {
     writer.setNextPropertyName("updateDate");
     encoder0.encode(writer, m.getUpdateDate());
   }
   if (m.getUserId() != null) {
     writer.setNextPropertyName("userId");
     encoder0.encode(writer, m.getUserId());
   }
   if (m.getVersion() != null) {
     writer.setNextPropertyName("version");
     encoder0.encode(writer, m.getVersion());
   }
   writer.endObject();
 }
Ejemplo n.º 7
0
 @Override
 protected void incrementVersion(Object model) {
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
   m.setVersion(Long.valueOf(version + 1L));
 }
Ejemplo n.º 8
0
 @Override
 protected long getVersion(Object model) {
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   return m.getVersion() != null ? m.getVersion().longValue() : 0L;
 }