List of usage examples for org.apache.commons.collections CollectionUtils filter
public static void filter(Collection collection, Predicate predicate)
From source file:org.medici.bia.common.access.ApplicationAccessContainer.java
private List<String> getTeachingJoined(boolean isAnonymous) { Collection<AccessDetail> joinedAccessDetails = getAllJoined(isAnonymous); CollectionUtils.filter(joinedAccessDetails, new Predicate() { @Override//from ww w . jav a 2s . com public boolean evaluate(Object object) { AccessDetail detail = (AccessDetail) object; return detail.isTeachingOnline(); } }); return getJoinedIds(joinedAccessDetails, isAnonymous); }
From source file:org.metaabm.commands.SetLabelCommand.java
public SetLabelCommand(final EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index) { super(domain, owner, feature, value, index); source = (IID) owner;/*from www . j a v a2 s . c om*/ translators = new ArrayList<TargetTranslator>(translatorsFor(source, feature)); CollectionUtils.filter(translators, new org.apache.commons.collections.Predicate() { public boolean evaluate(Object object) { boolean includeFor = ((TargetTranslator) object).includeFor(domain, source); return includeFor; } }); }
From source file:org.mifos.customers.persistence.CustomerPersistence.java
public Integer getActiveBorrowersCountForOffice(final OfficeBO office) throws PersistenceException { List<ClientBO> clients = runQueryForOffice(NamedQueryConstants.GET_ACTIVE_BORROWERS_COUNT_UNDER_OFFICE, office);//from w ww.ja v a2 s .c om CollectionUtils.filter(clients, CLIENTS_WITH_ACTIVE_LOAN_ACCOUNTS); return clients.size(); }
From source file:org.mifos.customers.persistence.CustomerPersistence.java
public Integer getVeryPoorActiveBorrowersCountForOffice(final OfficeBO office) throws PersistenceException { List<ClientBO> veryPoorActiveBorrowers = runQueryForOffice( NamedQueryConstants.GET_VERY_POOR_ACTIVE_BORROWERS_COUNT_UNDER_OFFICE, office); CollectionUtils.filter(veryPoorActiveBorrowers, CLIENTS_WITH_ACTIVE_LOAN_ACCOUNTS); return veryPoorActiveBorrowers.size(); }
From source file:org.mifos.customers.persistence.CustomerPersistence.java
public Integer getCustomerReplacementsCountForOffice(final OfficeBO office, final Short fieldId, final String fieldValue) throws PersistenceException { List<ClientBO> clients = runQueryForOffice(NamedQueryConstants.GET_CUSTOMER_REPLACEMENTS_COUNT_UNDER_OFFICE, office);//from w w w.ja v a 2 s . co m CollectionUtils.filter(clients, new FieldStatePredicate(fieldId, fieldValue)); return clients.size(); }
From source file:org.mifos.customers.persistence.CustomerPersistence.java
public Integer getVeryPoorReplacementsCountForOffice(final OfficeBO office, final Short fieldId, final String fieldValue) throws PersistenceException { List<ClientBO> veryPoorClients = runQueryForOffice(NamedQueryConstants.GET_VERY_POOR_CLIENTS_UNDER_OFFICE, office);// ww w .java 2 s. c om CollectionUtils.filter(veryPoorClients, new FieldStatePredicate(fieldId, fieldValue)); return veryPoorClients.size(); }
From source file:org.mifos.customers.persistence.CustomerPersistence.java
public Integer getActiveSaversCountForOffice(final OfficeBO office) throws PersistenceException { List<ClientBO> clients = runQueryForOffice(NamedQueryConstants.GET_ACTIVE_SAVERS_COUNT_UNDER_OFFICE, office);/* www .j ava 2 s. c o m*/ CollectionUtils.filter(clients, CLIENTS_WITH_ACTIVE_SAVINGS_ACCOUNT); return clients.size(); }
From source file:org.mifos.customers.persistence.CustomerPersistence.java
public Integer getVeryPoorActiveSaversCountForOffice(final OfficeBO office) throws PersistenceException { List<ClientBO> clients = runQueryForOffice( NamedQueryConstants.GET_VERY_POOR_ACTIVE_SAVERS_COUNT_UNDER_OFFICE, office); CollectionUtils.filter(clients, CLIENTS_WITH_ACTIVE_SAVINGS_ACCOUNT); return clients.size(); }
From source file:org.motechproject.server.model.ghana.Facility.java
public List<String> getAvailablePhoneNumbers() { List<String> phoneNumbers = Arrays.asList(phoneNumber, additionalPhoneNumber1, additionalPhoneNumber2, additionalPhoneNumber3);//from w w w . j a va2s . com phoneNumbers = new ArrayList<String>(phoneNumbers); CollectionUtils.filter(phoneNumbers, new Predicate() { public boolean evaluate(Object input) { if (input instanceof String) { return StringUtils.isNotBlank((String) input); } return false; } }); return phoneNumbers; }
From source file:org.ngrinder.user.controller.UserController.java
/** * Search user list on the given keyword. * * @param pageable page info//w w w. ja v a 2 s. co m * @param keywords search keyword. * @return json message */ @RestAPI @RequestMapping(value = "/api/search", method = RequestMethod.GET) public HttpEntity<String> search(User user, @PageableDefaults Pageable pageable, @RequestParam(required = true) String keywords) { pageable = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), defaultIfNull(pageable.getSort(), new Sort(Direction.ASC, "userName"))); Page<User> pagedUser = userService.getPagedAll(keywords, pageable); List<UserSearchResult> result = newArrayList(); for (User each : pagedUser) { result.add(new UserSearchResult(each)); } final String currentUserId = user.getUserId(); CollectionUtils.filter(result, new Predicate() { @Override public boolean evaluate(Object object) { UserSearchResult each = (UserSearchResult) object; return !(each.getId().equals(currentUserId) || each.getId().equals(ControllerConstants.NGRINDER_INITIAL_ADMIN_USERID)); } }); return toJsonHttpEntity(result); }