core/src/main/java/com/digitalpebble/stormcrawler/filtering/regex/RegexURLNormalizer.java
private List<Rule> readRules(ArrayNode rulesList) {
        List<Rule> rules = new ArrayList<>();
        for (JsonNode regexNode : rulesList) {
            if (regexNode == null || regexNode.isNull()) {
                LOG.warn("bad config: 'regex' element is null");
                continue;
            }
            JsonNode patternNode = regexNode.get("pattern");
            JsonNode substitutionNode = regexNode.get("substitution");

            String substitutionValue = "";
            if (substitutionNode != null) {
                substitutionValue = substitutionNode.asText();
            }
            if (patternNode != null
                    && StringUtils.isNotBlank(patternNode.asText())) {
                Rule rule = createRule(patternNode.asText(), substitutionValue);
                if (rule != null) {
                    rules.add(rule);
                }
            }
        }
        if (rules.size() == 0) {
            rules = EMPTY_RULES;
        }
        return rules;
    }
private List<Rule> readRules(ArrayNode rulesList) {
        List<Rule> rules = new ArrayList<>();
        for (JsonNode regexNode : rulesList) {
            if (regexNode == null || regexNode.isNull()) {
                LOG.warn("bad config: 'regex' element is null");
                continue;
            }
            JsonNode patternNode = regexNode.get("pattern");
            JsonNode substitutionNode = regexNode.get("substitution");

            String substitutionValue = "";
            if (substitutionNode != null) {
                substitutionValue = substitutionNode.asText();
            }
            if (patternNode != null
                    && StringUtils.isNotBlank(patternNode.asText())) {
                Rule rule = createRule(patternNode.asText(), substitutionValue);
                if (rule != null) {
                    rules.add(rule);
                }
            }
        }
        if (rules.size() == 0) {
            rules = EMPTY_RULES;
        }
        return rules;
    }
private List < Rule > readRules ( ArrayNode rulesList ) { List < Rule > rules = new ArrayList <> ( ) ; for ( JsonNode regexNode : rulesList ) { if ( regexNode == null || regexNode . isNull ( ) ) { LOG . warn ( "bad config: 'regex' element is null" ) ; continue ; } JsonNode patternNode = regexNode . get ( "pattern" ) ; JsonNode substitutionNode = regexNode . get ( "substitution" ) ; String substitutionValue = "" ; if ( substitutionNode != null ) { substitutionValue = substitutionNode . asText ( ) ; } if ( patternNode != null && StringUtils . isNotBlank ( patternNode . asText ( ) ) ) { Rule rule = createRule ( patternNode . asText ( ) , substitutionValue ) ; if ( rule != null ) { rules . add ( rule ) ; } } } if ( rules . size ( ) == 0 ) { rules = EMPTY_RULES ; } return rules ; }
Populates a List of Rules off of JsonNode.
Populates a List of Rules off of JsonNode .