@Override public Collection getSearchResults(Map<String, String> argsMap, String value, int maxCount) { Set<User> users = new HashSet<User>(); String[] values = StringNormalizer.normalize(value).toLowerCase().split(" "); for (User user : MyOrg.getInstance().getUserSet()) { final String normalizedUser = StringNormalizer.normalize(user.getPresentationName()).toLowerCase(); if (hasMatch(values, normalizedUser)) { users.add(user); } } return users; }
@Override public Collection getSearchResults(Map<String, String> argsMap, String value, int maxCount) { List<Unit> units = new ArrayList<Unit>(); String[] input = value.split(" "); StringNormalizer.normalize(input); for (Unit unit : ExpenditureTrackingSystem.getInstance().getUnits()) { String unitName = StringNormalizer.normalize(unit.getName()); if (hasMatch(input, unitName)) { units.add(unit); } if (units.size() >= maxCount) { break; } } return units; }