value = primitiveOrString(r.getKey()); } else if (attr == Query.VALUE) { value = primitiveOrString(r.getValue()); } else { value = r.getAttribute(attr);
public Object getValue() throws SearchException { return copyElementForRead(new Element(result.getKey(), result.getValue())).getObjectValue(); }
/** * Retrieve the object in the cache for the specified key. * * @param id The ID of the PageSeeder entity in the PageSeeder database. * * @return The version of the element or <code>null</code> if the key or element is <code>null</code> */ @Override @SuppressWarnings("unchecked") public synchronized @Nullable E get(Long id) { if (id == null) return null; @Nullable E o = null; Query query = this._cache.createQuery(); Attribute<Long> byId = this._cache.getSearchAttribute("id"); query.includeValues().addCriteria(byId.eq(id)); Results results = query.execute(); List<Result> all = results.all(); if (all.size() > 0) { Result r = all.get(0); o = (E)r.getValue(); } return o; }
/** * Retrieve the object in the cache for the specified key. * * @param attribute The name of the attribute to match. * @param value The value of the attribute to match. * * @return The list of matching element or <code>null</code> if the key or element is <code>null</code> */ @SuppressWarnings("unchecked") public @Nullable List<E> list(String attribute, String value) { if (value == null) return null; Query query = this._cache.createQuery(); Attribute<String> byId = this._cache.getSearchAttribute(attribute); query.addCriteria(byId.eq(value)); Results results = query.execute(); List<Result> all = results.all(); List<E> entities = new ArrayList<>(); for (Result r : all) { entities.add((E)r.getValue()); } return entities; }
/** * Retrieve the object in the cache for the specified key. * * @param attribute The name of the attribute to match. * @param value The value of the attribute to match. * * @return The version of the element or <code>null</code> if the key or element is <code>null</code> */ @SuppressWarnings("unchecked") public @Nullable E get(String attribute, String value) { if (value == null) return null; @Nullable E o = null; Query query = this._cache.createQuery(); Attribute<String> byId = this._cache.getSearchAttribute(attribute); query.includeValues().addCriteria(byId.eq(value)); Results results = query.execute(); List<Result> all = results.all(); if (all.size() > 0) { Result r = all.get(0); o = (E)r.getValue(); } return o; }
value = primitiveOrString(r.getKey()); } else if (attr == Query.VALUE) { value = primitiveOrString(r.getValue()); } else { value = r.getAttribute(attr);
value = primitiveOrString(r.getKey()); } else if (attr == Query.VALUE) { value = primitiveOrString(r.getValue()); } else { value = r.getAttribute(attr);
for (Result result : results.all()) DsdCacheEntry entry = (DsdCacheEntry) result.getValue(); if (!entry.isEmpty())
for (Result result : results.all()) DsdCacheEntry entry = (DsdCacheEntry) result.getValue();