コード例 #1
0
        public void ProcessSubmit(string transactionId)
        {
            LazyInit();
            IList <string> documentIds = _documentManager.GetDocumentIds(transactionId);

            if (CollectionUtils.IsNullOrEmpty(documentIds))
            {
                AppendAuditLogEvent("Didn't find any submit documents to process."); return;
            }
            else if (documentIds.Count > 1)
            {
                throw new InvalidOperationException(string.Format("More than one TRI document was attached to the transaction: {0}", documentIds.Count.ToString()));
            }
            AppendAuditLogEvent("Found one TRI document to process.");
            ProcessSubmitDocument(transactionId, documentIds[0]);
        }
コード例 #2
0
        public void ProcessSubmit(string transactionId)
        {
            LazyInit();

            IList <string> docIds = _documentManager.GetDocumentIds(transactionId);

            if (CollectionUtils.IsNullOrEmpty(docIds))
            {
                throw new ArgumentException(string.Format("No documents found for transaction: {0}", transactionId));
            }

            Type       runType   = null;
            MethodInfo runMethod = null;

            ParameterInfo[] runParams = null;

            Assembly assembly = GetRunMethod(out runType, out runMethod, out runParams);

            if (runParams.Length != 2)
            {
                throw new InvalidOperationException("Did not find a valid Run() method that takes two parameters");
            }
            AppendAuditLogEvent("Found a class with a valid Run() method: \"{0}\" ...", runType.Name);

            AppendAuditLogEvent("Creating an instance of class \"{0}\" ...", runType.Name);

            object runObject = assembly.CreateInstance(runType.FullName);

            object[] invokeParams = new object[2] {
                null, _connectionString
            };

            foreach (string docId in docIds)
            {
                string tempFilePath = GetUncompressedDocument(transactionId, docId);
                try
                {
                    AppendAuditLogEvent("Calling Run() method to process input xml file ...");
                    invokeParams[0] = tempFilePath;
                    runMethod.Invoke(runObject, invokeParams);
                }
                finally
                {
                    FileUtils.SafeDeleteFile(tempFilePath);
                }
            }
        }
コード例 #3
0
        public virtual void ProcessSubmit(string transactionId)
        {
            LazyInit();

            IList <string> documentIds = _documentManager.GetDocumentIds(transactionId);

            if (CollectionUtils.IsNullOrEmpty(documentIds))
            {
                throw new InvalidOperationException("Didn't find any submit documents to process.");
            }
            else if (documentIds.Count > 1)
            {
                throw new InvalidOperationException("More than one document was submitted with the transaction.");
            }

            ProcessSubmitDocument(transactionId, documentIds[0]);
        }
コード例 #4
0
        public virtual void ProcessSubmit(string transactionId)
        {
            LazyInit();

            IList <string> documentIds = _documentManager.GetDocumentIds(transactionId);

            if (CollectionUtils.IsNullOrEmpty(documentIds))
            {
                AppendAuditLogEvent("Didn't find any submit documents to process.");
                return;
            }
            AppendAuditLogEvent("Found {0} submit documents to process.", documentIds.Count.ToString());

            foreach (string docId in documentIds)
            {
                ProcessSubmitDocument(transactionId, docId);
            }
        }
コード例 #5
0
        public virtual CommonTransactionStatusCode ProcessSubmitAndReturnStatus(string transactionId, out string statusDetail)
        {
            LazyInit();

            IList <string> documentIds = _documentManager.GetDocumentIds(transactionId);

            if (CollectionUtils.IsNullOrEmpty(documentIds))
            {
                statusDetail = "Didn't find any submit documents to process";
                AppendAuditLogEvent(statusDetail);
                return(CommonTransactionStatusCode.Completed);
            }
            else if (documentIds.Count > 1)
            {
                throw new ArgException("More than one document was submitted to this service.  This service only supports one document submission at a time.");
            }

            return(ProcessSubmitDocument(transactionId, documentIds[0], out statusDetail));
        }
コード例 #6
0
        public void ProcessSubmit(string transactionId)
        {
            LazyInit();

            IList <string> documentIds = _documentManager.GetDocumentIds(transactionId);

            if (CollectionUtils.IsNullOrEmpty(documentIds))
            {
                AppendAuditLogEvent("Didn't find any submit documents to process.");
                return;
            }
            else if (documentIds.Count > 1)
            {
                throw new InvalidOperationException(string.Format("More than one TRI document was attached to the transaction: {0}",
                                                                  documentIds.Count.ToString()));
            }

            string username = _transactionManager.GetTransactionUsername(transactionId);
            string docId    = documentIds[0];

            try
            {
                AppendAuditLogEvent("Calling stored procedure \"{0}\" to copy the document id \"{1}\" associated with transaction id \"{2}\" and NAAS account \"{3}\" ...",
                                    _copyStoredProcName, docId, transactionId, username);

                _baseDao.DoStoredProcWithArgs(_copyStoredProcName, STORED_PROC_PARAM_NAME_TRANSACTION_ID + ";" + STORED_PROC_PARAM_NAME_USER_NAME,
                                              new object[] { transactionId, username });

                AppendAuditLogEvent("Successfully called stored procedure \"{0}\" to copy the document id \"{1}\" associated with transaction id \"{2}\"",
                                    _copyStoredProcName, docId, transactionId);

                _documentManager.SetDocumentStatus(transactionId, docId, CommonTransactionStatusCode.Processed,
                                                   "Copied using stored proc " + _copyStoredProcName);
            }
            catch (Exception ex)
            {
                AppendAuditLogEvent("Failed to call stored procedure \"{0}\" to copy the document id \"{1}\" associated with transaction id \"{2}\": {3}",
                                    _copyStoredProcName, docId, transactionId, ExceptionUtils.GetDeepExceptionMessage(ex));
                throw;
            }
        }
コード例 #7
0
        public void ProcessSubmit(string transactionId)
        {
            try
            {
                LazyInit();

                if (_authorizedWqxUsers != null)
                {
                    _submitUsername = _transactionManager.GetTransactionUsername(transactionId);
                    if (string.IsNullOrEmpty(_submitUsername))
                    {
                        throw new ArgumentException("A Submit username is not associated with the transaction");
                    }
                }

                IList <string> documentIds = _documentManager.GetDocumentIds(transactionId);

                if (CollectionUtils.IsNullOrEmpty(documentIds))
                {
                    AppendAuditLogEvent("Didn't find any submit documents to process.");
                    return;
                }
                AppendAuditLogEvent("Found {0} submit documents to process.", documentIds.Count.ToString());

                foreach (string docId in documentIds)
                {
                    ProcessSubmitDocument(transactionId, docId);
                }

                GenerateExecutionLogAndAttachToTransaction(transactionId, null);
            }
            catch (Exception ex)
            {
                GenerateExecutionLogAndAttachToTransaction(transactionId, ex);
                throw;
            }
        }