List of usage examples for org.apache.commons.collections Predicate Predicate
Predicate
From source file:com.sworddance.util.TestPredicatedTransformingIterator.java
@BeforeMethod() protected void setUp() { ints = new ArrayList<Integer>(); ints.add(0);//from ww w . j a va 2s .c om ints.add(1); ints.add(2); ints.add(3); ints.add(4); ints.add(5); predicate = new Predicate() { public boolean evaluate(Object object) { return ((Integer) object) % 2 == 0; } }; }
From source file:com.dp2345.service.impl.PluginServiceImpl.java
public List<PaymentPlugin> getPaymentPlugins(final boolean isEnabled) { List<PaymentPlugin> result = new ArrayList<PaymentPlugin>(); CollectionUtils.select(paymentPlugins, new Predicate() { public boolean evaluate(Object object) { PaymentPlugin paymentPlugin = (PaymentPlugin) object; return paymentPlugin.getIsEnabled() == isEnabled; }/*from w ww . j a va 2s . c o m*/ }, result); Collections.sort(result); return result; }
From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.ExternalUniversityUnitAutoCompleteProvider.java
@Override public Collection<Unit> getSearchResults(Map<String, String> argsMap, String value, int maxCount) { final List<Unit> result = new ArrayList<Unit>(); final YearMonthDay today = new YearMonthDay(); final Predicate predicate = new Predicate() { @Override/*from w ww . j av a 2 s. c om*/ public boolean evaluate(Object arg0) { final UnitName unitName = (UnitName) arg0; final Unit unit = unitName.getUnit(); return unit instanceof UniversityUnit && unit.isActive(today); } }; for (final UnitName unitName : UnitName.findExternalUnit(value, maxCount, predicate)) { final Unit unit = unitName.getUnit(); result.add(unit); } return result; }
From source file:au.org.emii.geoserver.extensions.filters.layer.data.io.FilterConfigurationWriter.java
private Predicate getPredicate() { return new Predicate() { public boolean evaluate(Object o) { return ((Filter) o).getEnabled().booleanValue(); }/*from w w w. j a va 2 s. com*/ }; }
From source file:com.redhat.rhn.frontend.security.BaseAuthenticationService.java
protected boolean requestPostCsfrWhitelist(final HttpServletRequest request) { return CollectionUtils.exists(getPostUnprotectedURIs(), new Predicate() { public boolean evaluate(Object uri) { return request.getRequestURI().startsWith(uri.toString()); }//from w w w. j a va 2 s. c om }); }
From source file:com.exxonmobile.ace.hybris.storefront.security.ExcludeUrlRequestMatcher.java
@Required public void setExcludeUrlSet(final Set<String> excludeUrlSet) { // Ensure only valid urls are added to the excludeUrlSet CollectionUtils.filter(excludeUrlSet, new Predicate() { @Override/*from ww w .java 2 s. c o m*/ public boolean evaluate(final Object object) { return (object != null) && (object instanceof String) && ((String) object).startsWith("/"); } }); this.excludeUrlSet = excludeUrlSet; }
From source file:net.sourceforge.fenixedu.applicationTier.Filtro.PublishedExamsMapAuthorizationFilter.java
private static void filterUnpublishedInformation(InfoSiteEvaluation infoSiteEvaluation) { // This code is usefull for when the exams are to be filtered from the // public execution course page. CollectionUtils.filter(infoSiteEvaluation.getInfoEvaluations(), new Predicate() { @Override//from ww w .ja v a 2 s .co m public boolean evaluate(Object arg0) { return !(arg0 instanceof InfoExam); } }); }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.teacher.onlineTests.DeleteTestQuestion.java
protected void run(String executionCourseId, String testId, final String questionId) throws InvalidArgumentsServiceException { Test test = FenixFramework.getDomainObject(testId); if (test == null) { throw new InvalidArgumentsServiceException(); }//w ww .j a va 2 s . co m TestQuestion testQuestion = (TestQuestion) CollectionUtils.find(test.getTestQuestionsSet(), new Predicate() { @Override public boolean evaluate(Object arg0) { final TestQuestion testQuestion = (TestQuestion) arg0; return testQuestion.getQuestion().getExternalId().equals(questionId); } }); if (testQuestion == null) { throw new InvalidArgumentsServiceException(); } test.deleteTestQuestion(testQuestion); }
From source file:com.xebialabs.xlrelease.ci.server.XLReleaseServerImplMock.java
@Override public List<Release> searchTemplates(final String s) { List<Release> templates = getAllTemplates(); CollectionUtils.filter(templates, new Predicate() { public boolean evaluate(Object o) { return ((Release) o).getTitle().contains(s); }//from w w w. j a va 2s . com }); LoggerFactory.getLogger(this.getClass()).info(templates + "\n"); return templates; }
From source file:com.cognifide.cq.cqsm.core.scripts.ScriptFilters.java
public static Predicate filterOnModify(final ResourceResolver resolver) { return new AllPredicate(new Predicate[] { filterExecutionEnabled(true), filterByExecutionMode(ExecutionMode.ON_MODIFY), new Predicate() { @Override//ww w .j a va 2 s. co m public boolean evaluate(Object o) { return ((Script) o).isContentModified(resolver); } } }); }