List of usage examples for org.apache.commons.collections CollectionUtils selectRejected
public static Collection selectRejected(Collection inputCollection, Predicate predicate)
From source file:de.hybris.platform.accountsummaryaddon.document.populators.B2BAmountBalancePopulator.java
@Override public void populate(B2BUnitModel source, B2BAmountBalanceData target) throws ConversionException { final Map<B2BNumberOfDayRangeData, String> rangeMap = new LinkedHashMap<B2BNumberOfDayRangeData, String>(); final List<NumberOfDayRange> ranges = pastDueBalanceDateRangeService.getNumberOfDayRange(); final SearchResult<B2BDocumentModel> documentsResult = b2bDocumentService.getOpenDocuments(source); final List<B2BDocumentModel> documents = documentsResult.getResult(); for (final NumberOfDayRange dateRange : ranges) { final B2BNumberOfDayRangeData range = new B2BNumberOfDayRangeData(); range.setMinBoundery(dateRange.getMinBoundary()); range.setMaxBoundery(dateRange.getMaxBoundary()); rangeMap.put(range, totalAmount( CollectionUtils.select(documents, new B2BDocumentDueDateRangePredicate(dateRange)))); }/* w w w . j a va2 s .co m*/ target.setDueBalance(rangeMap); target.setOpenBalance(totalAmount(documents)); target.setPastDueBalance(totalAmount(CollectionUtils.select(documents, new B2BDocumentPastDuePredicate()))); target.setCurrentBalance( totalAmount(CollectionUtils.selectRejected(documents, new B2BDocumentPastDuePredicate()))); }
From source file:org.fl.modules.excel.jxl.JxlImportExcelRule.java
@Override public ExcelReturn validateExcelData() { Sheet sheet = workbook.getSheet(0);/*from w w w. ja va 2 s . co m*/ ExcelReturn excelReturn = new ExcelReturn(); try { boolean isSame = false; for (int row = 2; row < sheet.getRows(); row++) { Cell[] cells = sheet.getRow(row); columns = cells.length; List<ImportValidateRule> list = createImportValidateRules(createRowCellValue(cells)); ImportValidatePredicate firstNameEqlPredicate = new ImportValidatePredicate(); Predicate[] allPredicateArray = { firstNameEqlPredicate }; Predicate allPredicate = PredicateUtils.allPredicate(allPredicateArray); Collection<ImportValidateRule> filteredSuccessCollection = CollectionUtils.select(list, allPredicate); Collection<ImportValidateRule> filteredCollection = CollectionUtils.selectRejected(list, allPredicate); // excelReturn.getRightCollection().add(list); } } catch (Exception e) { e.printStackTrace(); } finally { workbook.close(); } return excelReturn; }
From source file:org.fl.modules.test.excel.PredicateChainExample.java
/** * Here we are adding multiple predicate * filters the collection so that final person object will contain * firstName as "ganesh" & lastName as "gowtham" *//*from ww w . j a v a2 s . c o m*/ void filterDataUsingMultipleCriteria() { // ImportValidateRule importValidateRule = new ImportValidateRule(); // importValidateRule.setAlias("?"); // importValidateRule.setIndex(0); // importValidateRule.setRule(Rule.emptyOrNull); ImportValidatePredicate firstNameEqlPredicate = new ImportValidatePredicate(); // firstNameEqlPredicate.setImportValidateRule(importValidateRule); Predicate[] allPredicateArray = { firstNameEqlPredicate }; Predicate allPredicate = PredicateUtils.allPredicate(allPredicateArray); Collection<ImportValidateRule> filteredSuccessCollection = CollectionUtils.select(personList, allPredicate); Collection<ImportValidateRule> filteredCollection = CollectionUtils.selectRejected(personList, allPredicate); // CollectionUtils.filter(personList, firstNameEqlPredicate); // for (ImportValidateRule person : personList) { // System.out.println(person.toString()); // } }
From source file:org.mule.api.routing.AggregationContext.java
/** * The exact opposite to {@link #collectEventsWithExceptions()} Returns all the * {@link MuleEvent}s which messages have a <code>null</code> * {@link ExceptionPayload} or a <code>null</code> * {@link ExceptionPayload#getException()}. Notice that this is a collect * operation. Each time this method is invoked the result will be re-calculated * /*from w w w . j a va2 s . c o m*/ * @return a list of {@link MuleEvent}. It could be empty but it will never be * <code>null</code> */ @SuppressWarnings("unchecked") public List<MuleEvent> collectEventsWithoutExceptions() { return (List<MuleEvent>) CollectionUtils.selectRejected(this.events, failedEventsPredicate); }