Exemple #1
0
        private async Task ProcessSingleImportJobAsync(DataRow dataRow)
        {
            _duplicateRedactionInserted = false;

            try
            {
                //convert datarow to object
                _importWorkerQueueRecord = new ImportWorkerQueueRecord(dataRow);

                //set _imporJobArtifactId
                _importJobArtifactId = _importWorkerQueueRecord.ImportJobArtifactId;

                //create error context
                _errorContext = $"[RecordId = {_importWorkerQueueRecord.Id}, WorkspaceArtifactId = {WorkspaceArtifactId}, ImportJobArtifactId = {_importWorkerQueueRecord.ImportJobArtifactId}]";

                //retrieve import job
                var markupUtilityImportJob = await RetrieveImportJobAsync(_importJobArtifactId);

                //construct redaction data for history record
                _redactionData = await ConstructRedactionDataAsync();

                //get document artifact id
                var documentArtifactId = await GetDocumentArtifactIdAsync();

                //get fileGuid for the document and fileOrder
                var fileGuid = await GetFileGuidForDocumentFileOrderAsync(documentArtifactId);

                //check if markup set exists
                await ArtifactQueries.VerifyIfMarkupSetExistsAsync(AgentHelper.GetServicesManager(), _executionIdentity, WorkspaceArtifactId, markupUtilityImportJob.MarkupSetArtifactId);

                //insert redaction into redaction table
                await InsertMarkupIntoRedactionTableAsync(fileGuid, markupUtilityImportJob, documentArtifactId);
            }
            catch (Exception ex)
            {
                RaiseMessage($"An exception occured when processing import job. {_errorContext}. [Error Message = {ex.Message}]");

                //create Markup Utility history record as completed with errors
                await CreateFailureHistoryRecordAsync(ex);

                //update error redaction count
                _errorRedactionCount++;

                //log error
                await LogErrorAsync(ex);
            }
        }