docs: protected synchronized String getFileName(Map result, String fileType) {
          String exname = getExName(result);
          String crid;
          if (getValueOr(result, "seasonal_dome_applied", "N").equals("Y")) {
              crid = "SN";
          } else {
              crid = getCrid(result);
          }
          if (exname.length() == 10) {
              if (crid.equals("XX") || crid.equals("FA")) {
                  crid = exname.substring(exname.length() - 2, exname.length());
              }
          }
  
          String ret;
          if (exToFileMap.containsKey(exname + "_" + crid)) {
              return exToFileMap.get(exname + "_" + crid) + fileType;
          } else {
              ret = exname;
              if (ret.equals("")) {
                  ret = "TEMP0001";
              } else {
                  try {
                      if (ret.endsWith(crid)) {
                          ret = ret.substring(0, ret.length() - crid.length());
                      }
                      // If the exname is too long
                      if (ret.length() > 8) {
                          ret = ret.substring(0, 8);
                      }
                      // If the exname do not follow the Dssat rule
                      if (!ret.matches("[\\w ]{1,6}\\d{2}$")) {
                          if (ret.length() > 6) {
                              ret = ret.substring(0, 6);
                          }
                          ret += "01";
                      }
                  } catch (Exception e) {
                      ret = "TEMP0001";
                  }
              }
  
              // Special handling for batch
              if (exname.matches(".+_\\d+_b\\S+(__\\d+)?$")) {
                  int idx = exname.lastIndexOf("_b") + 2;
                  ret += "B" + exname.substring(idx).replaceAll("__\\d+$", "");
              }
  
              // Find a non-repeated file name
              int count;
              while (fileNameSet.contains(ret + "." + crid)) {
                  try {
                      count = Integer.parseInt(ret.substring(ret.length() - 2, ret.length()));
                      count++;
                  } catch (Exception e) {
                      count = 1;
                  }
                  ret = ret.replaceAll("\\w{2}$", String.format("%02d", count));
              }
          }
  
          exToFileMap.put(exname + "_" + crid, ret + "." + crid);
          fileNameSet.add(ret + "." + crid);
  
          return ret + "." + crid + fileType;
      }