Ejemplo n.º 1
0
  private Observable<Thing<Group>> createGroups(
      Multimap<String, String> groups, Optional<String> groupMatcher) {

    if (groupMatcher.isPresent()) {
      return Observable.from(groups.keySet())
          .filter(groupName -> MatcherUtils.wildCardMatch(groupName, groupMatcher.get()))
          .map(groupName -> um.getAllGroups().get(groupName))
          // TODO make that work for non-project groups too
          .filter(group -> group != null)
          .map(group -> wrapGroup(group));
    } else {
      return Observable.from(groups.keySet())
          .map(groupName -> um.getAllGroups().get(groupName))
          // TODO make that work for non-project groups too
          .filter(group -> group != null)
          .map(group -> wrapGroup(group));
    }
  }
Ejemplo n.º 2
0
 @Override
 public Observable<? extends Thing<?>> findThingsMatchingTypeAndKey(String type, String key) {
   return Observable.from(um.getAllGroups().values())
       .filter(g -> MatcherUtils.wildCardMatch(g.getGroupName(), key))
       .map(g -> wrapGroup(g));
 }