public ByteArrayResource zipDashboard()

in src/main/java/com/epam/digital/data/platform/reportexporter/service/DashboardArchiver.java [53:66]


  public ByteArrayResource zipDashboard(Page<Query> queries, Dashboard dashboard) {
    log.info("Creating zip archive for dashboard with slug {}", dashboard.getSlug());
    var zip = zip(queries, dashboard);

    try {
      var zipBytes = FileUtils.readFileToByteArray(zip);
      return new ByteArrayResource(zipBytes);
    } catch (Exception e) {
      log.error("Error during converting zip to byte array for dashboard slug {}", dashboard.getSlug());
      throw new DashboardZippingException("Could not zip dashboard", e);
    } finally {
      zip.delete();
    }
  }