LinePdfFilePath
using kCura.WinEDDS;
using kCura.WinEDDS.Exporters;
using kCura.WinEDDS.LoadFileEntry;
using Relativity.DataExchange.Export.VolumeManagerV2.Directories;
using Relativity.DataExchange.Logger;
using Relativity.Logging;
using System;
namespace Relativity.DataExchange.Export.VolumeManagerV2.Metadata.Pdfs
{
public class LinePdfFilePath : ILinePdfFilePath
{
private readonly ILoadFileCellFormatter _loadFileCellFormatter;
private readonly ExportFile _exportSettings;
private readonly IFilePathTransformer _filePathTransformer;
private readonly ILog _logger;
public LinePdfFilePath(ILoadFileCellFormatter loadFileCellFormatter, ExportFile exportSettings, IFilePathTransformer filePathTransformer, ILog logger)
{
_loadFileCellFormatter = loadFileCellFormatter;
_exportSettings = exportSettings;
_filePathTransformer = filePathTransformer;
_logger = logger;
}
public void AddPdfFilePath(DeferredEntry loadFileEntry, ObjectExportInfo artifact)
{
if (_exportSettings.ExportPdf) {
_logger.LogVerbose("Exporting searchable PDF files, so adding path to load file entry.", Array.Empty<object>());
string partialEntry;
if (_exportSettings.VolumeInfo.CopyPdfFilesFromRepository) {
string text = string.IsNullOrWhiteSpace(artifact.PdfDestinationLocation) ? artifact.PdfDestinationLocation : _filePathTransformer.TransformPath(artifact.PdfDestinationLocation);
partialEntry = _loadFileCellFormatter.CreatePdfCell(text, artifact);
_logger.LogVerbose("Copying searchable PDF files, so path is local {path}.", new object[1] {
text.Secure()
});
} else {
_logger.LogVerbose("Not copying searchable PDF files, so path is remote {path}.", new object[1] {
artifact.PdfSourceLocation.Secure()
});
partialEntry = _loadFileCellFormatter.CreatePdfCell(artifact.PdfSourceLocation, artifact);
}
loadFileEntry.AddStringEntry(partialEntry);
}
}
}
}