public boolean retrieve()

in src/main/java/com/epam/digital/data/platform/restapi/core/service/FileService.java [89:117]


  public boolean retrieve(String instanceId, File file) {
    if (fileProcessing.isEnabled()) {
      log.info("Storing file '{}' from data to lowcode ceph bucket", file.getId());

      FileDataDto fileDataDto;
      try {
        fileDataDto = datafactoryFileDataStorageService.loadByKey(file.getId());
      } catch (FileNotFoundException ex) {
        log.warn("File not found ", ex);
        return false;
      }

      var content = getContent(fileDataDto.getContent());
      var calculatedChecksum = DigestUtils.sha256Hex(content);

      if (!StringUtils.equals(calculatedChecksum, file.getChecksum())) {
        log.error("The checksum stored in the database ({}) and calculated based on the retrieved "
                + "file object ({}) do not match. File id: '{}'",
            file.getChecksum(), calculatedChecksum, file.getId());
        return true;
      }

      fileDataDto.setContent(new ByteArrayInputStream(content));
      var lowcodeId = fileKeyProvider.generateKey(instanceId, file.getId());
      lowcodeFileDataStorageService.save(lowcodeId, fileDataDto);
    }

    return true;
  }