protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            if (dataObject == null)
            {
                return(null);
            }
            DeletedRecipient deleteRecipient;

            if (dataObject is DeletedRecipient)
            {
                deleteRecipient = (DeletedRecipient)dataObject;
            }
            else
            {
                ADRawEntry adrawEntry = (ADRawEntry)dataObject;
                this.PackDeletedRecipientInfo(adrawEntry);
                deleteRecipient = new DeletedRecipient(null, adrawEntry.propertyBag);
            }
            SyncDeletedRecipient syncDeletedRecipient = new SyncDeletedRecipient(deleteRecipient);

            if (this.outputCookie != null)
            {
                syncDeletedRecipient.propertyBag.SetField(SyncDeletedObjectSchema.Cookie, this.outputCookie.ToBytes());
                if (this.outputCookie.HighWatermark == 0L)
                {
                    syncDeletedRecipient.propertyBag.SetField(SyncDeletedObjectSchema.EndOfList, true);
                }
            }
            return(syncDeletedRecipient);
        }
        protected override IEnumerable <ADRawEntry> GetPagedData()
        {
            if (this.Cookie == null)
            {
                DeletedRecipient item = new DeletedRecipient();
                return(new List <ADRawEntry>
                {
                    item
                });
            }
            PropertyDefinition[] properties = new PropertyDefinition[]
            {
                ADObjectSchema.Id,
                ADObjectSchema.Name,
                ADObjectSchema.DistinguishedName,
                ADObjectSchema.Guid,
                ADObjectSchema.OrganizationalUnitRoot,
                ADObjectSchema.ObjectClass,
                ADObjectSchema.WhenChanged,
                ADObjectSchema.WhenChangedUTC,
                ADObjectSchema.WhenCreated,
                ADObjectSchema.WhenCreatedUTC
            };
            if (this.requireTwoQueries)
            {
                IRecipientSession sessionForSoftDeletedObjects = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(base.CurrentOrganizationId, this.DomainController);
                ADObjectId        childId     = base.CurrentOrganizationId.OrganizationalUnit.GetChildId("OU", "Soft Deleted Objects");
                QueryFilter       queryFilter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.IsSoftDeletedByRemove, true);
                queryFilter = new AndFilter(new QueryFilter[]
                {
                    queryFilter,
                    SyncTaskHelper.GetDeltaFilter(this.inputCookie)
                });
                this.reader2        = sessionForSoftDeletedObjects.FindPagedADRawEntry(childId, QueryScope.OneLevel, queryFilter, null, this.PageSize, properties);
                this.reader2.Cookie = this.inputCookie.PageCookie2;
                base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(sessionForSoftDeletedObjects, typeof(ADRawEntry), queryFilter, null, false));
            }
            IRecipientSession recipientSession        = (IRecipientSession)base.DataSession;
            ADObjectId        deletedObjectsContainer = ADSession.GetDeletedObjectsContainer(recipientSession.GetDomainNamingContext());
            QueryFilter       internalFilter          = this.InternalFilter;

            recipientSession.SessionSettings.SkipCheckVirtualIndex = true;
            ADPagedReader <ADRawEntry> adpagedReader = recipientSession.FindPagedADRawEntry(deletedObjectsContainer, QueryScope.OneLevel, internalFilter, null, this.PageSize, properties);

            adpagedReader.IncludeDeletedObjects = true;
            adpagedReader.Cookie = this.inputCookie.PageCookie;
            base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(base.DataSession, typeof(ADRawEntry), this.InternalFilter, null, false));
            return(adpagedReader);
        }
        protected override void WriteResult <T>(IEnumerable <T> dataObjects)
        {
            SyncTaskHelper.OneParameterMethod <bool, IConfigurable> oneParameterMethod  = null;
            SyncTaskHelper.OneParameterMethod <bool, IConfigurable> oneParameterMethod2 = null;
            ADRawEntry adrawEntry = null;

            if (dataObjects is ADPagedReader <ADRawEntry> )
            {
                bool flag;
                if (this.requireTwoQueries)
                {
                    IEnumerable <ADRawEntry> dataObjects2 = (IEnumerable <ADRawEntry>)dataObjects;
                    IEnumerable <ADRawEntry> dataObjects3 = this.reader2;
                    SyncCookie syncCookie = this.inputCookie;
                    SyncTaskHelper.ParameterlessMethod <bool> isStopping = () => base.Stopping;
                    if (oneParameterMethod == null)
                    {
                        oneParameterMethod = ((IConfigurable dataObject) => false);
                    }
                    this.searchNeedsRetry = !SyncTaskHelper.HandleTaskWritePagedResult <ADRawEntry>(dataObjects2, dataObjects3, syncCookie, ref this.outputCookie, isStopping, oneParameterMethod, new SyncTaskHelper.VoidOneParameterMethod <IConfigurable>(this.WriteResult), this.Pages, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskErrorLoggingDelegate(base.WriteError), out flag);
                }
                else
                {
                    IEnumerable <ADRawEntry> dataObjects4 = (IEnumerable <ADRawEntry>)dataObjects;
                    SyncCookie syncCookie2 = this.inputCookie;
                    SyncTaskHelper.ParameterlessMethod <bool> isStopping2 = () => base.Stopping;
                    if (oneParameterMethod2 == null)
                    {
                        oneParameterMethod2 = ((IConfigurable dataObject) => false);
                    }
                    this.searchNeedsRetry = !SyncTaskHelper.HandleTaskWritePagedResult <ADRawEntry>(dataObjects4, syncCookie2, ref this.outputCookie, isStopping2, oneParameterMethod2, new SyncTaskHelper.VoidOneParameterMethod <IConfigurable>(this.WriteResult), this.Pages, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskErrorLoggingDelegate(base.WriteError), out flag);
                }
                if (!this.searchNeedsRetry && !flag)
                {
                    adrawEntry = new DeletedRecipient();
                }
            }
            else
            {
                adrawEntry = ((List <ADRawEntry>)dataObjects)[0];
            }
            if (adrawEntry != null)
            {
                this.outputCookie = new SyncCookie(this.inputCookie.DomainController, this.inputCookie.HighWatermarks, WatermarkMap.Empty, null);
                this.WriteResult(adrawEntry);
            }
        }
 public SyncDeletedRecipient(DeletedRecipient deleteRecipient) : base(deleteRecipient)
 {
 }
Пример #5
0
        // Token: 0x060003B5 RID: 949 RVA: 0x00015440 File Offset: 0x00013640
        internal static ADObject CreateAndInitializeRecipientObject <TRecipientObject>(ADPropertyBag propertyBag, ADRawEntry dummyObject, IRecipientSession recipientSession) where TRecipientObject : IConfigurable, new()
        {
            ArgumentValidator.ThrowIfNull("propertyBag", propertyBag);
            ArgumentValidator.ThrowIfNull("dummyObject", dummyObject);
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[ADObjectSchema.ObjectClass];
            ADObject adobject;

            if (dummyObject is OWAMiniRecipient)
            {
                adobject = new OWAMiniRecipient();
            }
            else if (dummyObject is ActiveSyncMiniRecipient)
            {
                adobject = new ActiveSyncMiniRecipient();
            }
            else if (dummyObject is StorageMiniRecipient)
            {
                adobject = new StorageMiniRecipient();
            }
            else if (dummyObject is TransportMiniRecipient)
            {
                adobject = new TransportMiniRecipient();
            }
            else if (dummyObject is LoadBalancingMiniRecipient)
            {
                adobject = new LoadBalancingMiniRecipient();
            }
            else if (dummyObject is MiniRecipientWithTokenGroups)
            {
                adobject = new MiniRecipientWithTokenGroups();
            }
            else if (dummyObject is FrontEndMiniRecipient)
            {
                adobject = new FrontEndMiniRecipient();
            }
            else if (dummyObject is MiniRecipient)
            {
                adobject = new MiniRecipient();
            }
            else if (dummyObject is RemovedMailbox)
            {
                adobject = new RemovedMailbox();
            }
            else if (dummyObject is DeletedRecipient)
            {
                adobject = new DeletedRecipient();
            }
            else if (multiValuedProperty.Contains(ADComputerRecipient.MostDerivedClass))
            {
                adobject = new ADComputerRecipient();
            }
            else if (multiValuedProperty.Contains(ADUser.MostDerivedClass))
            {
                adobject = new ADUser();
            }
            else if (multiValuedProperty.Contains(ADContact.MostDerivedClass))
            {
                adobject = new ADContact();
            }
            else if (multiValuedProperty.Contains(ADGroup.MostDerivedClass))
            {
                adobject = new ADGroup();
            }
            else if (multiValuedProperty.Contains(ADDynamicGroup.MostDerivedClass))
            {
                adobject = new ADDynamicGroup();
            }
            else if (multiValuedProperty.Contains(ADPublicFolder.MostDerivedClass))
            {
                adobject = new ADPublicFolder();
            }
            else if (multiValuedProperty.Contains(ADSystemAttendantMailbox.MostDerivedClass))
            {
                adobject = new ADSystemAttendantMailbox();
            }
            else if (multiValuedProperty.Contains(ADSystemMailbox.MostDerivedClass))
            {
                adobject = new ADSystemMailbox();
            }
            else if (multiValuedProperty.Contains(ADPublicDatabase.MostDerivedClass))
            {
                adobject = new ADPublicDatabase();
            }
            else
            {
                if (!multiValuedProperty.Contains(ADMicrosoftExchangeRecipient.MostDerivedClass))
                {
                    string objectClass = string.Empty;
                    foreach (string text in multiValuedProperty)
                    {
                        objectClass = text;
                    }
                    ObjectValidationError error = new ObjectValidationError(DirectoryStrings.UnsupportedObjectClass(objectClass), (ADObjectId)propertyBag[ADObjectSchema.Id], string.Empty);
                    ADProviderPerf.UpdateProcessCounter(Counter.ProcessRateCriticalValidationFailures, UpdateType.Update, 1U);
                    Globals.LogEvent(DirectoryEventLogConstants.Tuple_DSC_EVENT_VALIDATION_FAILED_FCO_MODE_RECIPIENT, ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToString(), new object[]
                    {
                        ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToDNString()
                    });
                    throw new DataValidationException(error);
                }
                adobject = new ADMicrosoftExchangeRecipient();
            }
            adobject.m_Session   = recipientSession;
            adobject.propertyBag = propertyBag;
            adobject.Initialize();
            adobject.ResetChangeTracking(true);
            if (recipientSession != null)
            {
                adobject.SetIsReadOnly(recipientSession.ReadOnly);
            }
            ExTraceGlobals.ADReadDetailsTracer.TraceDebug <string, RecipientType>((long)((recipientSession != null) ? recipientSession.GetHashCode() : 0), "ADRecipientObjectSession::CreateObject - Got {0} as {1}", adobject.DistinguishedName, (RecipientType)adobject[ADRecipientSchema.RecipientType]);
            return(adobject);
        }