KeplerBulkImportManager
using kCura.EDDS.WebAPI.BulkImportManagerBase;
using kCura.WinEDDS.Mapping;
using Microsoft.VisualBasic.CompilerServices;
using Relativity.DataExchange.Service;
using System;
using System.Net;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Web.Services.Protocols;
namespace kCura.WinEDDS.Service.Replacement
{
public class KeplerBulkImportManager : KeplerManager, IBulkImportManager
{
[CompilerGenerated]
internal sealed class _Closure$__10-0
{
public int $VB$Local_appID;
public ObjectLoadInfo $VB$Local_settings;
public bool $VB$Local_inRepository;
public KeplerBulkImportManager $VB$Me;
public Func<IServiceProxyFactory, Task<MassImportResults>> $I1;
internal MassImportResults _Lambda$__0()
{
return $VB$Me.Execute(($I1 == null) ? ($I1 = delegate(IServiceProxyFactory s) {
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__10-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : $I1);
}
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__1))]
internal Task<MassImportResults> _Lambda$__1(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__10-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__11-0
{
public int $VB$Local_appID;
public string $VB$Local_runId;
public KeplerBulkImportManager $VB$Me;
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__0))]
internal Task<object> _Lambda$__0(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__0 stateMachine = default(VB$StateMachine___Lambda$__0);
stateMachine.$VB$NonLocal__Closure$__11-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<object>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__12-0
{
public int $VB$Local_artifactID;
public string $VB$Local_runId;
public KeplerBulkImportManager $VB$Me;
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__0))]
internal Task<bool> _Lambda$__0(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__0 stateMachine = default(VB$StateMachine___Lambda$__0);
stateMachine.$VB$NonLocal__Closure$__12-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<bool>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__13-0
{
public int $VB$Local_appID;
public string $VB$Local_importKey;
public bool $VB$Local_writeHeader;
public int $VB$Local_keyFieldID;
public KeplerBulkImportManager $VB$Me;
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__0))]
internal Task<global::Relativity.DataExchange.Service.ErrorFileKey> _Lambda$__0(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__0 stateMachine = default(VB$StateMachine___Lambda$__0);
stateMachine.$VB$NonLocal__Closure$__13-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<global::Relativity.DataExchange.Service.ErrorFileKey>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__14-0
{
public int $VB$Local_appID;
public string $VB$Local_runID;
public int $VB$Local_artifactTypeID;
public bool $VB$Local_writeHeader;
public int $VB$Local_keyFieldID;
public KeplerBulkImportManager $VB$Me;
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__0))]
internal Task<global::Relativity.DataExchange.Service.ErrorFileKey> _Lambda$__0(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__0 stateMachine = default(VB$StateMachine___Lambda$__0);
stateMachine.$VB$NonLocal__Closure$__14-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<global::Relativity.DataExchange.Service.ErrorFileKey>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__15-0
{
public int $VB$Local_appID;
public string $VB$Local_runId;
public KeplerBulkImportManager $VB$Me;
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__0))]
internal Task<bool> _Lambda$__0(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__0 stateMachine = default(VB$StateMachine___Lambda$__0);
stateMachine.$VB$NonLocal__Closure$__15-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<bool>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__16-0
{
public int $VB$Local_appID;
public KeplerBulkImportManager $VB$Me;
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__0))]
internal Task<bool> _Lambda$__0(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__0 stateMachine = default(VB$StateMachine___Lambda$__0);
stateMachine.$VB$NonLocal__Closure$__16-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<bool>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__7-0
{
public int $VB$Local_appID;
public ImageLoadInfo $VB$Local_settings;
public bool $VB$Local_inRepository;
public KeplerBulkImportManager $VB$Me;
public Func<IServiceProxyFactory, Task<MassImportResults>> $I1;
internal MassImportResults _Lambda$__0()
{
return $VB$Me.Execute(($I1 == null) ? ($I1 = delegate(IServiceProxyFactory s) {
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__7-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : $I1);
}
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__1))]
internal Task<MassImportResults> _Lambda$__1(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__7-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__8-0
{
public int $VB$Local_appID;
public ImageLoadInfo $VB$Local_settings;
public int $VB$Local_productionKeyFieldArtifactID;
public bool $VB$Local_inRepository;
public KeplerBulkImportManager $VB$Me;
public Func<IServiceProxyFactory, Task<MassImportResults>> $I1;
internal MassImportResults _Lambda$__0()
{
return $VB$Me.Execute(($I1 == null) ? ($I1 = delegate(IServiceProxyFactory s) {
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__8-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : $I1);
}
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__1))]
internal Task<MassImportResults> _Lambda$__1(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__8-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
[CompilerGenerated]
internal sealed class _Closure$__9-0
{
public int $VB$Local_appID;
public NativeLoadInfo $VB$Local_settings;
public bool $VB$Local_inRepository;
public bool $VB$Local_includeExtractedTextEncoding;
public KeplerBulkImportManager $VB$Me;
public Func<IServiceProxyFactory, Task<MassImportResults>> $I1;
internal MassImportResults _Lambda$__0()
{
return $VB$Me.Execute(($I1 == null) ? ($I1 = delegate(IServiceProxyFactory s) {
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__9-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : $I1);
}
[AsyncStateMachine(typeof(VB$StateMachine___Lambda$__1))]
internal Task<MassImportResults> _Lambda$__1(IServiceProxyFactory s)
{
VB$StateMachine___Lambda$__1 stateMachine = default(VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__9-0 = this;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
}
private readonly NetworkCredential _credentials;
private readonly CookieContainer ;
public CookieContainer CookieContainer => null;
public ICredentials Credentials => _credentials;
public KeplerBulkImportManager(IServiceProxyFactory serviceProxyFactory, IServiceExceptionMapper exceptionMapper, NetworkCredential credentials, Func<string> correlationIdFunc)
: base(serviceProxyFactory, exceptionMapper, correlationIdFunc)
{
_credentials = credentials;
}
public MassImportResults BulkImportImage(int appID, ImageLoadInfo settings, bool inRepository)
{
_Closure$__7-0 closure$__7-;
return ExecuteImport(() => Execute((closure$__7-.$I1 == null) ? (closure$__7-.$I1 = delegate(IServiceProxyFactory s) {
_Closure$__7-0.VB$StateMachine___Lambda$__1 stateMachine = default(_Closure$__7-0.VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__7-0 = closure$__7-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : closure$__7-.$I1));
}
MassImportResults IBulkImportManager.BulkImportImage(int appID, ImageLoadInfo settings, bool inRepository)
{
return this.BulkImportImage(appID, settings, inRepository);
}
public MassImportResults BulkImportProductionImage(int appID, ImageLoadInfo settings, int productionKeyFieldArtifactID, bool inRepository)
{
_Closure$__8-0 closure$__8-;
return ExecuteImport(() => Execute((closure$__8-.$I1 == null) ? (closure$__8-.$I1 = delegate(IServiceProxyFactory s) {
_Closure$__8-0.VB$StateMachine___Lambda$__1 stateMachine = default(_Closure$__8-0.VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__8-0 = closure$__8-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : closure$__8-.$I1));
}
MassImportResults IBulkImportManager.BulkImportProductionImage(int appID, ImageLoadInfo settings, int productionKeyFieldArtifactID, bool inRepository)
{
return this.BulkImportProductionImage(appID, settings, productionKeyFieldArtifactID, inRepository);
}
public MassImportResults BulkImportNative(int appID, NativeLoadInfo settings, bool inRepository, bool includeExtractedTextEncoding)
{
_Closure$__9-0 closure$__9-;
return ExecuteImport(() => Execute((closure$__9-.$I1 == null) ? (closure$__9-.$I1 = delegate(IServiceProxyFactory s) {
_Closure$__9-0.VB$StateMachine___Lambda$__1 stateMachine = default(_Closure$__9-0.VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__9-0 = closure$__9-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : closure$__9-.$I1));
}
MassImportResults IBulkImportManager.BulkImportNative(int appID, NativeLoadInfo settings, bool inRepository, bool includeExtractedTextEncoding)
{
return this.BulkImportNative(appID, settings, inRepository, includeExtractedTextEncoding);
}
public MassImportResults BulkImportObjects(int appID, ObjectLoadInfo settings, bool inRepository)
{
_Closure$__10-0 closure$__10-;
return ExecuteImport(() => Execute((closure$__10-.$I1 == null) ? (closure$__10-.$I1 = delegate(IServiceProxyFactory s) {
_Closure$__10-0.VB$StateMachine___Lambda$__1 stateMachine = default(_Closure$__10-0.VB$StateMachine___Lambda$__1);
stateMachine.$VB$NonLocal__Closure$__10-0 = closure$__10-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<MassImportResults>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}) : closure$__10-.$I1));
}
MassImportResults IBulkImportManager.BulkImportObjects(int appID, ObjectLoadInfo settings, bool inRepository)
{
return this.BulkImportObjects(appID, settings, inRepository);
}
public object DisposeTempTables(int appID, string runId)
{
return Execute(delegate(IServiceProxyFactory s) {
_Closure$__11-0.VB$StateMachine___Lambda$__0 stateMachine = default(_Closure$__11-0.VB$StateMachine___Lambda$__0);
_Closure$__11-0 $VB$NonLocal__Closure$__11-;
stateMachine.$VB$NonLocal__Closure$__11-0 = $VB$NonLocal__Closure$__11-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<object>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
});
}
object IBulkImportManager.DisposeTempTables(int appID, string runId)
{
return this.DisposeTempTables(appID, runId);
}
public bool ImageRunHasErrors(int artifactID, string runId)
{
return Execute(delegate(IServiceProxyFactory s) {
_Closure$__12-0.VB$StateMachine___Lambda$__0 stateMachine = default(_Closure$__12-0.VB$StateMachine___Lambda$__0);
_Closure$__12-0 $VB$NonLocal__Closure$__12-;
stateMachine.$VB$NonLocal__Closure$__12-0 = $VB$NonLocal__Closure$__12-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<bool>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
});
}
bool IBulkImportManager.ImageRunHasErrors(int artifactID, string runId)
{
return this.ImageRunHasErrors(artifactID, runId);
}
public global::Relativity.DataExchange.Service.ErrorFileKey GenerateImageErrorFiles(int appID, string importKey, bool writeHeader, int keyFieldID)
{
return Execute(delegate(IServiceProxyFactory s) {
_Closure$__13-0.VB$StateMachine___Lambda$__0 stateMachine = default(_Closure$__13-0.VB$StateMachine___Lambda$__0);
_Closure$__13-0 $VB$NonLocal__Closure$__13-;
stateMachine.$VB$NonLocal__Closure$__13-0 = $VB$NonLocal__Closure$__13-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<global::Relativity.DataExchange.Service.ErrorFileKey>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
});
}
global::Relativity.DataExchange.Service.ErrorFileKey IBulkImportManager.GenerateImageErrorFiles(int appID, string importKey, bool writeHeader, int keyFieldID)
{
return this.GenerateImageErrorFiles(appID, importKey, writeHeader, keyFieldID);
}
public global::Relativity.DataExchange.Service.ErrorFileKey GenerateNonImageErrorFiles(int appID, string runID, int artifactTypeID, bool writeHeader, int keyFieldID)
{
return Execute(delegate(IServiceProxyFactory s) {
_Closure$__14-0.VB$StateMachine___Lambda$__0 stateMachine = default(_Closure$__14-0.VB$StateMachine___Lambda$__0);
_Closure$__14-0 $VB$NonLocal__Closure$__14-;
stateMachine.$VB$NonLocal__Closure$__14-0 = $VB$NonLocal__Closure$__14-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<global::Relativity.DataExchange.Service.ErrorFileKey>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
});
}
global::Relativity.DataExchange.Service.ErrorFileKey IBulkImportManager.GenerateNonImageErrorFiles(int appID, string runID, int artifactTypeID, bool writeHeader, int keyFieldID)
{
return this.GenerateNonImageErrorFiles(appID, runID, artifactTypeID, writeHeader, keyFieldID);
}
public bool NativeRunHasErrors(int appID, string runId)
{
return Execute(delegate(IServiceProxyFactory s) {
_Closure$__15-0.VB$StateMachine___Lambda$__0 stateMachine = default(_Closure$__15-0.VB$StateMachine___Lambda$__0);
_Closure$__15-0 $VB$NonLocal__Closure$__15-;
stateMachine.$VB$NonLocal__Closure$__15-0 = $VB$NonLocal__Closure$__15-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<bool>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
});
}
bool IBulkImportManager.NativeRunHasErrors(int appID, string runId)
{
return this.NativeRunHasErrors(appID, runId);
}
public bool HasImportPermissions(int appID)
{
return Execute(delegate(IServiceProxyFactory s) {
_Closure$__16-0.VB$StateMachine___Lambda$__0 stateMachine = default(_Closure$__16-0.VB$StateMachine___Lambda$__0);
_Closure$__16-0 $VB$NonLocal__Closure$__16-;
stateMachine.$VB$NonLocal__Closure$__16-0 = $VB$NonLocal__Closure$__16-;
stateMachine.$VB$Local_s = s;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<bool>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
});
}
bool IBulkImportManager.HasImportPermissions(int appID)
{
return this.HasImportPermissions(appID);
}
private MassImportResults ExecuteImport(Func<MassImportResults> f)
{
MassImportResults massImportResults = f();
CheckResultsForException(massImportResults);
return massImportResults;
}
private void CheckResultsForException(MassImportResults results)
{
if (results.ExceptionDetail != null) {
if (results.ExceptionDetail.ExceptionMessage != null && results.ExceptionDetail.ExceptionMessage.Contains("Timeout expired"))
throw new BulkImportManager.BulkImportSqlTimeoutException(results.ExceptionDetail);
if (results.ExceptionDetail.ExceptionMessage != null && results.ExceptionDetail.ExceptionMessage.Contains("##InsufficientPermissionsForImportException##"))
throw new BulkImportManager.InsufficientPermissionsForImportException(results.ExceptionDetail);
if (results.ExceptionDetail.ExceptionMessage != null && results.ExceptionDetail.ExceptionMessage.Contains("Server stack limit has been reached")) {
kCura.EDDS.WebAPI.BulkImportManagerBase.SoapExceptionDetail exceptionDetail;
(exceptionDetail = results.ExceptionDetail).ExceptionMessage = exceptionDetail.ExceptionMessage + " This exception is known to be thrown when you import too many fields. This limit can vary tough, depending on the hardware, and the code. Try to import less fields.";
throw new BulkImportManager.BulkImportSqlException(results.ExceptionDetail);
}
throw new BulkImportManager.BulkImportSqlException(results.ExceptionDetail);
}
}
protected override Exception ConvertSoapExceptionToRelativityException(SoapException soapException)
{
if (Operators.CompareString(soapException.get_Detail().SelectNodes("ExceptionType").Item(0)
.InnerText, "Relativity.Core.Exception.InsufficientAccessControlListPermissions", false) != 0)
return base.ConvertSoapExceptionToRelativityException(soapException);
return new BulkImportManager.InsufficientPermissionsForImportException(soapException.get_Detail().SelectNodes("ExceptionMessage")[0].InnerText, (Exception)soapException);
}
}
}