示例#1
0
 internal ConversationThread(ConversationDataExtractor dataExtractor, ConversationThreadDataExtractor threadDataExtractor, IConversationTree threadTree, IConversationTreeFactory factory)
 {
     this.threadTree          = threadTree;
     this.dataExtractor       = dataExtractor;
     this.threadDataExtractor = threadDataExtractor;
     this.factory             = factory;
 }
        public ItemPart GetItemPart(IConversationTree conversationTree, StoreObjectId itemId)
        {
            IStorePropertyBag     propertyBag          = null;
            ItemPart              itemPart             = null;
            IConversationTreeNode conversationTreeNode = null;

            if (!conversationTree.TryGetConversationTreeNode(itemId, out conversationTreeNode) || !conversationTreeNode.TryGetPropertyBag(itemId, out propertyBag))
            {
                throw new ArgumentException("No ConversationTreeNode/PropertyBag can be found for the passed StoreObjectId");
            }
            if (!this.itemParts.TryGetValue(itemId, out itemPart))
            {
                this.LoadItemPart(conversationTree, propertyBag);
                itemPart = this.loadedItemParts[itemId];
            }
            if (itemPart is LoadedItemPart && !itemPart.DidLoadSucceed)
            {
                return(itemPart);
            }
            if (itemPart.UniqueFragmentInfo == null)
            {
                LoadedItemPart loadedItemPart = (LoadedItemPart)itemPart;
                ExtractionData extractionData;
                if (!this.CanSkipDiffing(conversationTree, loadedItemPart, out extractionData))
                {
                    BodyFragmentInfo parentBodyFragment = null;
                    if (conversationTreeNode.ParentNode.HasData)
                    {
                        StoreObjectId mainStoreObjectId = conversationTreeNode.ParentNode.MainStoreObjectId;
                        if (this.treeNodeBodyFragment.ContainsKey(mainStoreObjectId))
                        {
                            parentBodyFragment = this.treeNodeBodyFragment[mainStoreObjectId].Key;
                        }
                        else
                        {
                            LoadedItemPart loadedItemPart2 = null;
                            if (!this.loadedItemParts.TryGetValue(mainStoreObjectId, out loadedItemPart2))
                            {
                                IStorePropertyBag propertyBag2;
                                if (!conversationTreeNode.ParentNode.TryGetPropertyBag(mainStoreObjectId, out propertyBag2))
                                {
                                    throw new ArgumentException("No Property bag can be found for the passed StoreObjectId on the ParentNode");
                                }
                                this.LoadItemPart(conversationTree, propertyBag2);
                                loadedItemPart2 = this.loadedItemParts[mainStoreObjectId];
                            }
                            parentBodyFragment = loadedItemPart2.BodyFragmentInfo;
                        }
                    }
                    ConversationDataExtractor.DiffItemParts(parentBodyFragment, loadedItemPart);
                }
                else
                {
                    itemPart.UniqueFragmentInfo     = extractionData.ChildUniqueBody;
                    itemPart.DisclaimerFragmentInfo = extractionData.ChildDisclaimer;
                }
            }
            return(itemPart);
        }
 internal ThreadedConversation(ConversationStateFactory stateFactory, ConversationDataExtractor dataExtractor, ConversationId conversationId, IConversationTree conversationTree, IList <IConversationThread> conversationThreads)
 {
     this.conversationTree    = conversationTree;
     this.conversationId      = conversationId;
     this.dataExtractor       = dataExtractor;
     this.conversationThreads = conversationThreads;
     this.stateFactory        = stateFactory;
 }
示例#4
0
        public virtual Conversation CreateConversation(ConversationId conversationId, IList <StoreObjectId> folderIds, bool useFolderIdsAsExclusionList, bool isIrmEnabled, bool isSmimeSupported, string domainName, params PropertyDefinition[] requestedProperties)
        {
            HashSet <PropertyDefinition> hashSet                   = this.SanitizePropertiesRequested(requestedProperties);
            List <IStorePropertyBag>     queryResult               = this.MembersQuery.Query(conversationId, hashSet, folderIds, useFolderIdsAsExclusionList);
            IConversationTree            conversationTree          = this.TreeFactory.Create(queryResult, hashSet);
            ConversationStateFactory     stateFactory              = new ConversationStateFactory(this.Session, conversationTree);
            ConversationDataExtractor    conversationDataExtractor = this.DataExtractorFactory.Create(isIrmEnabled, hashSet, conversationId, conversationTree, isSmimeSupported, domainName);

            return(this.InternalCreateConversation(conversationId, conversationDataExtractor, stateFactory, conversationTree));
        }
 internal ConversationFamily(IMailboxSession mailboxSession, ConversationDataExtractor dataExtractor, ConversationId conversationFamilyId, IConversationTree conversationFamilyTree, ConversationId selectedConversationId, IConversationTree selectedConversationTree, IConversationTreeFactory selectedConversationTreeFactory)
 {
     this.conversationFamilyTree          = conversationFamilyTree;
     this.selectedConversationTree        = selectedConversationTree;
     this.conversationFamilyId            = conversationFamilyId;
     this.dataExtractor                   = dataExtractor;
     this.mailboxSession                  = mailboxSession;
     this.selectedConversationId          = selectedConversationId;
     this.selectedConversationTreeFactory = selectedConversationTreeFactory;
 }
        public IThreadedConversation CreateConversation(ConversationId conversationId, IList <StoreObjectId> folderIds, bool useFolderIdsAsExclusionList, bool isIrmEnabled, bool isSmimeSupported, string domainName, params PropertyDefinition[] requestedItemProperties)
        {
            ICollection <PropertyDefinition> defaultThreadProperties = ThreadedConversationFactory.DefaultThreadProperties;
            HashSet <PropertyDefinition>     hashSet = this.SanitizePropertiesRequested(requestedItemProperties, defaultThreadProperties);
            Dictionary <object, List <IStorePropertyBag> > aggregatedMessages = this.QueryMessages(conversationId, folderIds, useFolderIdsAsExclusionList, hashSet);
            IConversationTree         conversationTree          = this.CreateTree(hashSet, aggregatedMessages);
            ConversationStateFactory  stateFactory              = this.CreateStateFactory(conversationTree);
            List <IConversationTree>  threadTrees               = this.CreateThreadTrees(hashSet, aggregatedMessages);
            ConversationDataExtractor conversationDataExtractor = this.dataExtractorFactory.Create(isIrmEnabled, hashSet, conversationId, conversationTree, isSmimeSupported, domainName);

            return(this.InternalCreateConversation(conversationId, conversationDataExtractor, stateFactory, conversationTree, threadTrees, defaultThreadProperties));
        }
示例#7
0
        public ConversationFamily CreateConversation(ConversationId conversationId, IList <StoreObjectId> folderIds, bool useFolderIdsAsExclusionList, bool isIrmEnabled, bool isSmimeSupported, string domainName, params PropertyDefinition[] requestedProperties)
        {
            Util.ThrowOnNullArgument(conversationId, "conversationId");
            HashSet <PropertyDefinition> hashSet = this.conversationFamilyTreeFactory.CalculatePropertyDefinitionsToBeLoaded(requestedProperties);
            List <IStorePropertyBag>     list    = this.membersQuery.Query(this.ConversationFamilyId, hashSet, folderIds, useFolderIdsAsExclusionList);
            Dictionary <object, List <IStorePropertyBag> > dictionary = this.membersQuery.AggregateMembersPerField(ItemSchema.ConversationId, this.ConversationFamilyId, list);
            List <IStorePropertyBag> list2;

            if (!dictionary.TryGetValue(conversationId, out list2))
            {
                list2 = new List <IStorePropertyBag>();
                dictionary.Add(conversationId, list2);
            }
            IConversationTree         conversationTree = this.SelectedConversationTreeFactory.Create(list2, hashSet);
            ConversationDataExtractor dataExtractor    = this.dataExtractorFactory.Create(isIrmEnabled, hashSet, conversationId, conversationTree, isSmimeSupported, domainName);

            if (dictionary.Count > 1)
            {
                IConversationTree conversationFamilyTree = this.conversationFamilyTreeFactory.Create(list, hashSet);
                return(this.InternalCreateConversationFamilyWithSeveralConversations(dataExtractor, conversationFamilyTree, conversationId, conversationTree));
            }
            return(this.InternalCreateConversationFamilyWithSingleConversation(dataExtractor, conversationTree));
        }
示例#8
0
 protected virtual ConversationFamily InternalCreateConversationFamilyWithSingleConversation(ConversationDataExtractor dataExtractor, IConversationTree conversationTree)
 {
     return(new ConversationFamily(this.MailboxSession, dataExtractor, this.ConversationFamilyId, conversationTree, this.SelectedConversationTreeFactory));
 }
示例#9
0
 protected virtual Conversation InternalCreateConversation(ConversationId conversationId, ConversationDataExtractor conversationDataExtractor, ConversationStateFactory stateFactory, IConversationTree conversationTree)
 {
     return(new Conversation(conversationId, conversationTree, this.Session as MailboxSession, conversationDataExtractor, new ConversationTreeFactory(this.Session), stateFactory));
 }
        private IList <IConversationThread> CreateConversationThreads(IConversationTree tree, List <IConversationTree> threadTrees, ConversationDataExtractor conversationDataExtractor, ICollection <PropertyDefinition> requestedThreadProperties)
        {
            bool isSingleThreadConversation = threadTrees.Count == 1;
            ConversationThreadDataExtractor threadDataExtractor = new ConversationThreadDataExtractor(requestedThreadProperties, tree, isSingleThreadConversation);
            IList <IConversationThread>     list = new List <IConversationThread>();

            foreach (IConversationTree threadTree in threadTrees)
            {
                ConversationThread item = new ConversationThread(conversationDataExtractor, threadDataExtractor, threadTree, this.conversationTreeFactory);
                list.Add(item);
            }
            return(list);
        }
        private IThreadedConversation InternalCreateConversation(ConversationId conversationId, ConversationDataExtractor conversationDataExtractor, ConversationStateFactory stateFactory, IConversationTree tree, List <IConversationTree> threadTrees, ICollection <PropertyDefinition> requestedThreadProperties)
        {
            IList <IConversationThread> conversationThreads = this.CreateConversationThreads(tree, threadTrees, conversationDataExtractor, requestedThreadProperties);

            return(new ThreadedConversation(stateFactory, conversationDataExtractor, conversationId, tree, conversationThreads));
        }
 internal ConversationFamily(IMailboxSession mailboxSession, ConversationDataExtractor dataExtractor, ConversationId conversationId, IConversationTree conversationTree, IConversationTreeFactory selectedConversationTreeFactory) : this(mailboxSession, dataExtractor, conversationId, conversationTree, conversationId, conversationTree, selectedConversationTreeFactory)
 {
     this.isSingleConversationFamily = true;
 }