public List<GenericValue> findByOr(ModelEntity modelEntity, Map<String, ?> fields, List<String> orderBy) throws GenericEntityException { Map<GenericEntity, GenericValue> entityCache = cache.get(modelEntity.getEntityName()); if (entityCache == null) { return Collections.emptyList(); } ArrayList<GenericValue> result = new ArrayList<GenericValue>(); // according to the javadocs for Collections.synchronizedMap() we need to // synchronize when iterating over the elements of the collection synchronized (entityCache) { for (Map.Entry<?, GenericValue> mapEntry : entityCache.entrySet()) { GenericValue value = mapEntry.getValue(); if (isOrMatch(value.fields, fields)) { result.add(value); } } } return result; }
public List findByOr(ModelEntity modelEntity, Map fields, List orderBy) throws GenericEntityException { Map entityCache = (Map) cache.get(modelEntity.getEntityName()); if (entityCache == null) { return Collections.EMPTY_LIST; } ArrayList result = new ArrayList(); // according to the javadocs for Collections.synchronizedMap() we need to // synchronize when iterating over the elements of the collection synchronized(entityCache) { for (Iterator iterator = entityCache.entrySet().iterator(); iterator.hasNext();) { Map.Entry mapEntry = (Map.Entry) iterator.next(); GenericValue value = (GenericValue) mapEntry.getValue(); if (isOrMatch(value.fields, fields)) { result.add(value); } } } return result; }
public List findByOr(ModelEntity modelEntity, Map fields, List orderBy) throws GenericEntityException { Map entityCache = (Map) cache.get(modelEntity.getEntityName()); if (entityCache == null) { return Collections.EMPTY_LIST; } ArrayList result = new ArrayList(); // according to the javadocs for Collections.synchronizedMap() we need to // synchronize when iterating over the elements of the collection synchronized(entityCache) { for (Iterator iterator = entityCache.entrySet().iterator(); iterator.hasNext();) { Map.Entry mapEntry = (Map.Entry) iterator.next(); GenericValue value = (GenericValue) mapEntry.getValue(); if (isOrMatch(value.fields, fields)) { result.add(value); } } } return result; }