Пример #1
0
 public Results findForProperty(String propertyName, Object propertyValue, int count) {
   if (propertyValue == null) {
     return new Results();
   }
   List<Entity> l = getEntities();
   if (l == null) {
     return new Results();
   }
   List<Entity> found = new ArrayList<Entity>();
   for (Entity e : l) {
     if (propertyValue.equals(e.getProperty(propertyName))) {
       found.add(e);
       if ((count > 0) && (found.size() == count)) {
         break;
       }
     }
   }
   return Results.fromEntities(found);
 }
Пример #2
0
 public Results startingFrom(UUID entityId) {
   if (entities != null) {
     for (int i = 0; i < entities.size(); i++) {
       Entity entity = entities.get(i);
       if (entityId.equals(entity.getUuid())) {
         if (i == 0) {
           return this;
         }
         return Results.fromEntities(entities.subList(i, entities.size()));
       }
     }
   }
   if (refs != null) {
     for (int i = 0; i < refs.size(); i++) {
       EntityRef entityRef = refs.get(i);
       if (entityId.equals(entityRef.getUuid())) {
         if (i == 0) {
           return this;
         }
         return Results.fromRefList(refs.subList(i, refs.size()));
       }
     }
   }
   if (ids != null) {
     for (int i = 0; i < ids.size(); i++) {
       UUID uuid = ids.get(i);
       if (entityId.equals(uuid)) {
         if (i == 0) {
           return this;
         }
         return Results.fromIdList(ids.subList(i, ids.size()));
       }
     }
   }
   return this;
 }