value = primitiveOrString(r.getKey()); } else if (attr == Query.VALUE) { value = primitiveOrString(r.getValue()); } else { value = r.getAttribute(attr); if (value != null && value.getClass().isEnum()) { value = ((Enum)value).name(); value = r.getAggregatorResults().get(aggregateIndex++);
public Object getKey() throws SearchException { return result.getKey(); }
/** * 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; }
public <T> T getAttribute(Attribute<T> attribute) throws SearchException { return result.getAttribute(attribute); }
public List<Object> getAggregatorResults() throws SearchException { return result.getAggregatorResults(); } }
final List<Result> queryResults = query.execute().all(); for (Result r : queryResults) { membershipCache.remove(r.getKey());
/** * 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; }
value = primitiveOrString(r.getKey()); } else if (attr == Query.VALUE) { value = primitiveOrString(r.getValue()); } else { value = r.getAttribute(attr); if (value != null && value.getClass().isEnum()) { value = ((Enum)value).name(); value = r.getAggregatorResults().get(aggregateIndex++);
final List<Result> queryResults = query.execute().all(); for (Result r : queryResults) { membershipCache.remove(r.getKey());
/** * 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); if (value != null && value.getClass().isEnum()) { value = ((Enum)value).name(); value = r.getAggregatorResults().get(aggregateIndex++);
/** * 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()); } }
for (Result result : results.all()) DsdCacheEntry entry = (DsdCacheEntry) result.getValue(); if (!entry.isEmpty())
for (Result result : results.all()) DsdCacheEntry entry = (DsdCacheEntry) result.getValue();