/// <summary> /// Transform data from base class to derved class entity. /// </summary> /// <param name="emailDocument"> base class entity emailDocumentEntity to be transformed </param> /// <returns> final outlook email document entity </returns> private static OutlookEMailDocumentEntity TransformEmailDocumentEntityToOutlookEMailDocument(EmailDocumentEntity emailDocument) { OutlookEMailDocumentEntity outlookEMailDocumentEntity = new OutlookEMailDocumentEntity { DocumentID = emailDocument.DocumentID, MIMEType = emailDocument.MIMEType, }; outlookEMailDocumentEntity.Files.AddRange(emailDocument.Files); outlookEMailDocumentEntity.Tags.AddRange(emailDocument.Tags); outlookEMailDocumentEntity.MessageID = emailDocument.MessageID; #region Unused logical properties - use them when required. /* * Below are logical properties in a email document entity - they are not needed in current system, hence to improve performance commenting out this code. * This shall be used need basis * outlookEMailDocumentEntity.DateReceived = emailDocument.DateReceived; * outlookEMailDocumentEntity.DateSent = emailDocument.DateSent; * outlookEMailDocumentEntity.From = emailDocument.From; * outlookEMailDocumentEntity.IsDeliveryReceiptSet = emailDocument.IsDeliveryReceiptSet; * outlookEMailDocumentEntity.IsReadReceiptSet = emailDocument.IsReadReceiptSet; * outlookEMailDocumentEntity.Subject = emailDocument.Subject; * outlookEMailDocumentEntity.To = emailDocument.To; * */ #endregion return(outlookEMailDocumentEntity); }
/// <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> /// Create OutlookEmailDocumentObject using deserialized object's data /// </summary> /// <param name="documentEntities"> Document Entity to be transformed </param> /// <returns> list of outlook email documents </returns> private IEnumerable <OutlookEMailDocumentEntity> InitializeOutlookEdrmEntities(IEnumerable <EmailDocumentEntity> documentEntities) { List <OutlookEMailDocumentEntity> outlookEmailDocumentEntities = new List <OutlookEMailDocumentEntity>(); foreach (EmailDocumentEntity document in documentEntities) { OutlookEMailDocumentEntity outlookEmailDocument = TransformEmailDocumentEntityToOutlookEMailDocument(document); #region Unused logical properties - use them when required. /* * Below are logical properties in a Outlook email document entity - they are not needed in current system, hence to improve performance commenting out this code. * This shall be used need basis * * tagEntity = document.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(constants.TagNameEmailClient)); * outlookEmailDocument.EmailClient = (tagEntity != null) ? tagEntity.TagValue.ToString() : string.Empty; * * tagEntity = document.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(constants.TagNameMessageClass)); * outlookEmailDocument.MessageClass = (tagEntity != null) ? tagEntity.TagValue.ToString() : string.Empty; * * tagEntity = document.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(constants.TagNameSecurityFlags)); * outlookEmailDocument.SecurityFlags = (tagEntity != null) ? tagEntity.TagValue.ToString() : string.Empty; * * tagEntity = document.Tags.FirstOrDefault<TagEntity>(p => p.TagName.ToString().Equals(constants.TagNameSensitivity)); * outlookEmailDocument.Sensitivity = (tagEntity != null) ? tagEntity.TagValue.ToString() : string.Empty; * */ #endregion TagEntity tagEntity = document.Tags.FirstOrDefault <TagEntity>(p => p.TagName.ToString().Equals(OutlookEdrmManagerConstants.TagNameConversationIndex)); outlookEmailDocument.ConversationIndex = (tagEntity != null)? tagEntity.TagValue.ToString() : string.Empty; tagEntity = document.Tags.FirstOrDefault <TagEntity>(p => p.TagName.ToString().Equals(OutlookEdrmManagerConstants.TagNameConversationTopic)); outlookEmailDocument.ConversationTopic = (tagEntity != null) ? tagEntity.TagValue.ToString() : string.Empty; tagEntity = document.Tags.FirstOrDefault <TagEntity>(p => p.TagName.ToString().Equals(OutlookEdrmManagerConstants.TagNameInReplyToId)); outlookEmailDocument.InReplyToID = (tagEntity != null) ? tagEntity.TagValue.ToString() : string.Empty; tagEntity = document.Tags.FirstOrDefault <TagEntity>(p => p.TagName.ToString().Equals(OutlookEdrmManagerConstants.TagNameEntryId)); outlookEmailDocument.EntryId = (tagEntity != null) ? tagEntity.TagValue.ToString() : string.Empty; outlookEmailDocumentEntities.Add(outlookEmailDocument); } return(outlookEmailDocumentEntities); }
/// <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> /// Transform data from base class to derved class entity. /// </summary> /// <param name="emailDocument"> base class entity emailDocumentEntity to be transformed </param> /// <returns> final outlook email document entity </returns> private static OutlookEMailDocumentEntity TransformEmailDocumentEntityToOutlookEMailDocument(EmailDocumentEntity emailDocument) { OutlookEMailDocumentEntity outlookEMailDocumentEntity = new OutlookEMailDocumentEntity { DocumentID = emailDocument.DocumentID, MIMEType = emailDocument.MIMEType, }; outlookEMailDocumentEntity.Files.AddRange(emailDocument.Files); outlookEMailDocumentEntity.Tags.AddRange(emailDocument.Tags); outlookEMailDocumentEntity.MessageID = emailDocument.MessageID; #region Unused logical properties - use them when required. /* * Below are logical properties in a email document entity - they are not needed in current system, hence to improve performance commenting out this code. * This shall be used need basis outlookEMailDocumentEntity.DateReceived = emailDocument.DateReceived; outlookEMailDocumentEntity.DateSent = emailDocument.DateSent; outlookEMailDocumentEntity.From = emailDocument.From; outlookEMailDocumentEntity.IsDeliveryReceiptSet = emailDocument.IsDeliveryReceiptSet; outlookEMailDocumentEntity.IsReadReceiptSet = emailDocument.IsReadReceiptSet; outlookEMailDocumentEntity.Subject = emailDocument.Subject; outlookEMailDocumentEntity.To = emailDocument.To; */ #endregion return outlookEMailDocumentEntity; }