ExportRequest
using Relativity.DataExchange.Resources;
using Relativity.Transfer;
using Relativity.Transfer.Http;
using System;
using System.Globalization;
using System.IO;
namespace Relativity.DataExchange.Export.VolumeManagerV2.Download
{
public abstract class ExportRequest
{
public string SourceLocation { get; }
public int ArtifactId { get; }
public string DestinationLocation { get; }
public string FileName { get; set; }
public int Order { get; set; }
protected ExportRequest(int artifactId, string sourceLocation, string destinationLocation)
{
ArtifactId = artifactId;
SourceLocation = sourceLocation;
DestinationLocation = destinationLocation;
}
public TransferPath CreateTransferPath(int order)
{
Order = order;
return CreateTransferPath();
}
protected abstract TransferPath CreateTransferPath();
protected static TransferPath CreateTransferPath(int artifactId, int order, string sourcePath, string targetPath, HttpTransferPathData data)
{
if (string.IsNullOrWhiteSpace(targetPath))
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExportStrings.ExportRequestTargetPathExceptionMessage, artifactId), "targetPath");
FileInfo fileInfo = new FileInfo(targetPath);
TransferPath val = new TransferPath();
val.set_Order(order);
val.set_SourcePath(sourcePath);
val.set_TargetPath(fileInfo.Directory?.FullName);
val.set_TargetFileName(fileInfo.Name);
val.AddData("HttpTransferPathData", (object)data);
return val;
}
}
}