public boolean hasAggregators() { return results.hasAggregators(); } }
public boolean hasAttributes() { return results.hasAttributes(); }
public List<Result> all() throws SearchException { return new TxResultsList(results.all()); }
public int size() { return results.size(); }
public void discard() { results.discard(); }
/** * 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; }
usernameSearchAttribute.eq(user.getEntityIdentifier().getKey())) .end(); final List<Result> queryResults = query.execute().all(); for (Result r : queryResults) { membershipCache.remove(r.getKey());
usernameSearchAttribute.eq(user.getEntityIdentifier().getKey())) .end(); final List<Result> queryResults = query.execute().all(); for (Result r : queryResults) { membershipCache.remove(r.getKey());
Results results = query.execute(); boolean empty = false; for (Result result : results.all())
for (Result result : results.all())
/** * Given DSD entry name, clear its corresponding object values from the cache. * * @param name contains the name of object to be cleared. * @param contextId maps to sub-tree in DIT, e.g. ou=contextId, dc=example, dc=com. * * @throws SecurityException in the event of system or rule violation. */ void clearDsdCacheEntry(String name, String contextId) { Attribute<String> context = m_dsdCache.getSearchAttribute(CONTEXT_ID); Attribute<String> dsdName = m_dsdCache.getSearchAttribute(DSD_NAME); Query query = m_dsdCache.createQuery(); query.includeKeys(); query.includeValues(); query.addCriteria(dsdName.eq(name).and(context.eq(contextId))); Results results = query.execute(); for (Result result : results.all()) { m_dsdCache.clear(result.getKey()); } }