예제 #1
0
		private void AddItemIdListToUniqueItemHashMap(IItemIdList itemIdList, ISourceDataProvider itemHashProvider)
		{
			try
			{
				foreach (ItemId itemId in itemIdList.ReadItemIds())
				{
					if (this.progressController.IsStopRequested)
					{
						Tracer.TraceInformation("ItemListGenerator.GenerateItemList: Stop requested point 2", new object[0]);
						break;
					}
					if (!string.IsNullOrEmpty(itemId.UniqueHash))
					{
						object itemHashObject = itemHashProvider.GetItemHashObject(itemId.UniqueHash);
						if (itemHashObject != null && !this.uniqueItemIds.ContainsKey(itemHashObject))
						{
							this.uniqueItemIds.Add(itemHashObject, new BasicItemId
							{
								Id = itemId.Id,
								SourceId = itemId.SourceId
							});
						}
					}
				}
			}
			catch (ExportException ex)
			{
				Tracer.TraceError("ItemListGenerator.AddItemIdListToUniqueItemHashMap: {0}", new object[]
				{
					ex
				});
				throw new ExportException(ExportErrorType.FailedToRecreateUniqueItemHashMap, ex);
			}
		}
예제 #2
0
		private void RecreateUniqueItemHashMap()
		{
			SourceInformation sourceInformation = this.AllSourceInformation.Values.FirstOrDefault((SourceInformation source) => source.ServiceClient != null);
			foreach (SourceInformation sourceInformation2 in this.AllSourceInformation.Values)
			{
				if (this.progressController.IsStopRequested)
				{
					Tracer.TraceInformation("ItemListGenerator.RecreateUniqueItemHashMap: Stop requested point 1", new object[0]);
					break;
				}
				if (sourceInformation2.Status.ItemCount > 0)
				{
					IItemIdList itemIdList = this.target.CreateItemIdList(sourceInformation2.Configuration.Id, false);
					this.AddItemIdListToUniqueItemHashMap(itemIdList, sourceInformation.ServiceClient);
				}
				if (sourceInformation2.Status.UnsearchableItemCount > 0)
				{
					IItemIdList itemIdList2 = this.target.CreateItemIdList(sourceInformation2.Configuration.Id, true);
					this.AddItemIdListToUniqueItemHashMap(itemIdList2, sourceInformation.ServiceClient);
				}
			}
		}
예제 #3
0
        private void ExportSourceMailbox(IContextualBatchDataWriter <List <ItemInformation> > dataWriter, SourceInformation source, bool isUnsearchable)
        {
            Tracer.TraceInformation("ProgressController.ExportSourceMailbox: Source Id: {0}; isUnsearchable: {1}", new object[]
            {
                source.Configuration.Id,
                isUnsearchable
            });
            this.ItemListGenerator.DoUnSearchable = isUnsearchable;
            bool flag = (!isUnsearchable && source.Status.ItemCount <= 0) || (isUnsearchable && source.Status.UnsearchableItemCount <= 0);

            if ((!isUnsearchable && source.Status.ItemCount > source.Status.ProcessedItemCount) || (isUnsearchable && source.Status.UnsearchableItemCount > source.Status.ProcessedUnsearchableItemCount) || !this.target.ExportContext.IsResume || flag)
            {
                IItemIdList   itemIdList    = this.target.CreateItemIdList(source.Configuration.Id, isUnsearchable);
                DataContext   dataContext   = new DataContext(source, itemIdList);
                DataRetriever dataRetriever = new DataRetriever(dataContext, this);
                dataRetriever.DataWriter              = dataWriter;
                this.ItemListGenerator.DataRetriever  = dataRetriever;
                this.ItemListGenerator.DataBatchRead += this.ItemListGenerator.WriteDataBatchItemListGen;
                dataRetriever.DataBatchRead          += this.ItemListGenerator.WriteDataBatchDataRetriever;
                ExportException ex = null;
                try
                {
                    this.ItemListGenerator.DoExportForSourceMailbox(dataRetriever.DataContext.SourceInformation);
                }
                finally
                {
                    ex = AsynchronousTaskHandler.WaitForAsynchronousTask(this.ItemListGenerator.WritingTask);
                    this.ItemListGenerator.WritingTask   = null;
                    this.ItemListGenerator.DataRetriever = null;
                }
                if (ex != null)
                {
                    throw ex;
                }
            }
        }
예제 #4
0
 public DataContext(SourceInformation sourceInformation, IItemIdList itemIdList)
 {
     this.sourceInformation = sourceInformation;
     this.ItemIdList        = itemIdList;
 }