Example #1
0
        private async Task <int> GetDocumentArtifactIdAsync()
        {
            RaiseMessage($"Getting document identifier field name. {_errorContext}");

            //get document identifier field name
            var documentIdentifierFieldName = await QueryHelper.GetDocumentIdentifierFieldNameAsync(AgentHelper.GetDBContext(WorkspaceArtifactId));

            RaiseMessage($"Checking if document exists. {_errorContext}");

            //check if document exists
            var doesDocumentExists = await ArtifactQueries.DoesDocumentExistAsync(AgentHelper.GetServicesManager(), _executionIdentity, WorkspaceArtifactId, documentIdentifierFieldName, _importWorkerQueueRecord.DocumentIdentifier);

            if (!doesDocumentExists)
            {
                throw new MarkupUtilityException("Document does not exist.");
            }

            RaiseMessage($"Getting document artifact id. {_errorContext}");

            //get document artifact id
            var documentArtifactId = await ArtifactQueries.RetrieveDocumentArtifactIdAsync(AgentHelper.GetServicesManager(), _executionIdentity, WorkspaceArtifactId, documentIdentifierFieldName, _importWorkerQueueRecord.DocumentIdentifier);

            return(documentArtifactId);
        }