Пример #1
0
 @Override
 protected void modelToJson(
     org.slim3.datastore.json.JsonWriter writer,
     java.lang.Object model,
     int maxDepth,
     int currentDepth) {
   com.meeetlet.model.event.Participant m = (com.meeetlet.model.event.Participant) model;
   writer.beginObject();
   org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
   if (m.getComment() != null) {
     writer.setNextPropertyName("comment");
     encoder0.encode(writer, m.getComment());
   }
   if (m.getEventRef() != null && m.getEventRef().getKey() != null) {
     writer.setNextPropertyName("eventRef");
     encoder0.encode(writer, m.getEventRef(), maxDepth, currentDepth);
   }
   if (m.getKey() != null) {
     writer.setNextPropertyName("key");
     encoder0.encode(writer, m.getKey());
   }
   if (m.getUserRef() != null && m.getUserRef().getKey() != null) {
     writer.setNextPropertyName("userRef");
     encoder0.encode(writer, m.getUserRef(), maxDepth, currentDepth);
   }
   if (m.getVersion() != null) {
     writer.setNextPropertyName("version");
     encoder0.encode(writer, m.getVersion());
   }
   writer.endObject();
 }
Пример #2
0
 @Override
 protected void assignKeyToModelRefIfNecessary(
     com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
   com.meeetlet.model.event.Participant m = (com.meeetlet.model.event.Participant) model;
   if (m.getEventRef() == null) {
     throw new NullPointerException("The property(eventRef) must not be null.");
   }
   m.getEventRef().assignKeyIfNecessary(ds);
   if (m.getUserRef() == null) {
     throw new NullPointerException("The property(userRef) must not be null.");
   }
   m.getUserRef().assignKeyIfNecessary(ds);
 }
Пример #3
0
 @Override
 public com.meeetlet.model.event.Participant entityToModel(
     com.google.appengine.api.datastore.Entity entity) {
   com.meeetlet.model.event.Participant model = new com.meeetlet.model.event.Participant();
   model.setComment((java.lang.String) entity.getProperty("comment"));
   if (model.getEventRef() == null) {
     throw new NullPointerException("The property(eventRef) is null.");
   }
   model
       .getEventRef()
       .setKey((com.google.appengine.api.datastore.Key) entity.getProperty("eventRef"));
   model.setKey(entity.getKey());
   if (model.getUserRef() == null) {
     throw new NullPointerException("The property(userRef) is null.");
   }
   model
       .getUserRef()
       .setKey((com.google.appengine.api.datastore.Key) entity.getProperty("userRef"));
   model.setVersion((java.lang.Long) entity.getProperty("version"));
   return model;
 }
Пример #4
0
 @Override
 public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
   com.meeetlet.model.event.Participant m = (com.meeetlet.model.event.Participant) 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("comment", m.getComment());
   if (m.getEventRef() == null) {
     throw new NullPointerException("The property(eventRef) must not be null.");
   }
   entity.setProperty("eventRef", m.getEventRef().getKey());
   if (m.getUserRef() == null) {
     throw new NullPointerException("The property(userRef) must not be null.");
   }
   entity.setProperty("userRef", m.getUserRef().getKey());
   entity.setProperty("version", m.getVersion());
   entity.setProperty("slim3.schemaVersion", 1);
   return entity;
 }
Пример #5
0
 @Override
 protected com.meeetlet.model.event.Participant jsonToModel(
     org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
   com.meeetlet.model.event.Participant m = new com.meeetlet.model.event.Participant();
   org.slim3.datastore.json.JsonReader reader = null;
   org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
   reader = rootReader.newObjectReader("comment");
   m.setComment(decoder0.decode(reader, m.getComment()));
   reader = rootReader.newObjectReader("eventRef");
   decoder0.decode(reader, m.getEventRef(), maxDepth, currentDepth);
   reader = rootReader.newObjectReader("key");
   m.setKey(decoder0.decode(reader, m.getKey()));
   reader = rootReader.newObjectReader("userRef");
   decoder0.decode(reader, m.getUserRef(), maxDepth, currentDepth);
   reader = rootReader.newObjectReader("version");
   m.setVersion(decoder0.decode(reader, m.getVersion()));
   return m;
 }