private void SendThreads(IEnumerable <ConversationInfo> conversationInfoList) { if (conversationInfoList == null || !conversationInfoList.Any()) { return; } ThreadsInfo threadsInfo = new ThreadsInfo(); foreach (ConversationInfo conversationInfo in conversationInfoList) { // Debug //Tracer.Warning("conversationInfo: DocId = {0}, convIndex = {1}", conversationInfo.DocId, conversationInfo.ConversationIndex); string docReferenceId = conversationInfo.DocId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } // Sanitize the value conversationInfo.ConversationIndex = String.IsNullOrEmpty(conversationInfo.ConversationIndex) ? null : conversationInfo.ConversationIndex; // On Append we only calculate relationships between new documents, therefore we don't even send standalone documents to Linker if (_jobParams.ImportOptions == ImportOptionsBEO.AppendNew && conversationInfo.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, conversationInfo.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } SendThreads(threadsInfo); }
public ThreadsInfoResult(ThreadsInfo threadsInfo) { Threads = threadsInfo.Threads.Select(t => new ThreadPreviewInfoResult(t)).ToList(); StartIndex = threadsInfo.StartIndex; Size = threadsInfo.Size; Amount = threadsInfo.Amount; }
private void SendThreads(ThreadsInfo threadsInfo) { Pipe familiesAndThreadsPipe = GetOutputDataPipe("ThreadsLinker"); familiesAndThreadsPipe.ShouldNotBe(null); var message = new PipeMessageEnvelope() { Body = threadsInfo }; familiesAndThreadsPipe.Send(message); }
/// <summary> /// Create a model which contains data about flight /// </summary> /// <param name="model">Data from service</param> /// <returns>Data about flight</returns> private FlyInfo CreateFlyInfo(ThreadsInfo model) { return(new FlyInfo { Arrival = model.Arrival, Duration = model.Duration, ArrivalTerminal = model.ArrivalTerminal, From = model.From.Title, ThreadCarrierTitle = model.Thread.Carrier.Title, ThreadVehicle = model.Thread.Vehicle, ThreadNumber = model.Thread.Number, Departure = model.Departure, To = model.To.Title }); }
private void SendThreads(ThreadsInfo threadsInfo) { if (threadsInfo == null || threadsInfo.ThreadInfoList == null || !threadsInfo.ThreadInfoList.Any()) { return; } Pipe familiesAndThreadsPipe = GetOutputDataPipe("ThreadsLinker"); familiesAndThreadsPipe.ShouldNotBe(null); var message = new PipeMessageEnvelope() { Body = threadsInfo }; familiesAndThreadsPipe.Send(message); }
private void SendRelationshipsInfo(IEnumerable <DocumentDetail> documentDetailList) { bool familiesLinkingRequested = _jobParameter.IsImportFamilyRelations; bool threadsLinkingRequested = _jobParameter.IsMapEmailThread; FamiliesInfo familiesInfo = familiesLinkingRequested ? new FamiliesInfo() : null; ThreadsInfo threadsInfo = threadsLinkingRequested ? new ThreadsInfo() : null; foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } // Debug //Tracer.Warning("DOCID {0} corresponds to the document {1}", doc.document.FieldList[0].FieldValue, docReferenceId.Hint(4)); //if (docReferenceId.Hint(4) == "AFE1") //{ // Tracer.Warning("STOP!"); //} if (familiesLinkingRequested && !String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(doc.document.EVLoadFileParentId) ? null : doc.document.EVLoadFileParentId; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } // Family has priority over thread, so if the document is part of the family we ignore its thread //if (familyInfoRecord.OriginalParentId != null) //{ // //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, ConversationIndex reset to null", familyInfoRecord.OriginalDocumentId); // doc.ConversationIndex = null; //} familiesInfo.FamilyInfoList.Add(familyInfoRecord); } // BEWARE: doc.document.ConversationIndex is not the right thing!! if (threadsLinkingRequested) { // Sanitize the value doc.ConversationIndex = String.IsNullOrEmpty(doc.ConversationIndex) ? null : doc.ConversationIndex; // Debug //Tracer.Warning("SendRelationshipsInfo: CollectionId = {0}", doc.document.CollectionId); var threadInfo = new ThreadInfo(docReferenceId, doc.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } } if (threadsLinkingRequested && threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesLinkingRequested && familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
private void SendRelationshipsInfo(IEnumerable <DocumentDetail> documentDetailList) { bool familiesLinkingRequested = _jobParameter.IsImportFamilyRelations; bool threadsLinkingRequested = _jobParameter.IsMapEmailThread; FamiliesInfo familiesInfo = familiesLinkingRequested ? new FamiliesInfo() : null; ThreadsInfo threadsInfo = threadsLinkingRequested ? new ThreadsInfo() : null; foreach (DocumentDetail doc in documentDetailList) { if (doc.docType != DocumentsetType.NativeSet) { continue; // Only original documents may participate in relationships } string docReferenceId = doc.document.DocumentId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (familiesLinkingRequested && !String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId)) { // We don't skip standalone documents for Families, because they always can appear to be topmost parents. // And also we need all of them to provide Original to Real Id translation. FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(doc.document.EVLoadFileParentId) ? null : doc.document.EVLoadFileParentId; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } // BEWARE: doc.document.ConversationIndex is not the right thing!! if (threadsLinkingRequested) { // Sanitize the value doc.ConversationIndex = String.IsNullOrEmpty(doc.ConversationIndex) ? null : doc.ConversationIndex; // On Append we only calculate relationships between new documents, // therefore we don't even send standalone documents to threads linker if (doc.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, doc.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } } if (threadsLinkingRequested && threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesLinkingRequested && familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
private void SendRelationshipsInfo(IEnumerable <EmailThreadingEntity> rawDocumentRelationships) { // For eDocs we ALWAYS send relationships info //if (!m_Parameters.IsImportFamilyRelations) //{ // return; //} FamiliesInfo familiesInfo = new FamiliesInfo(); ThreadsInfo threadsInfo = new ThreadsInfo(); foreach (EmailThreadingEntity emailThreadingEntity in rawDocumentRelationships) { string docReferenceId = emailThreadingEntity.ChildDocumentID; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (emailThreadingEntity.RelationshipType == ThreadRelationshipEntity.RelationshipType.OutlookEmailThread) { // Sanitize the value emailThreadingEntity.ConversationIndex = String.IsNullOrEmpty(emailThreadingEntity.ConversationIndex) ? null : emailThreadingEntity.ConversationIndex; // On Append we only calculate relationships between new documents, // therefore we don't even send standalone documents to threads linker if (emailThreadingEntity.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, emailThreadingEntity.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } else { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = docReferenceId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(emailThreadingEntity.ParentDocumentID) ? null : emailThreadingEntity.ParentDocumentID; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } const int BatchSize = 500; if (threadsInfo.ThreadInfoList.Count >= BatchSize) { SendThreads(threadsInfo); threadsInfo.ThreadInfoList.Clear(); } if (familiesInfo.FamilyInfoList.Count >= BatchSize) { SendFamilies(familiesInfo); familiesInfo.FamilyInfoList.Clear(); } } if (threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
private void SendRelationshipsInfo(IEnumerable<EmailThreadingEntity> rawDocumentRelationships) { // For eDocs we ALWAYS send relationships info //if (!m_Parameters.IsImportFamilyRelations) //{ // return; //} FamiliesInfo familiesInfo = new FamiliesInfo(); ThreadsInfo threadsInfo = new ThreadsInfo(); foreach (EmailThreadingEntity emailThreadingEntity in rawDocumentRelationships) { string docReferenceId = emailThreadingEntity.ChildDocumentID; if (String.IsNullOrEmpty(docReferenceId)) { continue; } if (emailThreadingEntity.RelationshipType == ThreadRelationshipEntity.RelationshipType.OutlookEmailThread) { // Sanitize the value emailThreadingEntity.ConversationIndex = String.IsNullOrEmpty(emailThreadingEntity.ConversationIndex) ? null : emailThreadingEntity.ConversationIndex; // On Append we only calculate relationships between new documents, // therefore we don't even send standalone documents to threads linker if (emailThreadingEntity.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, emailThreadingEntity.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } else { // We don't skip standalone documents for Families, because they always can appear to be topmost parents FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId); familyInfoRecord.OriginalDocumentId = docReferenceId; familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(emailThreadingEntity.ParentDocumentID) ? null : emailThreadingEntity.ParentDocumentID; //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}", // familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId); if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture)) { //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId); familyInfoRecord.OriginalParentId = null; // Document must not be its own parent } familiesInfo.FamilyInfoList.Add(familyInfoRecord); } const int BatchSize = 500; if (threadsInfo.ThreadInfoList.Count >= BatchSize) { SendThreads(threadsInfo); threadsInfo.ThreadInfoList.Clear(); } if (familiesInfo.FamilyInfoList.Count >= BatchSize) { SendFamilies(familiesInfo); familiesInfo.FamilyInfoList.Clear(); } } if (threadsInfo.ThreadInfoList.Any()) { SendThreads(threadsInfo); } if (familiesInfo.FamilyInfoList.Any()) { SendFamilies(familiesInfo); } }
private void CodeHelper_StartingExecution(object sender, EventArgs e) { new PermissionSet(PermissionState.Unrestricted).Assert(); // we start here monitoring thread _compilationCompleted.Set(); _threadsBefore = ThreadsInfo.Gather(); Debug.WriteLine("Initial thread info gathered"); _executingThreadID = WinApiHelper.GetCurrentThreadId(); _compileTime = DateTime.Now - _runAt; _memoryUsedAfterCompilation = AppDomain.CurrentDomain.MonitoringTotalAllocatedMemorySize; PermissionSet.RevertAssert(); }
private void SendThreads(IEnumerable<ConversationInfo> conversationInfoList) { if (conversationInfoList == null || !conversationInfoList.Any()) { return; } ThreadsInfo threadsInfo = new ThreadsInfo(); foreach (ConversationInfo conversationInfo in conversationInfoList) { // Debug //Tracer.Warning("conversationInfo: DocId = {0}, convIndex = {1}", conversationInfo.DocId, conversationInfo.ConversationIndex); string docReferenceId = conversationInfo.DocId; if (String.IsNullOrEmpty(docReferenceId)) { continue; } // Sanitize the value conversationInfo.ConversationIndex = String.IsNullOrEmpty(conversationInfo.ConversationIndex) ? null : conversationInfo.ConversationIndex; // On Append we only calculate relationships between new documents, therefore we don't even send standalone documents to Linker if (_jobParams.ImportOptions == ImportOptionsBEO.AppendNew && conversationInfo.ConversationIndex == null) { continue; } var threadInfo = new ThreadInfo(docReferenceId, conversationInfo.ConversationIndex); threadsInfo.ThreadInfoList.Add(threadInfo); } SendThreads(threadsInfo); }