@Transactional
  public void run(IndicatorGeneratorGrouping indicatorGeneratorGrouping) throws AxelorException {

    String log = "";

    String result = "";

    for (IndicatorGenerator indicatorGenerator :
        indicatorGeneratorGrouping.getIndicatorGeneratorSet()) {

      indicatorGeneratorService.run(indicatorGenerator);

      result =
          result
              + "\n"
              + indicatorGenerator.getCode()
              + " "
              + indicatorGenerator.getName()
              + " : "
              + indicatorGenerator.getResult();

      if (indicatorGenerator.getLog() != null && !indicatorGenerator.getLog().isEmpty()) {
        log = log + "\n" + indicatorGenerator.getLog();
      }
    }

    indicatorGeneratorGrouping.setResult(result);

    indicatorGeneratorGrouping.setLog(log);

    save(indicatorGeneratorGrouping);
  }
  @Transactional
  public void export(IndicatorGeneratorGrouping indicatorGeneratorGrouping) throws AxelorException {

    String log = "";

    if (indicatorGeneratorGrouping.getPath() == null
        || indicatorGeneratorGrouping.getPath().isEmpty()) {

      log += I18n.get(IExceptionMessage.INDICATOR_GENERATOR_GROUPING_1);
    }

    if (indicatorGeneratorGrouping.getCode() == null
        || indicatorGeneratorGrouping.getCode().isEmpty()) {

      log += I18n.get(IExceptionMessage.INDICATOR_GENERATOR_GROUPING_2);
    }

    List<String[]> resultList = new ArrayList<String[]>();

    for (IndicatorGenerator indicatorGenerator :
        indicatorGeneratorGrouping.getIndicatorGeneratorSet()) {

      String[] result = {
        indicatorGenerator.getCode(), indicatorGenerator.getName(), indicatorGenerator.getResult()
      };

      resultList.add(result);

      log = log + "\n" + indicatorGenerator.getLog();
    }

    try {
      CsvTool.csvWriter(
          indicatorGeneratorGrouping.getPath(),
          indicatorGeneratorGrouping.getCode() + ".csv",
          ';',
          null,
          resultList);
    } catch (IOException e) {
      log += I18n.get(IExceptionMessage.INDICATOR_GENERATOR_GROUPING_3);
    }

    if (!log.isEmpty() && log.length() != 0) {
      String log2 = indicatorGeneratorGrouping.getLog();

      log2 += "\n ---------------------------------------------------";

      log2 += log;

      indicatorGeneratorGrouping.setLog(log2);
    }

    save(indicatorGeneratorGrouping);
  }