/// <summary> /// Toes the business entity. /// </summary> /// <param name="relationShipBeo">The relation ship beo.</param> /// <param name="jobRunId">The job run id.</param> /// <param name="threadingConstraint">The threading constraint.</param> /// <param name="relationshipType">Type of the relation ship.</param> /// <returns></returns> public static EmailThreadingEntity ToDataAccesEntity(this RelationshipBEO relationShipBeo, long jobRunId, string threadingConstraint, ThreadRelationshipEntity.RelationshipType relationshipType) { EmailThreadingEntity toReturn = new EmailThreadingEntity() { JobRunID = jobRunId, ChildDocumentID = relationShipBeo.ChildDocumentId, ParentDocumentID = relationShipBeo.ParentDocId, RelationshipType = relationshipType, ThreadingConstraint = threadingConstraint, FamilyID = relationShipBeo.FamilyDocumentId }; // Debug //Tracer.Warning("Subj: ChildDocId: {0}, ParentDocId: {1}", relationShipBeo.ChildDocumentId, toReturn.ParentDocumentID); return(toReturn); }
/// <summary> /// Toes the business entity. /// </summary> /// <param name="relationShipBeo">The relation ship beo.</param> /// <param name="jobRunId">The job run id.</param> /// <param name="threadingConstraint">The threading constraint.</param> /// <param name="relationshipType">Type of the relation ship.</param> /// <returns></returns> public static EmailThreadingEntity ToDataAccesEntity(this RelationshipBEO relationShipBeo, long jobRunId, string threadingConstraint, ThreadRelationshipEntity.RelationshipType relationshipType) { EmailThreadingEntity toReturn = new EmailThreadingEntity() { JobRunID = jobRunId, ChildDocumentID = relationShipBeo.ChildDocumentId, ParentDocumentID = relationShipBeo.ParentDocId, RelationshipType = relationshipType, ThreadingConstraint = threadingConstraint, FamilyID = relationShipBeo.FamilyDocumentId }; // Debug //Tracer.Warning("Subj: ChildDocId: {0}, ParentDocId: {1}", relationShipBeo.ChildDocumentId, toReturn.ParentDocumentID); return toReturn; }
/// <summary> /// converts OutLookEmailDocumentEntity to EmailThreadEntity /// </summary> /// <param name="outlookEmailDocumentEntity">The outlook email document entity.</param> /// <param name="jobRunId">The job run id.</param> /// <param name="threadingConstraint">The threading constraint.</param> /// <param name="relationshipType">Type of the relation ship.</param> /// <returns></returns> private EmailThreadingEntity ToEmailThreadEntity(OutlookEMailDocumentEntity outlookEmailDocumentEntity, long jobRunId, string threadingConstraint, ThreadRelationshipEntity.RelationshipType relationshipType) { EmailThreadingEntity toReturn = new EmailThreadingEntity() { JobRunID = jobRunId, ChildDocumentID = GetEmailDocumentIDFromConversationIndex(outlookEmailDocumentEntity.ConversationIndex), ParentDocumentID = GetParentDocumentId(outlookEmailDocumentEntity.ConversationIndex), RelationshipType = relationshipType, ThreadingConstraint = threadingConstraint, FamilyID = GetFamilyId(outlookEmailDocumentEntity.ConversationIndex), ConversationIndex = outlookEmailDocumentEntity.ConversationIndex }; // Debug //Tracer.Warning("Subj: {0} DocId: {1}", outlookEmailDocumentEntity.ConversationTopic, toReturn.ChildDocumentID); return(toReturn); }
/// <summary> /// converts OutLookEmailDocumentEntity to EmailThreadEntity /// </summary> /// <param name="outlookEmailDocumentEntity">The outlook email document entity.</param> /// <param name="jobRunId">The job run id.</param> /// <param name="threadingConstraint">The threading constraint.</param> /// <param name="relationshipType">Type of the relation ship.</param> /// <returns></returns> private EmailThreadingEntity ToEmailThreadEntity(OutlookEMailDocumentEntity outlookEmailDocumentEntity, long jobRunId, string threadingConstraint, ThreadRelationshipEntity.RelationshipType relationshipType) { EmailThreadingEntity toReturn = new EmailThreadingEntity() { JobRunID = jobRunId, ChildDocumentID = GetEmailDocumentIDFromConversationIndex(outlookEmailDocumentEntity.ConversationIndex), ParentDocumentID = GetParentDocumentId(outlookEmailDocumentEntity.ConversationIndex), RelationshipType = relationshipType, ThreadingConstraint = threadingConstraint, FamilyID = GetFamilyId(outlookEmailDocumentEntity.ConversationIndex), ConversationIndex = outlookEmailDocumentEntity.ConversationIndex }; // Debug //Tracer.Warning("Subj: {0} DocId: {1}", outlookEmailDocumentEntity.ConversationTopic, toReturn.ChildDocumentID); return toReturn; }
/// <summary> /// Transforms Outlook specific EDRM file to Document Business Entity /// </summary> /// <param name="edrmFileName">EDRM file to be transformed</param> /// <param name="currentDocumentIndex"> Index of current document in list of documents being extracted /// Null able column - can be null when percent complete need not be calculated. /// </param> /// <returns> /// EvDocumentDataEntity that abstracts documents and relationships /// </returns> private EvDocumentDataEntity TransformOutlookEDRMToDocumentBusinessEntity(string edrmFileName, string mailStorePath, int?currentDocumentIndex) { try { OutlookEdrmManager outlookEdrmManager = new OutlookEdrmManager(edrmFileName); List <RelationshipBEO> relationships = new List <RelationshipBEO>(); outlookEdrmManager.GetDocumentIdFromConversationIndex += GetUniqueEmailDocumentIDFromConversationIndex; List <RVWDocumentBEO> documents = outlookEdrmManager.GetDocuments(FilterByMappedFields, DatasetBeo.Matter.FolderID, DatasetBeo.CollectionId.ToString(), ref relationships); //Replace EVCorlib Mail Message file extension with CNEV file extension documents.ForEach (doc => doc.FileExtension = doc.FileExtension.Replace(Constants.EVCorlibEMailMessageExtension, Constants.CNEvEmailMessageExtension)); UpdateNativeDocumentFileNameForEMailMessages(documents); // Adding created By property for each documents documents.ForEach(x => x.CreatedBy = DatasetBeo.CreatedBy); #region Create Ev Document Data Entity and raise event for processing/importing available documents EvDocumentDataEntity evDocumentDataEntity = new EvDocumentDataEntity() { Documents = documents, OutlookMailStoreDataEntity = new OutlookMailStoreEntity { EntryIdAndEmailMessagePairs = GetEMailAndEntryIdPairs(outlookEdrmManager, edrmFileName), PSTFile = new FileInfo(mailStorePath) }, PercentComplete = currentDocumentIndex ?? (100.00 / FileProcessorInstance.EntryIdsCount) * currentDocumentIndex.Value }; #endregion Create Ev Document Data Entity and raise event for processing/importing available documents // raise event as the document processing completes if (EvDocumentDataEntityAvailable != null) { EvDocumentDataEntityAvailable(evDocumentDataEntity); } #region insert temporary records for thread calculation List <EmailThreadingEntity> lstEmailThreadEntities = new List <EmailThreadingEntity>(); if (relationships != null && relationships.Count > 0) { foreach (var relation in relationships) { EmailThreadingEntity ete = relation.ToDataAccesEntity(batchIdentifier, ThreadingConstraint, ThreadRelationshipEntity.RelationshipType.OutlookAttachment); lstEmailThreadEntities.Add(ete); } } IEnumerable <OutlookEMailDocumentEntity> outlookEmails = outlookEdrmManager.OutlookEmailDocumentEntities; // store temporary record for calculating email relationship if (outlookEmails != null && outlookEmails.Any()) { List <OutlookEMailDocumentEntity> lstOutLookEmails = new List <OutlookEMailDocumentEntity>(); foreach (OutlookEMailDocumentEntity outLookEmail in outlookEmails) { if ((!string.IsNullOrEmpty(outLookEmail.ConversationIndex)) && outLookEmail.ConversationIndex.Length >= 44) { lstOutLookEmails.Add(outLookEmail); } } lstOutLookEmails.ForEach(outLookEmail => lstEmailThreadEntities.Add( ToEmailThreadEntity( outLookEmail, batchIdentifier, ThreadingConstraint, ThreadRelationshipEntity.RelationshipType.OutlookEmailThread))); } //Used Bulk Add Temp Relationships in EmailThreadingHelper if (lstEmailThreadEntities.Any()) { //EmailThreadingHelper.BulkAddRelationshipTemporaryRecord(lstEmailThreadEntities); _documentRelationships.AddRange(lstEmailThreadEntities); } #endregion // Cleanup if delete non native files is set if (IsDeleteTemporaryFiles == DeleteExtractedFilesOptions.DeleteNonNativeFiles) { outlookEdrmManager.DeleteNonNativeFiles(); } return(evDocumentDataEntity); } catch (EVException evException) { ((Exception)evException).Trace().Swallow(); } catch (Exception exception) { string errorCode = ErrorCodes.OutlookEDRMToDocumentTransformFailure; exception.AddErrorCode(errorCode).Trace().Swallow(); } return(null); }