public virtual void ProcessTask(string requestId) { LazyInit(); ValidateRequest(requestId); DateTime newerThan = DateTime.Now.AddDays(-_maxCheckDays); AppendAuditLogEvent("Querying for AQS submission transactions that are newer than {0} ...", newerThan.ToString()); CommonTransactionStatusCode[] dontGetStatusCodes = new CommonTransactionStatusCode[] { CommonTransactionStatusCode.ReceivedUnprocessed }; // Get all IList <NodeTransaction> outstandingTransactions = _transactionManager.GetOutstandingNetworkTransactions(newerThan, new string[] { _dataRequestFlowName }, dontGetStatusCodes); if (CollectionUtils.IsNullOrEmpty(outstandingTransactions)) { AppendAuditLogEvent("Did not find any AQS submission transactions that are newer than {0}.", newerThan.ToString()); return; } CollectionUtils.ForEach(outstandingTransactions, delegate(NodeTransaction nodeTransaction) { ProcessOutstandingTransaction(nodeTransaction); }); }
protected virtual void ValidateRequest(string requestId) { AppendAuditLogEvent("Loading request with id \"{0}\"", requestId); _dataRequest = _requestManager.GetDataRequest(requestId); AppendAuditLogEvent("Validating request: {0}", _dataRequest); GetParameter(_dataRequest, PARAM_SUBMISSION_DATE, 0, out _submissionDate); string statusParam = null; TryGetParameter(_dataRequest, PARAM_TRANSACTION_STATUS, 1, ref statusParam); if (!string.IsNullOrEmpty(statusParam)) { _transactionStatus = (CommonTransactionStatusCode)Enum.Parse(typeof(CommonTransactionStatusCode), statusParam); } if (_transactionStatus == CommonTransactionStatusCode.Unknown) { AppendAuditLogEvent("Parameters: {0} ({1})", PARAM_SUBMISSION_DATE, _submissionDate.ToString()); } else { AppendAuditLogEvent("Parameters: {0} ({1}), {2} ({3})", PARAM_SUBMISSION_DATE, _submissionDate.ToString(), PARAM_TRANSACTION_STATUS, _transactionStatus.ToString()); } }
/// <summary> /// Add the input document to the node. /// </summary> public string AddDocument(string transactionId, CommonTransactionStatusCode status, string statusDetail, Document document) { if (CollectionUtils.IsNullOrEmpty(document.Content)) { throw new ArgumentException(string.Format("Document does not contain any content: \"{0}\".", document)); } string newId = IdProvider.Get(); try { document.Id = newId; // First, attempt to save all the documents to the repository if (string.IsNullOrEmpty(document.DocumentId)) { document.DocumentId = newId; // If not specified, set this to DB id } if (string.IsNullOrEmpty(document.DocumentName)) { // If not specified, set this to DB id + extension document.DocumentName = Path.ChangeExtension(newId, CommonContentAndFormatProvider.GetFileExtension(document.Type)); } CheckToCompressDocument(document); LOG.Debug("Saving document: \"{0}\"", document); _documentDao.CreateDocument(transactionId, status, statusDetail, document); _documentContentManager.SaveDocumentContent(transactionId, newId, document.Content, false); return(newId); } catch (Exception) { RollbackDocument(transactionId, newId); throw; } }
public static string ConvertTo11Enum(CommonTransactionStatusCode type) { Wsdl11TransactionStatusCode wsdl11TransactionStatus = EnumUtils.ParseEnum <Wsdl11TransactionStatusCode>(type.ToString()); if ((wsdl11TransactionStatus == Wsdl11TransactionStatusCode.Unknown) && (type != CommonTransactionStatusCode.Unknown)) { //account for special types that do not directly map to the common type switch (type) { case (CommonTransactionStatusCode.Processing): wsdl11TransactionStatus = Wsdl11TransactionStatusCode.Pending; break; case (CommonTransactionStatusCode.Cancelled): wsdl11TransactionStatus = Wsdl11TransactionStatusCode.Failed; break; case (CommonTransactionStatusCode.Approved): wsdl11TransactionStatus = Wsdl11TransactionStatusCode.Processed; break; case (CommonTransactionStatusCode.ReceivedUnprocessed): wsdl11TransactionStatus = Wsdl11TransactionStatusCode.Received; break; default: throw new ArgumentException("Invalid transaction status code", type.ToString()); } } return(wsdl11TransactionStatus.ToString()); }
public void SetDocumentStatus(string transactionID, string id, CommonTransactionStatusCode status, string statusDetail) { DoSimpleUpdateOne(TABLE_NAME, "TransactionId;Id", new object[] { transactionID, id }, "Status;StatusDetail", status.ToString(), statusDetail ?? string.Empty); }
public virtual void ProcessTask(string requestId) { LazyInit(); ValidateRequest(requestId); DateTime newerThan = DateTime.Now.AddDays(-_maxCheckDays); CommonTransactionStatusCode[] dontGetStatusCodes = new CommonTransactionStatusCode[] { CommonTransactionStatusCode.Failed }; AppendAuditLogEvent("Querying for RCRA solicit transactions that are newer than {0} ...", newerThan.ToString()); IList <NodeTransaction> outstandingTransactions = _transactionManager.GetOutstandingNetworkTransactions(newerThan, new string[] { _dataRequestFlowName }, dontGetStatusCodes); if (CollectionUtils.IsNullOrEmpty(outstandingTransactions)) { AppendAuditLogEvent("Did not find any RCRA solicit transactions that are newer than {0}.", newerThan.ToString()); return; } bool anyDataInserted = false; CollectionUtils.ForEach(outstandingTransactions, delegate(NodeTransaction nodeTransaction) { if (ProcessOutstandingTransaction(nodeTransaction)) { anyDataInserted = true; } }); if (anyDataInserted) { ExecuteStoredProc(); } }
public IList <Document> GetDocumentsByStatus(string transactionId, CommonTransactionStatusCode returnDocsWithStatus) { IList <Document> documents = _documentDao.GetDocumentsByStatus(transactionId, returnDocsWithStatus); GetContentSizes(transactionId, documents); return(documents); }
protected virtual bool DoGetStatusAndDownloadDocuments(out string localTransactionId, out IList <string> documentNames) { documentNames = null; localTransactionId = null; AppendAuditLogEvent("Checking status of the ICIS submission with transaction id \"{0}\"", _submissionTrackingDataType.SubmissionTransactionId); CommonTransactionStatusCode statusCode = UpdateStatusOfNetworkTransaction(_submissionTrackingDataType.SubmissionTransactionId, out localTransactionId); _submissionTrackingDataType.SubmissionStatusDateTimeSpecified = true; _submissionTrackingDataType.SubmissionStatusDateTime = DateTime.Now; _submissionTrackingDataType.SubmissionTransactionStatusSpecified = true; _submissionTrackingDataType.SubmissionTransactionStatus = EnumUtils.ParseEnum <TransactionStatusCode>(statusCode.ToString()); if (statusCode == CommonTransactionStatusCode.Failed) { _submissionTrackingDataType.WorkflowStatus = TransactionStatusCode.Failed; } else { _submissionTrackingDataType.WorkflowStatus = TransactionStatusCode.Pending; } SubmissionTrackingTableHelper.Update(_baseDao, _submissionTrackingDataTypePK, _submissionTrackingDataType); if ((statusCode != CommonTransactionStatusCode.Completed) && (statusCode != CommonTransactionStatusCode.Failed)) { AppendAuditLogEvent("Another attempt to process the ICIS submission with transaction id \"{0}\" will be made when the service runs again.", _submissionTrackingDataType.SubmissionTransactionId); return(false); } else if (statusCode == CommonTransactionStatusCode.Failed) { return(false); } AppendAuditLogEvent("Attempting to download response documents for ICIS submission with transaction id \"{0}\"", _submissionTrackingDataType.SubmissionTransactionId); try { _transactionManager.DownloadNetworkDocumentsAndAddToTransaction(localTransactionId, out statusCode); } catch (Exception ex) { AppendAuditLogEvent("Failed to download response documents for ICIS submission with transaction id \"{0}\" with error: {1}", _submissionTrackingDataType.SubmissionTransactionId, ExceptionUtils.GetDeepExceptionMessage(ex)); AppendAuditLogEvent("Another attempt to process the ICIS submission with transaction id \"{0}\" will be made when the service runs again.", _submissionTrackingDataType.SubmissionTransactionId); return(false); } documentNames = _documentManager.GetAllDocumentNames(localTransactionId); return(true); }
/// <summary> /// NotifyDocument /// </summary> /// <returns></returns> public string NotifyDocument20(string endpoint, string flow, CommonTransactionStatusCode status, string description, params string[] documentIds) { Notify notify = NewDocumentNotifyObject(endpoint, flow, status, description, documentIds); StatusResponseType statusResp = _requestor.Notify(notify); return(statusResp.transactionId); }
/// <summary> /// NotifyStatus /// </summary> /// <param name="endpoint"></param> /// <param name="flow"></param> /// <param name="transactionId"></param> /// <param name="status"></param> /// <param name="description"></param> /// <returns></returns> public CommonTransactionStatusCode NotifyStatus20(string endpoint, string flow, string transactionId, CommonTransactionStatusCode status, string description) { Notify notify = NewStatusNotifyObject(endpoint, flow, transactionId, status, description); StatusResponseType statusResp = _requestor.Notify(notify); return(CommonTransactionStatusCodeProvider.Convert(statusResp.status.ToString())); }
/// <summary> /// NotifyStatus /// </summary> /// <param name="endpoint"></param> /// <param name="transactionId"></param> /// <param name="status"></param> /// <param name="description"></param> /// <returns></returns> public CommonTransactionStatusCode NotifyStatus11(string endpoint, string transactionId, CommonTransactionStatusCode status, string description) { string rtnStatus = _requestor.NotifyStatus(Authenticate(), endpoint, transactionId, CommonTransactionStatusCodeProvider.ConvertTo11Enum(status), description); return(CommonTransactionStatusCodeProvider.Convert(rtnStatus)); }
public void Notify(TransactionStatus currentStatus, IDictionary <string, TransactionNotificationType> notifications) { CommonTransactionStatusCode code = currentStatus.Status; if (code == CommonTransactionStatusCode.ReceivedUnprocessed) { code = CommonTransactionStatusCode.Received; } // TODO: Need to implement }
/// <summary> /// NotifyEvent /// </summary> /// <returns></returns> public CommonTransactionStatusCode NotifyEvent20(string nodeEndpoint, string flow, string messageName, CommonTransactionStatusCode status, string description, string eventName) { Notify notify = NewEventNotifyObject(nodeEndpoint, flow, messageName, status, description, eventName); StatusResponseType statusResp = _requestor.Notify(notify); return(CommonTransactionStatusCodeProvider.Convert(statusResp.status.ToString())); }
public string AddDocument(string transactionId, CommonTransactionStatusCode status, string statusDetail, PaginatedContentResult result) { string docName = Path.ChangeExtension(Guid.NewGuid().ToString(), CommonContentAndFormatProvider.GetFileExtension(result.Content.Type)); Document doc = new Document(docName, result.Content.Type, result.Content.Content); return(AddDocument(transactionId, status, statusDetail, doc)); }
protected virtual string AddDocument(string transactionId, CommonTransactionStatusCode status, string statusDetail, string filePath, bool dontAutoCompress) { string docName = Path.GetFileName(filePath); Document doc = new Document(docName, CommonContentAndFormatProvider.GetFileTypeFromName(docName), File.ReadAllBytes(filePath)); doc.DontAutoCompress = dontAutoCompress; return(AddDocument(transactionId, status, statusDetail, doc)); }
/// <summary> /// Sends query notifications /// </summary> /// <param name="tran"></param> public void DoExecuteNotifications(string transactionId, CommonTransactionStatusCode status, string flowId, string interfaceName, string username, string methodName, ByIndexOrNameDictionary <string> parameters) { SendNotificationsPriv(flowId, transactionId, NotificationType.OnExecute, ExecuteSubjectLine, new string[] { _serverName, FromEmailAddress, DateTime.Now.ToString(), username, interfaceName, methodName, StringUtils.Join(", ", parameters), status.ToString(), AdminInterfaceUrl, transactionId.ToString() }); }
protected virtual bool ProcessOutstandingTransaction(NodeTransaction nodeTransaction) { try { if (HasTransactionBeenProcessed(nodeTransaction)) { return(false); } AppendAuditLogEvent("*** Begin processing network submission transaction \"{0}\" to {1} service \"{2}\" ...", nodeTransaction.NetworkId, nodeTransaction.NetworkFlowName, nodeTransaction.NetworkOperationName); AppendAuditLogEvent("Checking status of the network transaction \"{0}\" associated with the local transaction \"{1}\" ...", nodeTransaction.NetworkId, nodeTransaction.Id); TransactionStatus transactionStatus = _transactionManager.RefreshNetworkStatus(nodeTransaction.Id); CommonTransactionStatusCode currentStatus = transactionStatus.Status; AppendAuditLogEvent("The network transaction \"{0}\" associated with the local transaction \"{1}\" has a network status of \"{2}\" ...", nodeTransaction.NetworkId, nodeTransaction.Id, currentStatus.ToString()); if ((currentStatus == CommonTransactionStatusCode.Completed) || (currentStatus == CommonTransactionStatusCode.Failed)) { AppendAuditLogEvent("Attempting to download documents for the network transaction \"{0}\" ...", nodeTransaction.NetworkId); nodeTransaction.NetworkEndpointStatus = currentStatus; _transactionManager.DownloadNetworkDocumentsAndAddToTransaction(nodeTransaction.Id, out currentStatus); AppendAuditLogEvent("Any documents associated with the network transaction \"{0}\" were downloaded and saved.", nodeTransaction.NetworkId); DoEmailNotifications(nodeTransaction); CheckStatusComplete checkStatusComplete = new CheckStatusComplete(DateTime.Now); SaveCheckStatusComplete(nodeTransaction.Id, checkStatusComplete); return(true); } else { AppendAuditLogEvent("Another attempt to process the network transaction \"{0}\" will be made when the schedule runs again.", nodeTransaction.NetworkId); return(false); } } catch (Exception ex) { AppendAuditLogEvent("ERROR: Failed to process network submission transaction \"{0}\" to {1} service \"{2}\" with exception: {3}.", nodeTransaction.NetworkId, nodeTransaction.NetworkFlowName, nodeTransaction.NetworkOperationName, ExceptionUtils.GetDeepExceptionMessage(ex)); AppendAuditLogEvent("Another attempt to process the network transaction \"{0}\" will be made when the schedule runs again.", nodeTransaction.NetworkId); return(false); } }
private Notify NewStatusNotifyObject(string endpoint, string flow, string transactionId, CommonTransactionStatusCode status, string description) { Notify notify = NewSingleNotifyObject(endpoint, flow, NotificationMessageCategoryType.Status); notify.messages[0].messageName = string.Format("{0} Status", flow); notify.messages[0].objectId = transactionId; notify.messages[0].status = (TransactionStatusCode) Enum.Parse(typeof(TransactionStatusCode), status.ToString(), true); notify.messages[0].statusDetail = description; return(notify); }
private Notify NewEventNotifyObject(string endpoint, string flow, string messageName, CommonTransactionStatusCode status, string description, string eventName) { Notify notify = NewSingleNotifyObject(endpoint, flow, NotificationMessageCategoryType.Event); notify.messages[0].messageName = messageName; notify.messages[0].objectId = eventName; notify.messages[0].status = (TransactionStatusCode) Enum.Parse(typeof(TransactionStatusCode), status.ToString(), true); notify.messages[0].statusDetail = description; return(notify); }
public CommonTransactionStatusCode GetDocumentStatus(string transactionId, string id, out string statusDetail) { string statusDetailPriv = string.Empty; CommonTransactionStatusCode statusPriv = CommonTransactionStatusCode.Unknown; DoSimpleQueryForObjectDelegate <object>( TABLE_NAME, "TransactionId;Id", new object[] { transactionId, id }, "Status;StatusDetail", delegate(IDataReader reader, int rowNum) { statusPriv = EnumUtils.ParseEnum <CommonTransactionStatusCode>(reader.GetString(0)); statusDetailPriv = reader.GetString(1); return(null); }); statusDetail = statusDetailPriv; return(statusPriv); }
public IList <Document> GetDocumentsByStatus(string transactionId, CommonTransactionStatusCode returnDocsWithStatus) { List <Document> documents = null; string whereColumns = "TransactionId;" + GetDbInGroupFromFlagsEnum("Status", returnDocsWithStatus); DoSimpleQueryWithRowCallbackDelegate( TABLE_NAME, whereColumns, new object[] { transactionId }, null, MAP_DOCUMENT_COLUMNS, delegate(IDataReader reader) { Document document = MapDocument(reader); if (documents == null) { documents = new List <Document>(); } documents.Add(document); }); return(documents); }
public void CreateDocument(string transactionId, string id, CommonContentType documentType, string documentName, string documentId, CommonTransactionStatusCode documentStatus, string documentStatusDetail) { try { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException("document id"); } DoInsert(TABLE_NAME, "Id;TransactionId;DocumentName;Type;DocumentId;Status;StatusDetail", id, transactionId, documentName ?? string.Empty, documentType.ToString(), documentId ?? string.Empty, documentStatus.ToString(), documentStatusDetail ?? string.Empty); } catch (Spring.Dao.DataIntegrityViolationException e) { throw new ArgumentException(string.Format("The document \"{0}\" already exists for the transaction \"{1}\"", documentName ?? string.Empty, transactionId), e); } }
private Notify NewDocumentNotifyObject(string endpoint, string flow, CommonTransactionStatusCode status, string description, string[] documentIds) { if (CollectionUtils.IsNullOrEmpty(documentIds)) { throw new ArgumentNullException("Document ids cannot be null or empty"); } Notify notify = NewNotifyObject(endpoint, flow); notify.messages = new NotificationMessageType[documentIds.Length]; for (int i = 0; i < documentIds.Length; ++i) { NotificationMessageType notification = new NotificationMessageType(); notification.messageCategory = NotificationMessageCategoryType.Document; notification.messageName = string.Format("{0} Document", flow); notification.objectId = documentIds[i]; notification.status = (TransactionStatusCode) Enum.Parse(typeof(TransactionStatusCode), status.ToString(), true); notification.statusDetail = description; notify.messages[i] = notification; } return(notify); }
public void ProcessSubmit(string transactionId) { LOG.Info("NCT.ProcessSubmit()"); AppendAuditLogEvent("NCT ProcessSubmit() enter"); LazyInit(); IList <string> dbDocIds = _transactionManager.GetAllUnprocessedDocumentDbIds(transactionId); if (!CollectionUtils.IsNullOrEmpty(dbDocIds)) { foreach (string dbDocId in dbDocIds) { Document document = _documentManager.GetDocument(transactionId, dbDocId, true); _documentManager.SetDocumentStatus(transactionId, dbDocId, CommonTransactionStatusCode.Processed, "Processed " + dbDocId); string statusDetail; CommonTransactionStatusCode status = _documentManager.GetDocumentStatus(transactionId, dbDocId, out statusDetail); } } AddReportDocumentToTransaction(transactionId, true); AppendAuditLogEvent("NCT ProcessSubmit() exit"); }
protected bool ProcessOutstandingTransaction(NodeTransaction nodeTransaction) { if (string.IsNullOrEmpty(nodeTransaction.NetworkId) || string.IsNullOrEmpty(nodeTransaction.NetworkEndpointUrl)) { return(false); } try { if (HasTransactionBeenProcessed(nodeTransaction)) { return(false); } Type xmlDataType = GetServiceXmlType(nodeTransaction.NetworkOperationName); if (xmlDataType == null) { throw new ArgumentException(string.Format("This service does not support the RCRA xml service \"{0}\"", nodeTransaction.NetworkOperationName)); } AppendAuditLogEvent("*** Begin processing network solicit transaction \"{0}\" to {1} service \"{2}\" ...", nodeTransaction.NetworkId, nodeTransaction.NetworkFlowName, nodeTransaction.NetworkOperationName); AppendAuditLogEvent("Checking status of the network transaction \"{0}\" associated with the local transaction \"{1}\" ...", nodeTransaction.NetworkId, nodeTransaction.Id); TransactionStatus transactionStatus = _transactionManager.RefreshNetworkStatus(nodeTransaction.Id); CommonTransactionStatusCode currentStatus = transactionStatus.Status; AppendAuditLogEvent("The network transaction \"{0}\" associated with the local transaction \"{1}\" has a network status of \"{2}\" ...", nodeTransaction.NetworkId, nodeTransaction.Id, currentStatus.ToString()); if (currentStatus == CommonTransactionStatusCode.Completed) { AppendAuditLogEvent("Attempting to download documents for the network transaction \"{0}\" ...", nodeTransaction.NetworkId); _transactionManager.DownloadNetworkDocumentsAndAddToTransaction(nodeTransaction.Id, out currentStatus); AppendAuditLogEvent("Any documents associated with the network transaction \"{0}\" were downloaded and saved.", nodeTransaction.NetworkId); Document document = GetRCRAXmlDocument(nodeTransaction); if (document == null) { AppendAuditLogEvent("A RCRA xml document could not be found for the network transaction \"{0}\"", nodeTransaction.NetworkId); return(false); } else { AppendAuditLogEvent("A RCRA xml document, \"{0},\" was found for the network transaction \"{1}\"", document.DocumentName, nodeTransaction.NetworkId); } string successMessage = InsertDocumentIntoDatabase(xmlDataType, nodeTransaction, document); SaveStringAndAddToTransaction(successMessage, COMPLETED_RESULTS_FILE_NAME, _settingsProvider, null, _documentManager, nodeTransaction.Id, true); return(true); } else if (currentStatus == CommonTransactionStatusCode.Failed) { AppendAuditLogEvent("RCRA data associated with solicit transaction \"{0}\" cannot be loading into the database since the status of the transaction is \"{1}\"", nodeTransaction.NetworkId, currentStatus.ToString()); return(false); } else { AppendAuditLogEvent("Another attempt to process the network transaction \"{0}\" will be made when the schedule runs again.", nodeTransaction.NetworkId); return(false); } } catch (Exception ex) { AppendAuditLogEvent("ERROR: Failed to process network solicit transaction \"{0}\" to {1} service \"{2}\" with exception: {3}.", nodeTransaction.NetworkId, nodeTransaction.NetworkFlowName, nodeTransaction.NetworkOperationName, ExceptionUtils.GetDeepExceptionMessage(ex)); AppendAuditLogEvent("Another attempt to process the network transaction \"{0}\" will be made when the schedule runs again.", nodeTransaction.NetworkId); return(false); } }
protected virtual bool OnTransactionStatusChanged(NodeTransaction transaction, INodeEndpointClient endpointClient, CommonTransactionStatusCode newStatusCode) { return(true); }
public TransactionStatus(string id, CommonTransactionStatusCode status, string description) : base(id) { _status = status; _description = description; }
public TransactionStatus(string id, CommonTransactionStatusCode status) : this(id, status, string.Empty) { }
protected void ProcessSubmitTransaction(string transactionId) { using (INodeProcessorMutex mutex = GetMutex(transactionId)) { if (!mutex.IsAcquired) { LOG.Debug("Exiting ProcessTransactionRequest(), could not acquire mutex for transaction {0}", transactionId); return; // Another thread is already working on this transaction, get out of here } // Make sure the transaction has not been processed yet string transactionModifiedBy; if (!TransactionManager.IsUnprocessed(transactionId, out transactionModifiedBy)) { LOG.Debug("Exiting ProcessSubmitTransaction(), transaction {0} has already been processed", transactionId); return; } DateTime startTime = DateTime.Now; Activity activity = new Activity(NodeMethod.Submit, null, null, ActivityType.Info, transactionId, NetworkUtils.GetLocalIp(), "Start processing submit transaction: \"{0}\"", transactionId); activity.ModifiedById = transactionModifiedBy; try { TransactionManager.SetTransactionStatus(transactionId, CommonTransactionStatusCode.Pending, "Processing submit transaction", false); // Get the document processing service string flowName, operation; DataService submitService = TransactionManager.GetSubmitDocumentServiceForTransaction(transactionId, out flowName, out operation); if (submitService == null) { if (!string.IsNullOrEmpty(operation)) { throw new ArgumentException(string.Format("A valid Submit service was not found for the flow \"{0}\" and operation \"{1}\"", flowName, operation)); } // Let empty operation pass through, even without a valid service, per Mark } else if (!submitService.IsActive) { throw new ArgumentException(string.Format("The Submit service is not active for the flow \"{0}\" and operation \"{1}\"", flowName, operation)); } if (submitService == null) { activity.Append("No service found for Submit transaction"); TransactionStatus transactionStatus = TransactionManager.SetTransactionStatusIfNotStatus(transactionId, CommonTransactionStatusCode.ReceivedUnprocessed, "Received unprocessed submit transaction", CommonTransactionStatusCode.Received, true); activity.AppendFormat("Transaction status set to \"{0}\"", transactionStatus.Status.ToString()); } else { CommonTransactionStatusCode submitTransactionStatus = CommonTransactionStatusCode.Processed; string submitTransactionStatusDetail = "Finished processing submit transaction"; ISubmitProcessor submitProcessor; using (IPluginDisposer disposer = PluginLoader.LoadSubmitProcessor(submitService, out submitProcessor)) { TransactionManager.SetTransactionStatus(transactionId, CommonTransactionStatusCode.Processing, "Processing submit transaction", true); activity.Append("Set transaction status to Processing"); activity.AppendFormat("Processing Submit transaction for flow \"{0}\" and operation \"{1}\" using plugin \"{2}\"", flowName, operation, submitProcessor.GetType().FullName); try { ISubmitProcessorEx submitProcessorEx = submitProcessor as ISubmitProcessorEx; if (submitProcessorEx != null) { submitTransactionStatus = submitProcessorEx.ProcessSubmitAndReturnStatus(transactionId, out submitTransactionStatusDetail); activity.AppendFormat("Submit processing plugin returned status of \"{0}\"", submitTransactionStatus.ToString()); } else { submitProcessor.ProcessSubmit(transactionId); } } finally { activity.Append(submitProcessor.GetAuditLogEvents()); } TimeSpan processLength = DateTime.Now - startTime; activity.AppendFormat("Process time: {0}", processLength.ToString()); } activity.Append("Finished processing submit transaction"); TransactionStatus transactionStatus = TransactionManager.SetTransactionStatusIfNotStatus(transactionId, submitTransactionStatus, submitTransactionStatusDetail, CommonTransactionStatusCode.Received | CommonTransactionStatusCode.Completed | CommonTransactionStatusCode.Failed, true); activity.AppendFormat("Transaction status set to \"{0}\"", transactionStatus.Status.ToString()); activity.AppendFormat(TransactionManager.DoTransactionNotifications(transactionId)); } } catch (Exception e) { LOG.Error("ProcessSubmitTransaction() threw an exception.", e); TransactionStatus transactionStatus = TransactionManager.SetTransactionStatusIfNotStatus(transactionId, CommonTransactionStatusCode.Failed, e.Message, CommonTransactionStatusCode.Received, true); activity.AppendFormat("Transaction status set to \"{0}\"", transactionStatus.Status.ToString()); activity.Append(ExceptionUtils.ToShortString(e)); activity.Type = ActivityType.Error; activity.AppendFormat(TransactionManager.DoTransactionNotifications(transactionId)); } finally { ActivityManager.Log(activity); } } }
public string AddDocumentDontAutoCompress(string transactionId, CommonTransactionStatusCode status, string statusDetail, string filePath) { return(AddDocument(transactionId, status, statusDetail, filePath, true)); }