public static boolean matchUrl ( Account account , String url ) { for ( AccountPatternData pattern : account . getPatterns ( ) ) { AccountPatternType type = pattern . getType ( ) ; if ( type == AccountPatternType . REGEX ) { if ( regexMatch ( pattern . getPattern ( ) , url ) ) return true ; } else if ( type == AccountPatternType . WILDCARD ) { if ( globMatch ( pattern . getPattern ( ) , url ) ) return true ; } else { Logger logger = Logger . getLogger ( AccountPatternMatcher . class . getName ( ) ) ; logger . warning ( "Unknown pattern match type '" + type . toString ( ) + "' for account '" + account . getName ( ) + "' id='" + account . getId ( ) + "'" ) ; // meh } } return account . getUrl ( ) . equalsIgnoreCase ( url ) ; }
Tests all patterns in an account for a match against the url string .