private ActiveRuleType initializeActiveViolationTypes(RuleType ruleType) {
    final String ruleTypeKey = ruleType.getKey();
    List<ActiveViolationType> initialActiveViolationTypes = new ArrayList<ActiveViolationType>();

    for (ViolationType violationType : ruleType.getViolationTypes()) {
      final String violationTypeKey = violationType.getViolationtypeKey();
      boolean enabled = violationType.isActive();
      ActiveViolationType activeViolationType = new ActiveViolationType(violationTypeKey, enabled);
      initialActiveViolationTypes.add(activeViolationType);
    }
    ActiveRuleType activeRuleType = new ActiveRuleType(ruleTypeKey);
    activeRuleType.setViolationTypes(initialActiveViolationTypes);
    return activeRuleType;
  }
  private List<ActiveRuleType> checkNewActiveViolationTypes(
      String programmingLanguage, List<ActiveRuleType> newActiveViolationTypes) {
    List<ActiveRuleType> activeViolationTypesForLanguage = new ArrayList<ActiveRuleType>();

    for (ActiveRuleType newActiveRuleType : newActiveViolationTypes) {
      if (ruleTypeKeyExists(programmingLanguage, newActiveRuleType.getRuleType())) {

        List<ActiveViolationType> activeViolationTypes = new ArrayList<ActiveViolationType>();
        ActiveRuleType activeRuleType = new ActiveRuleType(newActiveRuleType.getRuleType());
        activeRuleType.setViolationTypes(activeViolationTypes);
        boolean foundViolationTypeKey = false;

        for (ActiveViolationType newActiveViolationType : newActiveRuleType.getViolationTypes()) {
          if (violationTypeKeyExists(
              programmingLanguage,
              newActiveRuleType.getRuleType(),
              newActiveViolationType.getType())) {
            foundViolationTypeKey = true;
            activeViolationTypes.add(
                new ActiveViolationType(
                    newActiveViolationType.getType(), newActiveViolationType.isEnabled()));
          } else {
            logger.debug(
                String.format("violationTypeKey %s not exists", newActiveViolationType.getType()));
          }
        }
        if (foundViolationTypeKey) {
          activeViolationTypesForLanguage.add(activeRuleType);
        }
      } else {
        logger.debug(
            String.format(
                "ruleTypeKey %s not exists in programminglanguage %s",
                newActiveRuleType.getRuleType(), programmingLanguage));
      }
    }
    return mergeNewViolationTypes(programmingLanguage, activeViolationTypesForLanguage);
  }