use of org.apache.commons.collections.Predicate in project pinot by linkedin.
the class PinotHelixResourceManager method getAllRealtimeTables.
public List<String> getAllRealtimeTables() {
List<String> ret = _helixAdmin.getResourcesInCluster(_helixClusterName);
CollectionUtils.filter(ret, new Predicate() {
@Override
public boolean evaluate(Object object) {
if (object == null) {
return false;
}
if (object.toString().endsWith("_" + ServerType.REALTIME.toString())) {
return true;
}
return false;
}
});
return ret;
}
use of org.apache.commons.collections.Predicate in project RESTdoclet by IG-Group.
the class MethodBuilder method initRestParams.
/**
* Initialises the REST-parameters of this method.
*
* @param method method to initialise
* @param methodDoc the method's Java documentation object.
* @param baseUri the controller base uri
*/
private void initRestParams(Method method, final MethodDoc methodDoc, final String baseUri) {
LOG.debug(method.getName());
ArrayList<RestParameter> restParams = new ArrayList<RestParameter>();
for (NameValuePair pair : new RequestMappingParamsParser(elementValue(methodDoc, RequestMapping.class, "params")).parse()) {
final Predicate predicate = new ParameterNamePredicate(pair.getName());
if (!CollectionUtils.exists(method.getRequestParams(), predicate)) {
LOG.debug(pair.getName() + " - " + pair.getValue());
restParams.add(new RestParameter(pair));
}
}
AnnotationValue urlAnnotation = elementValue(methodDoc, RequestMapping.class, "value");
if (urlAnnotation != null) {
Boolean deprecatedMatch = false;
String[] methodUris = parseValueAnnotation(urlAnnotation);
String[] deprecatedURIs = DocTypeUtils.getDeprecatedURIs(methodDoc);
for (final String uri : methodUris) {
LOG.debug("uri:" + baseUri + uri);
boolean deprecated = false;
if (deprecatedURIs != null) {
for (final String deprecatedUri : deprecatedURIs) {
LOG.debug("deprecated:" + deprecatedUri);
if (StringUtils.equals(deprecatedUri, uri)) {
LOG.debug("=DEPRECATED");
deprecated = true;
deprecatedMatch = true;
break;
}
}
}
method.getUris().add(new Uri(baseUri + uri, deprecated));
}
if (deprecatedURIs != null && !deprecatedMatch) {
LOG.warn("Deprecated URI tag on method " + methodDoc.name() + " does not match any service URIs.");
}
}
method.setRestParams(restParams);
}
use of org.apache.commons.collections.Predicate in project head by mifos.
the class BranchReportClientSummaryHelperIntegrationTest method assertClientSummary.
private void assertClientSummary(BranchReportBO branchReport) throws PersistenceException {
Assert.assertNotNull(branchReport.getBranchReportId());
Set<BranchReportClientSummaryBO> branchReportClientSummaries = branchReport.getClientSummaries();
Assert.assertNotNull(branchReportClientSummaries);
Assert.assertEquals(12, branchReportClientSummaries.size());
Predicate predicate = new BranchReportClientSummaryBatchBOExtractor().matchAllPredicates(branchReportClientSummaries);
Assert.assertNull(predicate + " not found in summaries", predicate);
}
use of org.apache.commons.collections.Predicate in project OpenAM by OpenRock.
the class SessionService method getValidInternalSessions.
/**
* Get all valid Internal Sessions.
*/
private List<InternalSession> getValidInternalSessions() {
synchronized (cache) {
List<InternalSession> sessions = new ArrayList<InternalSession>(cache.getAllSessions());
org.apache.commons.collections.CollectionUtils.filter(sessions, new Predicate() {
@Override
public boolean evaluate(Object o) {
// Apache Commons is old.
InternalSession s = (InternalSession) o;
if (s.getState() != VALID) {
return false;
}
if (s.isAppSession() && !serviceConfig.isReturnAppSessionEnabled()) {
return false;
}
return true;
}
});
return sessions;
}
}
use of org.apache.commons.collections.Predicate in project incubator-atlas by apache.
the class AtlasTypeDefGraphStore method searchTypesDef.
@Override
public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException {
final AtlasTypesDef typesDef = new AtlasTypesDef();
Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter);
for (AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) {
if (searchPredicates.evaluate(enumType)) {
typesDef.getEnumDefs().add(enumType.getEnumDef());
}
}
for (AtlasStructType structType : typeRegistry.getAllStructTypes()) {
if (searchPredicates.evaluate(structType)) {
typesDef.getStructDefs().add(structType.getStructDef());
}
}
for (AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) {
if (searchPredicates.evaluate(classificationType)) {
typesDef.getClassificationDefs().add(classificationType.getClassificationDef());
}
}
for (AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) {
if (searchPredicates.evaluate(entityType)) {
typesDef.getEntityDefs().add(entityType.getEntityDef());
}
}
return typesDef;
}
Aggregations