コード例 #1
0
 private void loadViolationType(String ruletypeKey) {
   for (RuleType ruletype : ruletypes) {
     if (ruletype.getKey().equals(ruletypeKey)) {
       clearModel(violationtypeModel);
       for (ViolationType violationtype : ruletype.getViolationTypes()) {
         violationtypeModel.addRow(
             new Object[] {violationtype.getViolationtypeKey(), 1, violationtype.isActive()});
       }
     }
   }
 }
コード例 #2
0
  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;
  }
コード例 #3
0
  private HashMap<String, HashMap<String, Severity>> initializeDefaultSeverityForLanguage(
      String programmingLanguage) {
    HashMap<String, HashMap<String, Severity>> severitiesPerTypePerProgrammingLanguage =
        new HashMap<String, HashMap<String, Severity>>();
    severitiesPerTypePerProgrammingLanguage.put(
        programmingLanguage, new HashMap<String, Severity>());
    for (Entry<String, List<RuleType>> entry :
        ruletypefactory.getRuleTypes(programmingLanguage).entrySet()) {
      HashMap<String, Severity> severityPerType =
          severitiesPerTypePerProgrammingLanguage.get(programmingLanguage);

      for (RuleType ruleType : entry.getValue()) {
        severityPerType.put(ruleType.getKey(), ruleType.getSeverity());

        for (ViolationType violationType : ruleType.getViolationTypes()) {
          severityPerType.put(violationType.getViolationtypeKey(), violationType.getSeverity());
        }
      }
    }

    return severitiesPerTypePerProgrammingLanguage;
  }