Class GroupPatternMatcher


  • public class GroupPatternMatcher
    extends java.lang.Object
    Matcher of group to ant-style pattern. We support * as arbitrary characters within group name, ** as arbitrary subgroups. E.g.:
     /tenants/** /users matches: /tenant/foo/bar/users and /tenant/foo/users
     /tenants/grp* /users matches: /tenant/grpOther/users but not /tenant/grpOther/foo/users
     
    Author:
    K. Benedyczak
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<pl.edu.icm.unity.types.basic.Group> filterByIncludeGroupsMode​(java.util.List<pl.edu.icm.unity.types.basic.Group> allGroups, pl.edu.icm.unity.types.registration.GroupRegistrationParam.IncludeGroupsMode mode)  
      static java.util.List<pl.edu.icm.unity.types.basic.Group> filterMatching​(java.util.List<pl.edu.icm.unity.types.basic.Group> allGroups, java.lang.String pattern)  
      static java.util.List<pl.edu.icm.unity.types.basic.Group> filterMatching​(java.util.List<pl.edu.icm.unity.types.basic.Group> allGroups, java.util.Collection<java.lang.String> filter)  
      static boolean isValidPattern​(java.lang.String groupPath)  
      static boolean matches​(java.lang.String group, java.lang.String pattern)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GroupPatternMatcher

        public GroupPatternMatcher()
    • Method Detail

      • matches

        public static boolean matches​(java.lang.String group,
                                      java.lang.String pattern)
      • filterMatching

        public static java.util.List<pl.edu.icm.unity.types.basic.Group> filterMatching​(java.util.List<pl.edu.icm.unity.types.basic.Group> allGroups,
                                                                                        java.lang.String pattern)
        Returns:
        list of those Group objects from allGroups which are matching the given pattern
      • filterByIncludeGroupsMode

        public static java.util.List<pl.edu.icm.unity.types.basic.Group> filterByIncludeGroupsMode​(java.util.List<pl.edu.icm.unity.types.basic.Group> allGroups,
                                                                                                   pl.edu.icm.unity.types.registration.GroupRegistrationParam.IncludeGroupsMode mode)
        Returns:
        list of those Group objects from allGroups which are matching to the given group access mode
      • filterMatching

        public static java.util.List<pl.edu.icm.unity.types.basic.Group> filterMatching​(java.util.List<pl.edu.icm.unity.types.basic.Group> allGroups,
                                                                                        java.util.Collection<java.lang.String> filter)
        Returns:
        list of those Group objects from allGroups which are in filter list
      • isValidPattern

        public static boolean isValidPattern​(java.lang.String groupPath)