void completeShow(Rule rule, JsonWriter json) {
   json.name("actives").beginArray();
   for (ActiveRule activeRule : loader.findActiveRulesByRule(rule.key())) {
     writeActiveRule(activeRule, json);
   }
   json.endArray();
 }
  void completeSearch(RuleQuery query, Collection<Rule> rules, JsonWriter json) {
    json.name("actives").beginObject();

    String profileKey = query.getQProfileKey();
    if (profileKey != null) {
      // Load details of active rules on the selected profile
      for (Rule rule : rules) {
        ActiveRule activeRule = loader.getActiveRule(ActiveRuleKey.of(profileKey, rule.key()));
        if (activeRule != null) {
          writeActiveRules(rule.key(), Arrays.asList(activeRule), json);
        }
      }
    } else {
      // Load details of all active rules
      for (Rule rule : rules) {
        writeActiveRules(rule.key(), loader.findActiveRulesByRule(rule.key()), json);
      }
    }
    json.endObject();
  }