Пример #1
0
        private static void AddFailedItemsToCollection(IFailedItemStorage store, Guid mailboxGuid, long referenceDocId, int pageSize, List <NonIndexableItem> nonIndexableItems)
        {
            FailedItemParameters parameters = new FailedItemParameters(FailureMode.All, FieldSet.Default)
            {
                MailboxGuid     = new Guid?(mailboxGuid),
                StartingIndexId = referenceDocId,
                ResultLimit     = pageSize
            };

            foreach (IFailureEntry failureEntry in store.GetFailedItems(parameters))
            {
                MdbItemIdentity mdbItemIdentity = (MdbItemIdentity)failureEntry.ItemId;
                nonIndexableItems.Add(new NonIndexableItem
                {
                    CompositeId        = mdbItemIdentity,
                    ErrorCode          = NonIndexableItem.ConvertSearchErrorCode(failureEntry.ErrorCode),
                    ErrorDescription   = failureEntry.ErrorDescription.ToString(),
                    IsPartiallyIndexed = failureEntry.IsPartiallyIndexed,
                    IsPermanentFailure = failureEntry.IsPermanentFailure,
                    AttemptCount       = failureEntry.AttemptCount,
                    LastAttemptTime    = failureEntry.LastAttemptTime,
                    AdditionalInfo     = failureEntry.AdditionalInfo,
                    SortValue          = IndexId.CreateIndexId(mdbItemIdentity.MailboxNumber, mdbItemIdentity.DocumentId).ToString()
                });
            }
        }
Пример #2
0
        // Token: 0x06000FBC RID: 4028 RVA: 0x0005D178 File Offset: 0x0005B378
        public ErrorStatistics GetErrorStatistics(Guid mailboxGuid)
        {
            IFailedItemStorage failedItemStorage = this.GetFailedItemStorage();
            long itemsCount = failedItemStorage.GetItemsCount(mailboxGuid);

            this.parameters.MailboxGuid = new Guid?(mailboxGuid);
            ICollection <IFailureEntry>         failedItems = failedItemStorage.GetFailedItems(this.parameters);
            Dictionary <EvaluationErrors, long> dictionary  = new Dictionary <EvaluationErrors, long>();

            foreach (IFailureEntry failureEntry in failedItems)
            {
                long num;
                dictionary.TryGetValue(failureEntry.ErrorCode, out num);
                num = (dictionary[failureEntry.ErrorCode] = num + 1L);
            }
            return(new ErrorStatistics(itemsCount, dictionary));
        }
Пример #3
0
        public SearchMailboxesResults Search(ISearchPolicy policy, SearchMailboxesInputs input)
        {
            ulong            num        = 0UL;
            SortedResultPage resultPage = null;

            new List <SearchSource>(input.Sources);
            List <MailboxStatistics> list = new List <MailboxStatistics>();
            Dictionary <Guid, List <KeyValuePair <int, long> > > dictionary = new Dictionary <Guid, List <KeyValuePair <int, long> > >();

            Recorder.Record record = policy.Recorder.Start("NonIndexableItemProvider", TraceType.InfoTrace, true);
            Recorder.Trace(5L, TraceType.InfoTrace, new object[]
            {
                "NonIndexableItemProvider.Search Input:",
                input,
                "Type:",
                input.SearchType
            });
            try
            {
                SearchSource searchSource = input.Sources.FirstOrDefault <SearchSource>();
                if (searchSource != null)
                {
                    Guid guid = searchSource.MailboxInfo.IsArchive ? searchSource.MailboxInfo.ArchiveDatabase : searchSource.MailboxInfo.MdbGuid;
                    long num2 = 0L;
                    if (input.PagingInfo.SortValue != null && input.PagingInfo.SortValue.SortColumnValue != null)
                    {
                        num2  = input.PagingInfo.SortValue.SecondarySortValue;
                        num2 += 1L;
                    }
                    string indexSystemName = FastIndexVersion.GetIndexSystemName(guid);
                    using (IFailedItemStorage failedItemStorage = Factory.Current.CreateFailedItemStorage(Factory.Current.CreateSearchServiceConfig(), indexSystemName))
                    {
                        foreach (SearchSource searchSource2 in input.Sources)
                        {
                            FailedItemParameters failedItemParameters = new FailedItemParameters(FailureMode.All, FieldSet.Default);
                            failedItemParameters.MailboxGuid = new Guid?(searchSource2.MailboxInfo.IsArchive ? searchSource2.MailboxInfo.ArchiveGuid : searchSource2.MailboxInfo.MailboxGuid);
                            long failedItemsCount = failedItemStorage.GetFailedItemsCount(failedItemParameters);
                            num += (ulong)failedItemsCount;
                            list.Add(new MailboxStatistics(searchSource2.MailboxInfo, (ulong)failedItemsCount, ByteQuantifiedSize.Zero));
                            if (input.SearchType == SearchType.NonIndexedItemPreview)
                            {
                                failedItemParameters.StartingIndexId = num2;
                                failedItemParameters.ResultLimit     = input.PagingInfo.PageSize;
                                ICollection <IFailureEntry> failedItems = failedItemStorage.GetFailedItems(failedItemParameters);
                                dictionary[failedItemParameters.MailboxGuid.Value] = (from t in failedItems
                                                                                      select new KeyValuePair <int, long>(t.DocumentId, t.IndexId)).ToList <KeyValuePair <int, long> >();
                            }
                        }
                    }
                    if (input.SearchType == SearchType.NonIndexedItemPreview)
                    {
                        MultiMailboxSearchClient multiMailboxSearchClient = new MultiMailboxSearchClient(guid, (from t in input.Sources
                                                                                                                select t.MailboxInfo).ToArray <MailboxInfo>(), input.Criteria, input.CallerInfo, input.PagingInfo);
                        resultPage = multiMailboxSearchClient.FetchPreviewProperties(dictionary);
                    }
                }
            }
            finally
            {
                policy.Recorder.End(record);
            }
            return(new SearchMailboxesResults(input.Sources)
            {
                SearchResult = new ResultAggregator(resultPage, null, num, ByteQuantifiedSize.Zero, null, null, list)
            });
        }
Пример #4
0
        private int WriteFailures(MailboxDatabase mdb, int?errorcode, FailureMode failureMode, ExDateTime?startDate, ExDateTime?endDate)
        {
            int          num          = 0;
            StoreSession storeSession = null;
            ADUser       aduser       = null;
            Guid?        mailboxGuid  = null;

            if (this.Identity != null)
            {
                mailboxGuid = new Guid?(this.Archive ? this.mailbox.ArchiveGuid : this.mailbox.ExchangeGuid);
                aduser      = this.mailbox;
            }
            MdbInfo mdbInfo = new MdbInfo(mdb);

            mdbInfo.EnableOwningServerUpdate = true;
            mdbInfo.UpdateDatabaseLocationInfo();
            Guid?guid = null;

            try
            {
                using (IFailedItemStorage failedItemStorage = Factory.Current.CreateFailedItemStorage(Factory.Current.CreateSearchServiceConfig(mdbInfo.Guid), mdbInfo.IndexSystemName, mdbInfo.OwningServer))
                {
                    FailedItemParameters parameters = new FailedItemParameters(failureMode, FieldSet.Default)
                    {
                        MailboxGuid = mailboxGuid,
                        ErrorCode   = errorcode,
                        StartDate   = startDate,
                        EndDate     = endDate
                    };
                    foreach (IFailureEntry failureEntry in failedItemStorage.GetFailedItems(parameters))
                    {
                        if (failureEntry.MailboxGuid != guid)
                        {
                            guid = new Guid?(failureEntry.MailboxGuid);
                            if (storeSession != null)
                            {
                                storeSession.Dispose();
                                storeSession = null;
                            }
                            if (mailboxGuid == null)
                            {
                                aduser = this.GetADUser(guid.Value);
                            }
                            if (aduser != null && aduser.RecipientTypeDetails == RecipientTypeDetails.PublicFolderMailbox)
                            {
                                storeSession = this.OpenPublicFolderMailboxSession(mdbInfo.Guid, aduser);
                            }
                            else
                            {
                                storeSession = this.OpenMailboxSession(mdbInfo.Guid, guid.Value);
                            }
                        }
                        if (storeSession != null)
                        {
                            int num2 = (int)storeSession.Mailbox.TryGetProperty(MailboxSchema.MailboxNumber);
                            if (num2 != ((MdbItemIdentity)failureEntry.ItemId).MailboxNumber)
                            {
                                continue;
                            }
                        }
                        string subject = this.GetSubject(failureEntry, storeSession);
                        this.WriteResult(new FailedDocument(failureEntry, subject, mdbInfo.Name, aduser));
                        num++;
                    }
                }
            }
            catch (ComponentException exception)
            {
                base.WriteError(exception, ErrorCategory.ReadError, null);
            }
            finally
            {
                if (storeSession != null)
                {
                    storeSession.Dispose();
                }
            }
            return(num);
        }