TransferIssueBuilder
using System;
namespace Relativity.Transfer.Issues
{
internal class TransferIssueBuilder : ITransferIssueBuilder
{
protected TransferIssue TransferIssue;
public TransferIssueBuilder()
{
TransferIssue = new TransferIssue();
}
public ITransferIssueBuilder WithAttributes(IssueAttributes attributes)
{
TransferIssue.Attributes = attributes;
return this;
}
public ITransferIssueBuilder WithMaxRetryAttempts(int maxRetryAttempts)
{
TransferIssue.MaxRetryAttempts = maxRetryAttempts;
return this;
}
public ITransferIssueBuilder WithRetryAttempt(int retryAttempt)
{
TransferIssue.RetryAttempt = retryAttempt;
return this;
}
public ITransferIssueBuilder FromJobPath(JobTransferPath jobPath)
{
if (jobPath == null)
throw new ArgumentNullException("jobPath");
TransferIssue.Path = jobPath.Path;
TransferIssue.RetryAttempt = jobPath.RetryCount;
return this;
}
public ITransferIssueBuilder FromPath(TransferPath jobPath)
{
TransferIssue.Path = jobPath;
return this;
}
public ITransferIssueBuilder WithIndex(int index)
{
TransferIssue.Index = index;
return this;
}
public ITransferIssue Build()
{
TransferIssue.Timestamp = DateTime.Now;
return TransferIssue;
}
public ITransferIssueBuilder WithMessage(string message)
{
TransferIssue.Message = message;
return this;
}
public ITransferIssueBuilder WithRetryable(bool retrayable)
{
TransferIssue.IsRetryable = retrayable;
return this;
}
}
}