当前位置: 首页>>代码示例>>Java>>正文


Java Predicates.equal方法代码示例

本文整理汇总了Java中com.hazelcast.query.Predicates.equal方法的典型用法代码示例。如果您正苦于以下问题:Java Predicates.equal方法的具体用法?Java Predicates.equal怎么用?Java Predicates.equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hazelcast.query.Predicates的用法示例。


在下文中一共展示了Predicates.equal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findByFilters

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Collection<LogBean> findByFilters(JsonNode jsonNode) {
	Iterator<String> fieldNames = jsonNode.fieldNames();
	Predicate<String, LogBean> predicate = null;
	while(fieldNames.hasNext()) {
		String field = fieldNames.next();
		String value = jsonNode.get(field).asText();

		Predicate<String, LogBean> tmp = Predicates.equal(field, value);
		if(predicate == null) {
			predicate = tmp;
		} else {
			predicate = Predicates.and(predicate, tmp);
		}
	}
	return logRepository.findByPredicate(predicate);
}
 
开发者ID:Mockenize,项目名称:mockenize-server,代码行数:18,代码来源:LoggingService.java

示例2: getLastPartKeyForUri

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
public DocumentKey getLastPartKeyForUri(String uri) {
	IMap<DocumentKey, Document> xdd = nodeEngine.getHazelcastInstance().getMap(CN_XDM_DOCUMENT);
	Predicate<DocumentKey, Document> pp = new PartitionPredicate(uri.hashCode(), Predicates.equal("uri", uri));
	Set<DocumentKey> keys = xdd.keySet(pp);
	DocumentKey last = null;
	for (DocumentKey key: keys) {
		if (last == null) {
			last = key;
		} else {
			if (key.getVersion() > last.getVersion()) {
				last = key;
			}
		}
	}
	// alternatively, can run it on partition via QueryPartitionOperation:
	//QueryPartitionOperation op = new QueryPartitionOperation(query);
	//op.setMapService(svc);
	//int partId = nodeEngine.getPartitionService().getPartitionId(uri.hashCode());
	//op.setPartitionId(partId);
	//op.beforeRun();
	//op.run();
	//QueryResult rs = (QueryResult) op.getResponse();
	logger.trace("getLastPartKeyForUri; uri: {}; returning: {}", uri, last);
	return last;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:26,代码来源:DataDistributionService.java

示例3: getLastDocumentForUri

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
public Document getLastDocumentForUri(String uri) {
	MapService svc = nodeEngine.getService(MapService.SERVICE_NAME);
	MapServiceContext mapCtx = svc.getMapServiceContext();
	Query query = new Query(CN_XDM_DOCUMENT, Predicates.equal("uri", uri), IterationType.VALUE, null, null);
	try {
		Document last = null;
		QueryResult rs = (QueryResult) mapCtx.getMapQueryRunner(CN_XDM_DOCUMENT).runIndexOrPartitionScanQueryOnOwnedPartitions(query);
		for (QueryResultRow row: rs.getRows()) {
			Document doc = nodeEngine.toObject(row.getValue());
			if (last == null) {
				last = doc;
			} else {
				if (doc.getVersion() > last.getVersion()) {
					last = doc;
				}
			}
		}
		logger.trace("getLastDocumentForUri; uri: {}; returning: {}", uri, last);
		return last;
	} catch (ExecutionException | InterruptedException ex) {
		logger.error("getLastDocumentForUri.error: ", ex);
	}
	return null;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:25,代码来源:DataDistributionService.java

示例4: getElementKeys

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
public Collection<DataKey> getElementKeys(long docId) {
	MapService svc = nodeEngine.getService(MapService.SERVICE_NAME);
	MapServiceContext mapCtx = svc.getMapServiceContext();
	Query query = new Query(CN_XDM_ELEMENT, Predicates.equal("__key#documentKey", docId), IterationType.KEY, null, null);
	Collection<DataKey> result = null;
	try {
		QueryResult rs = (QueryResult) mapCtx.getMapQueryRunner(CN_XDM_ELEMENT).runIndexOrPartitionScanQueryOnOwnedPartitions(query);
		result = new ArrayList<>(rs.size());
		for (QueryResultRow row: rs.getRows()) {
			result.add((DataKey) nodeEngine.toObject(row.getKey()));
		}
		return result;
	} catch (ExecutionException | InterruptedException ex) {
		logger.error("getElementKeys.error", ex);
	}
	return result;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:18,代码来源:DataDistributionService.java

示例5: getElements

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
public Map<DataKey, Elements> getElements(long docId) {
	MapService svc = nodeEngine.getService(MapService.SERVICE_NAME);
	MapServiceContext mapCtx = svc.getMapServiceContext();
	Query query = new Query(CN_XDM_ELEMENT, Predicates.equal("__key#documentKey", docId), IterationType.ENTRY, null, null);
	Map<DataKey, Elements> result = null;
	try {
		QueryResult rs = (QueryResult) mapCtx.getMapQueryRunner(CN_XDM_ELEMENT).runIndexOrPartitionScanQueryOnOwnedPartitions(query);
		result = new HashMap<>(rs.size());
		for (QueryResultRow row: rs.getRows()) {
			result.put((DataKey) nodeEngine.toObject(row.getKey()), (Elements) nodeEngine.toObject(row.getValue()));
		}
		return result;
	} catch (ExecutionException | InterruptedException ex) {
		logger.error("getElementKeys.error", ex);
	}
	return result;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:18,代码来源:DataDistributionService.java

示例6: fromEqualityVariant

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
private Predicate<?, ?> fromEqualityVariant(Type type, boolean ignoreCase, String property,
		Iterator<Comparable<?>> iterator) {

	switch (type) {

		case SIMPLE_PROPERTY:
			if (ignoreCase) {
				return Predicates.ilike(property, iterator.next().toString());
			} else {
				return Predicates.equal(property, iterator.next());
			}

		default:
			throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
	}
}
 
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:17,代码来源:HazelcastQueryCreator.java

示例7: query

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
@TimeStep(prob = -1)
public void query(ThreadState state, Probe probe, @StartNanos long startNanos) {
    int key = state.getRandomKey();
    Predicate predicate = Predicates.equal("payloadField[any]", key);
    Collection<Object> result = null;
    try {
        result = map.values(predicate);
    } finally {
        probe.done(startNanos);
    }

    if (throttlingLogger.requestLogSlot()) {
        throttlingLogger.logInSlot(Level.INFO,
                format("Query 'payloadField[any]= %d' returned %d results.", key, result.size()));
    }

    for (Object resultSillySequence : result) {
        state.assertValidSequence(resultSillySequence);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-simulator,代码行数:21,代码来源:MultiValueMapTest.java

示例8: toPredicate

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static Predicate<DocumentKey, Document> toPredicate(SchemaRepository repo, String query) {
	if (query.startsWith("collections.contains")) {
		String clName = query.substring(21, query.length() - 1);
		Collection cln = repo.getSchema().getCollection(clName);
		if (cln == null) {
			return null;
		}
		return new CollectionPredicate(cln.getId());
	}
	
	int pos = query.indexOf(" ");
	if (pos > 0) {
		String attr = query.substring(0, pos); 
		int pos2 = query.indexOf(" ", pos + 1);
		if (pos2 > 0) {
			Comparison comp = toComparison(query.substring(pos, pos2).trim());
			if (comp != null) {
				String val = query.substring(pos2);
				Comparable<?> value = toValue(attr, val.trim());
				//logger.trace("toPredicate; got predicate parts: {} {} {}", attr, comp, value);
				switch (comp) {
					case EQ: return Predicates.equal(attr, value);
					case NE: return Predicates.notEqual(attr, value);
					case GT: return Predicates.greaterThan(attr, value);
					case GE: return Predicates.greaterEqual(attr, value);
					case LT: return Predicates.lessThan(attr, value);
					case LE: return Predicates.lessEqual(attr, value);
					case LIKE: return Predicates.like(attr, value.toString());
				}
			}
		}
	}
	return null;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:36,代码来源:DocumentPredicateBuilder.java

示例9: aggregatePath

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
@ManagedOperation(description="Calculates the number of unique values on the path specified")
@ManagedOperationParameters({
	@ManagedOperationParameter(name = "pathId", description = "The path identifier to aggregate on")})
public int aggregatePath(int pathId) {

	IMap<DataKey, Elements> elts = hzClient.getMap(CN_XDM_ELEMENT);
	Predicate<DataKey, Elements> q = Predicates.equal("pathId", pathId);
	Set<DataKey> keys = elts.keySet(q);
	if (keys.size() > 0) {
		q = Predicates.and(Predicates.equal("pathId", pathId), new GroupCountPredicate());
		elts.keySet(q);
	}
	return keys.size();
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:15,代码来源:ModelManagement.java

示例10: getLastKeyForUri

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
public DocumentKey getLastKeyForUri(String uri) {
	MapService svc = nodeEngine.getService(MapService.SERVICE_NAME);
	MapServiceContext mapCtx = svc.getMapServiceContext();
	Query query = new Query(CN_XDM_DOCUMENT, Predicates.equal("uri", uri), IterationType.KEY, null, null);
	try {
		DocumentKey last = null;
		QueryResult rs = (QueryResult) mapCtx.getMapQueryRunner(CN_XDM_DOCUMENT).runIndexOrPartitionScanQueryOnOwnedPartitions(query);
		for (QueryResultRow row: rs.getRows()) {
			DocumentKey key = nodeEngine.toObject(row.getKey());
			if (last == null) {
				last = key;
			} else {
				if (key.getVersion() > last.getVersion()) {
					last = key;
				}
			}
		}
		logger.trace("getLastKeyForUri; uri: {}; returning: {}", uri, last);
		return last;
	} catch (ExecutionException | InterruptedException ex) {
		logger.error("getLastKeyForUri.error: ", ex);
	}
	return null;
	//List<DocumentKey> keys = getCachedObject(CN_XDM_KEY, new UrlHashKey(uri), true);
	//if (keys != null) {
	//	return keys.get(keys.size() - 1);
	//}
	//return null;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:30,代码来源:DataDistributionService.java

示例11: getPathInternal

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
private Path getPathInternal(int pathId) {
	Predicate<String, Path> f = Predicates.equal("pathId", pathId);
	Collection<Path> entries = pathCache.values(f);
	if (entries.isEmpty()) {
		return null;
	}
	// check size > 1 ??
	return entries.iterator().next();
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:10,代码来源:ModelManagementImpl.java

示例12: getTypePathsInternal

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
private Set<Path> getTypePathsInternal(String root) {
	Predicate<String, Path> f = Predicates.equal("root", root);
	Collection<Path> entries = pathCache.values(f);
	if (entries.isEmpty()) {
		return Collections.emptySet();
	}
	// check size > 1 ??
	Set<Path> result = new HashSet<>(entries);
	//Collections.sort(result);
	//if (logger.isTraceEnabled()) {
	//	logger.trace("getTypePath; returning {} for type {}", result, typeId);
	//}
	return result;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:15,代码来源:ModelManagementImpl.java

示例13: getStatisticSeries

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public TabularData getStatisticSeries() {
	// return InProgress Transactions here!?
  		Predicate<Long, Transaction> f = Predicates.equal("txState", TransactionState.started);
	Collection<Transaction> txStarted = txCache.values(f);
	if (txStarted == null || txStarted.isEmpty()) {
		return null;
	}
	
       TabularData result = null;
   	String desc = "InProgress Transactions";
   	String name = "InProgress Transactions";
   	String header = "txId"; 
       for (Transaction xTx: txStarted) {
           try {
               Map<String, Object> txStats = xTx.convert();
               //stats.put(header, entry.getKey());
               CompositeData data = JMXUtils.mapToComposite(name, desc, txStats);
               result = JMXUtils.compositeToTabular(name, desc, header, result, data);
           } catch (Exception ex) {
               logger.error("getStatisticSeries; error", ex);
           }
       }
       //logger.trace("getStatisticSeries.exit; returning: {}", result);
       return result;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:28,代码来源:TransactionManagementImpl.java

示例14: fromBooleanVariant

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
private Predicate<?, ?> fromBooleanVariant(Type type, String property) {

		switch (type) {

			case TRUE:
				return Predicates.equal(property, true);
			case FALSE:
				return Predicates.equal(property, false);

			default:
				throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
		}
	}
 
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:14,代码来源:HazelcastQueryCreator.java

示例15: fromNullVariant

import com.hazelcast.query.Predicates; //导入方法依赖的package包/类
private Predicate<?, ?> fromNullVariant(Type type, String property) {

		switch (type) {

			case IS_NULL:
				return Predicates.equal(property, null);
			case IS_NOT_NULL:
				return Predicates.notEqual(property, null);

			default:
				throw new InvalidDataAccessApiUsageException(String.format("Logic error for '%s' in query", type));
		}
	}
 
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:14,代码来源:HazelcastQueryCreator.java


注:本文中的com.hazelcast.query.Predicates.equal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。