Example #1
0
  public void importXml(SonarConfig sonarConfig) {
    if (CollectionUtils.isNotEmpty(sonarConfig.getProfiles())) {
      ProfilesManager profilesManager = new ProfilesManager(session, null);
      profilesManager.deleteAllProfiles();

      RulesDao rulesDao = new RulesDao(session);
      for (RulesProfile profile : sonarConfig.getProfiles()) {
        importProfile(rulesDao, profile);
      }
    }
  }
Example #2
0
  public void exportXml(SonarConfig sonarConfig) {
    this.profiles =
        (this.profiles == null ? session.getResults(RulesProfile.class) : this.profiles);
    // the profiles objects must be cloned to avoid issues CGLib
    List<RulesProfile> cloned = new ArrayList<RulesProfile>();
    for (RulesProfile profile : this.profiles) {
      cloned.add((RulesProfile) profile.clone());
    }

    sonarConfig.setProfiles(cloned);
  }