private void setCurrentName(final String original_value, 
      final String extracted_value) {

    // now parse and set the display name. If the formatter is empty, we just 
    // set it to the parsed value and exit
    String format = rule.getDisplayFormat();
    if (format == null || format.isEmpty()) {
      current_branch.setDisplayName(extracted_value);
      return;
    }
    
    if (format.contains("{ovalue}")) {
      format = format.replace("{ovalue}", original_value);
    }
    if (format.contains("{value}")) {
      format = format.replace("{value}", extracted_value);
    }
    if (format.contains("{tsuid}")) {
      format = format.replace("{tsuid}", meta.getTSUID());
    }
    if (format.contains("{tag_name}")) {
      final TreeRuleType type = rule.getType();
      if (type == TreeRuleType.TAGK) {
        format = format.replace("{tag_name}", rule.getField());
      } else if (type == TreeRuleType.METRIC_CUSTOM ||
          type == TreeRuleType.TAGK_CUSTOM ||
          type == TreeRuleType.TAGV_CUSTOM) {
        format = format.replace("{tag_name}", rule.getCustomField());
      } else {
        // we can't match the {tag_name} token since the rule type is invalid
        // so we'll just blank it
        format = format.replace("{tag_name}", "");
        LOG.warn("Display rule " + rule + 
          " was of the wrong type to match on {tag_name}");
        if (test_messages != null) {
          test_messages.add("Display rule " + rule + 
              " was of the wrong type to match on {tag_name}");
        }
      }
    }
    current_branch.setDisplayName(format);
  }
private void setCurrentName ( final String original_value , final String extracted_value ) { String format = rule . getDisplayFormat ( ) ; if ( format == null || format . isEmpty ( ) ) { current_branch . setDisplayName ( extracted_value ) ; return ; } if ( format . contains ( "{ovalue}" ) ) { format = format . replace ( "{ovalue}" , original_value ) ; } if ( format . contains ( "{value}" ) ) { format = format . replace ( "{value}" , extracted_value ) ; } if ( format . contains ( "{tsuid}" ) ) { format = format . replace ( "{tsuid}" , meta . getTSUID ( ) ) ; } if ( format . contains ( "{tag_name}" ) ) { final TreeRuleType type = rule . getType ( ) ; if ( type == TreeRuleType . TAGK ) { format = format . replace ( "{tag_name}" , rule . getField ( ) ) ; } else if ( type == TreeRuleType . METRIC_CUSTOM || type == TreeRuleType . TAGK_CUSTOM || type == TreeRuleType . TAGV_CUSTOM ) { format = format . replace ( "{tag_name}" , rule . getCustomField ( ) ) ; } else { format = format . replace ( "{tag_name}" , "" ) ; LOG . warn ( "Display rule " + rule + " was of the wrong type to match on {tag_name}" ) ; if ( test_messages != null ) { test_messages . add ( "Display rule " + rule + " was of the wrong type to match on {tag_name}" ) ; } } } current_branch . setDisplayName ( format ) ; }
Processes the original and extracted values through the
{@code display_format} of the rule to determine a display name for the
branch or leaf.
@param original_value The original, raw value processed by the calling rule
@param extracted_value The post-processed value after the rule worked on it