<PackageReference Include="Relativity.Server.Import.SDK" Version="2.9.2" />

LongTextBatchValidator

using kCura.WinEDDS; using kCura.WinEDDS.Exporters; using Relativity.DataExchange.Export.VolumeManagerV2.Metadata.Text; using Relativity.DataExchange.Export.VolumeManagerV2.Repository; using Relativity.DataExchange.Io; using Relativity.DataExchange.Logger; using Relativity.Logging; using System.Linq; using System.Threading; namespace Relativity.DataExchange.Export.VolumeManagerV2.Batches { public class LongTextBatchValidator : IBatchValidator { private readonly ILongTextRepository _longTextRepository; private readonly IFile _fileWrapper; private readonly IStatus _status; private readonly ILog _logger; public LongTextBatchValidator(ILongTextRepository longTextRepository, IFile fileWrapper, IStatus status, ILog logger) { _longTextRepository = longTextRepository; _fileWrapper = fileWrapper; _status = status; _logger = logger; } public void ValidateExportedBatch(ObjectExportInfo[] artifacts, CancellationToken cancellationToken) { foreach (LongText item in _longTextRepository.GetLongTexts().Where(delegate(LongText x) { if (x.ExportRequest != null && !x.RequireDeletion) return !string.IsNullOrWhiteSpace(x.Location); return false; })) { if (cancellationToken.IsCancellationRequested) break; if (!_fileWrapper.Exists(item.Location)) { _logger.LogError("File {file} for LongText {fieldId} for artifact {artifactId} missing.", new object[3] { item.Location.Secure(), item.FieldArtifactId, item.ArtifactId }); _status.WriteError($"""{item.Location}""{item.FieldArtifactId}""{item.ArtifactId}"""); } else if (_fileWrapper.GetFileSize(item.Location) == 0) { _logger.LogWarning("File {file} for LongText {fieldId} for artifact {artifactId} is empty.", new object[3] { item.Location.Secure(), item.FieldArtifactId, item.ArtifactId }); _status.WriteWarning($"""{item.Location}""{item.FieldArtifactId}""{item.ArtifactId}"""); } } } } }