本文整理汇总了Java中net.sf.ehcache.search.Results.all方法的典型用法代码示例。如果您正苦于以下问题:Java Results.all方法的具体用法?Java Results.all怎么用?Java Results.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.ehcache.search.Results
的用法示例。
在下文中一共展示了Results.all方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanCaches
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
private void cleanCaches(ObjectId objectId, Instant fromVersion, Instant toVersion) {
Results results = getUidToDocumentCache().createQuery().includeKeys()
.includeAttribute(getUidToDocumentCache().getSearchAttribute("ObjectId"))
.includeAttribute(getUidToDocumentCache().getSearchAttribute("VersionFromInstant"))
.includeAttribute(getUidToDocumentCache().getSearchAttribute("VersionToInstant"))
.addCriteria(getUidToDocumentCache().getSearchAttribute("ObjectId")
.eq(objectId.toString()))
.addCriteria(getUidToDocumentCache().getSearchAttribute("VersionFromInstant")
.le((fromVersion != null ? fromVersion : InstantExtractor.MIN_INSTANT).toString()))
.addCriteria(getUidToDocumentCache().getSearchAttribute("VersionToInstant")
.ge((toVersion != null ? toVersion : InstantExtractor.MAX_INSTANT).toString()))
.execute();
for (Result result : results.all()) {
getUidToDocumentCache().remove(result.getKey());
}
}
示例2: searchPartitionKeys
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
private List searchPartitionKeys(final Query query) {
LinkedList<Object> keys = new LinkedList<Object>();
System.out.println("Starting search...");
long startTime = System.currentTimeMillis();
Results results = query.execute();
if(log.isDebugEnabled())
log.debug(String.format("Search time: %d ms", System.currentTimeMillis() - startTime));
// perform the refresh
for (Result result : results.all()) {
keys.add(result.getKey());
}
results.discard();
return keys;
}
示例3: fetchByCriteria
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
public Collection<T> fetchByCriteria( Criteria criteria ) {
net.sf.ehcache.search.Query query = this.cache.createQuery();
query.includeValues();
query.addCriteria( criteria );
Results results = null;
try {
results = query.execute();
} catch ( Exception e ) {
throw new SearchException( "Query error" );
}
if ( results == null ) {
return null;
}
Collection<T> genes = new HashSet<T>( results.size() );
for ( Result result : results.all() ) {
genes.add( ( T ) result.getValue() );
}
return genes;
}
示例4: getAces
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
private <T extends ControlEntry> List<T> getAces(String uid, CacheId cacheId) {
Cache cache = getCache(cacheId);
List<T> aces = new ArrayList<T>();
// here search on uid take place
Attribute<String> uidAttribute = cache.getSearchAttribute(UserDomainInterfaceOperationKey.USER_ID);
// query is the fastest if you search for keys and if you need value then call Cache.get(key)
Query queryRequestedUid = cache.createQuery().addCriteria(uidAttribute.eq(uid).or(uidAttribute.eq(WILDCARD)))
// have specific user ids appear before wildcards
.addOrderBy(uidAttribute, Direction.DESCENDING)
.includeKeys()
.end();
Results results = queryRequestedUid.execute();
for (Result result : results.all()) {
aces.add(DomainAccessControlStoreEhCache.<T> getElementValue(cache.get(result.getKey())));
}
return aces;
}
示例5: clearDsdCacheEntry
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
/**
* 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());
}
}
示例6: getDsdCache
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
/**
* Given a role name, return the set of DSD's that have a matching member.
*
* @param name contains name of authorized Role used to search the cache.
* @param contextId maps to sub-tree in DIT, e.g. ou=contextId, dc=example, dc=com.
* @return un-ordered set of matching DSD's.
* @throws SecurityException in the event of system or rule violation.
*/
private Set<SDSet> getDsdCache(String name, String contextId)
throws SecurityException
{
contextId = getContextId(contextId);
Set<SDSet> finalSet = new HashSet<>();
Attribute<String> context = m_dsdCache.getSearchAttribute(CONTEXT_ID);
Attribute<String> member = m_dsdCache.getSearchAttribute(SchemaConstants.MEMBER_AT);
Query query = m_dsdCache.createQuery();
query.includeKeys();
query.includeValues();
query.addCriteria(member.eq(name).and(context.eq(contextId)));
Results results = query.execute();
boolean empty = false;
for (Result result : results.all())
{
DsdCacheEntry entry = (DsdCacheEntry) result.getValue();
if (!entry.isEmpty())
{
finalSet.add(entry.getSdSet());
finalSet = putDsdCache(name, contextId);
}
else
{
empty = true;
}
finalSet.add(entry.getSdSet());
}
// If nothing was found in the cache, determine if it needs to be seeded:
if (finalSet.size() == 0 && !empty)
{
finalSet = putDsdCache(name, contextId);
}
return finalSet;
}
示例7: runTests
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
void runTests()
{
loadCache();
Attribute<String> member = cache.getSearchAttribute( "member" );
Query query = cache.createQuery();
query.includeKeys();
query.includeValues();
Set<String> roles = new HashSet<>();
roles.add( "oamt17dsd1" );
roles.add( "oamt17dsd4" );
roles.add( "oamT13DSD6" );
roles.add( "oamT16SDR7" );
query.addCriteria( member.in( roles ) );
Results results = query.execute();
System.out.println( " Size: " + results.size() );
System.out.println( "----Results-----\n" );
Set<SDSet> resultSet = new HashSet<>();
for ( Result result : results.all() )
{
DsdCacheEntry entry = ( DsdCacheEntry ) result.getValue();
resultSet.add( entry.getSdSet() );
}
for ( SDSet sdSet : resultSet )
{
LOG.info( "Found SDSet: " + sdSet.getName() );
}
}
示例8: getDomainRoles
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
@Override
public List<DomainRoleEntry> getDomainRoles(String uid) {
Cache cache = getCache(CacheId.DOMAIN_ROLES);
List<DomainRoleEntry> domainRoles = new ArrayList<DomainRoleEntry>();
Attribute<String> uidAttribute = cache.getSearchAttribute(UserRoleKey.USER_ID);
// query is the fastest if you search for keys and if you need value then call Cache.get(key)
Query queryRequestedUid = cache.createQuery().addCriteria(uidAttribute.eq(uid)).includeKeys().end();
Results results = queryRequestedUid.execute();
for (Result result : results.all()) {
domainRoles.add(DomainAccessControlStoreEhCache.<DomainRoleEntry> getElementValue(cache.get(result.getKey())));
}
return domainRoles;
}
示例9: getEditableAces
import net.sf.ehcache.search.Results; //导入方法依赖的package包/类
private <T extends ControlEntry> List<T> getEditableAces(String uid, CacheId cacheId, Role role) {
List<T> aces = new ArrayList<T>();
// find out first on which domains uid has specified role
Cache drtCache = getCache(CacheId.DOMAIN_ROLES);
UserRoleKey dreKey = new UserRoleKey(uid, role);
String[] uidDomains = null;
// read domains from DRE
if (drtCache.isKeyInCache(dreKey)) {
DomainRoleEntry dre = DomainAccessControlStoreEhCache.<DomainRoleEntry> getElementValue(drtCache.get(dreKey));
uidDomains = dre.getDomains();
}
// if uid has no domains with specified role return empty list
if (uidDomains == null || uidDomains.length == 0) {
return aces;
}
Cache cache = getCache(cacheId);
// here should search on uid and domain take place
Attribute<String> uidAttribute = cache.getSearchAttribute(UserDomainInterfaceOperationKey.USER_ID);
Attribute<String> domainAttribute = cache.getSearchAttribute(UserDomainInterfaceOperationKey.DOMAIN);
for (String domain : uidDomains) {
Query query = cache.createQuery()
.addCriteria(uidAttribute.eq(uid).and(domainAttribute.eq(domain)))
.includeKeys()
.end();
Results results = query.execute();
for (Result result : results.all()) {
aces.add(DomainAccessControlStoreEhCache.<T> getElementValue(cache.get(result.getKey())));
}
}
return aces;
}