예제 #1
0
 public static Entity getSingleUser(String email) {
   Iterable<Entity> results = Util.listEntities(USER, EMAIL, email);
   List<Entity> entity = new ArrayList<Entity>();
   for (Entity e : results) if (e != null) entity.add(e);
   if (!entity.isEmpty()) {
     return (Entity) entity.remove(0);
   }
   return null;
 }
예제 #2
0
 public static Entity createUser(String email, String necessidade, String token) {
   Entity user = getSingleUser(email);
   if (user == null) {
     user = new Entity(USER);
     user.setProperty(EMAIL, email);
     user.setProperty("necessidade", necessidade);
     user.setProperty("token", token);
     Util.persistEntity(user);
   }
   return user;
 }
예제 #3
0
 public static Iterable<Entity> getUser(String email) {
   Iterable<Entity> entities = Util.listEntities(USER, EMAIL, email);
   return entities;
 }
예제 #4
0
 /**
  * get All the items in the list
  *
  * @param kind : item kind
  * @return all the items
  */
 public static Iterable<Entity> getAllUsers() {
   Iterable<Entity> entities = Util.listEntities(USER, null, null);
   return entities;
 }