public void Process(PropertyBag propertyBag) { Type type = base.GetType(); string fullName = type.FullName; string text = string.Format("PipelineProcessor <{0}>", fullName); ADObjectId adobjectId = (ADObjectId)propertyBag[ADObjectSchema.Id]; ExTraceGlobals.BackSyncTracer.TraceDebug <string, string>((long)SyncConfiguration.TraceId, "{0} process {1} ...", text, adobjectId.ToString()); ProcessorHelper.TracePropertBag(text, propertyBag); if (this.ProcessInternal(propertyBag)) { this.next.Process(propertyBag); } else { ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "{0} processing terminated", text); } ExTraceGlobals.BackSyncTracer.TraceDebug <string, string>((long)SyncConfiguration.TraceId, "{0} completed process {1}", text, adobjectId.ToString()); }
protected override bool ProcessInternal(PropertyBag propertyBag) { ADObjectId tenantOU = ProcessorHelper.GetTenantOU(propertyBag); ADRawEntry properties = this.organizationPropertyLookup.GetProperties(tenantOU); if (!TenantRelocationProcessor.IsDeletedOrg(properties, tenantOU) && TenantRelocationProcessor.HasBeenInvolvedInRelocation(properties)) { bool isSourceOfRelocation; TenantRelocationState tenantRelocationState = this.getTenantRelocationState(tenantOU, out isSourceOfRelocation, false); bool flag = tenantRelocationState.SourceForestState == TenantRelocationStatus.Retired; if (!flag || tenantRelocationState.SourceForestState == TenantRelocationStatus.Lockdown) { tenantRelocationState = this.getTenantRelocationState(tenantOU, out isSourceOfRelocation, true); flag = (tenantRelocationState.SourceForestState == TenantRelocationStatus.Retired); } return(this.HandleRelocationState(flag, isSourceOfRelocation, propertyBag, properties)); } return(true); }
protected override bool ProcessInternal(PropertyBag propertyBag) { if (!RecipientTypeFilter.HasObjectId(propertyBag)) { ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "RecipientTypeFilter:: - Skipping object {0}. No object id set on object.", new object[] { propertyBag[ADObjectSchema.Id] }); this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RecipientTypeFilter); return(false); } if (ProcessorHelper.IsDeletedObject(propertyBag)) { return(!ProvisioningTasksConfigImpl.UseBecAPIsforLiveId || !ProcessorHelper.IsUserObject(propertyBag)); } if (RecipientTypeFilter.IsObjectExcluded(propertyBag)) { ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "RecipientTypeFilter:: - Skipping object {0}. It's marked as excluded form backsync.", new object[] { propertyBag[ADObjectSchema.Id] }); this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.UnspecifiedError, ProcessingStage.RecipientTypeFilter); return(false); } bool flag; if (!ProcessorHelper.IsObjectOrganizationUnit(propertyBag)) { RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)propertyBag[ADRecipientSchema.RecipientTypeDetails]; flag = this.IsAcceptedRecipientType(recipientTypeDetails); if (!flag) { ExTraceGlobals.BackSyncTracer.TraceDebug <object, RecipientTypeDetails>((long)SyncConfiguration.TraceId, "RecipientTypeFilter:: - Skipping object {0}. Recipient type {1} is not included in backsync.", propertyBag[SyncObjectSchema.ObjectId], recipientTypeDetails); this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RecipientTypeFilter); } } else { flag = true; } return(flag); }
protected override bool ProcessInternal(PropertyBag propertyBag) { if (!ProcessorHelper.IsDeletedObject(propertyBag)) { return(true); } ADObjectId tenantOU = ProcessorHelper.GetTenantOU(propertyBag); ADRawEntry properties = this.organizationLookup.GetProperties(tenantOU); if (!RecipientDeletedDuringOrganizationDeletionFilter.WasOrganizationForThisObjectDeleted(properties)) { return(true); } if (RecipientDeletedDuringOrganizationDeletionFilter.WasObjectDeletedBeforeOrganization(propertyBag, properties)) { return(true); } this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RecipientDeletedDuringOrganizationDeletionFilter); return(false); }
private IConfigurable CreateOutputObject(byte[] cookie, bool moreData) { ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "PagedOutputResultWriter.CreateOutputObject entering"); ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "Create SyncObject list from ADPropertyBag list ..."); List <SyncObject> list = new List <SyncObject>(); foreach (PropertyBag propertyBag in this.entries) { ProcessorHelper.TracePropertBag("<PagedOutputResultWriter::CreateOutputObject>", propertyBag); list.Add(SyncObject.Create((ADPropertyBag)propertyBag)); } ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "SyncObject count = {0}", list.Count); if (this.serializeCountDelegate != null) { this.serializeCountDelegate(this.entries.Count); } ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "Create SyncData from SyncObject list ..."); SyncData result = null; try { result = new SyncData(cookie, this.createResponseDelegate(list, moreData, cookie, this.currentServiceInstanceId)); ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "SyncData created successfully"); } catch (Exception ex) { ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "Encountered exception during SyncData creation {0}", ex.ToString()); if (this.addErrorSyncObjectDelegate == null) { throw ex; } if (this.FindErrorSyncObjects(cookie, moreData, list) == 0) { ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "Didn't find SyncObject that caused the exception. Re-throw exception {0}.", ex.ToString()); throw ex; } ExTraceGlobals.BackSyncTracer.TraceError((long)SyncConfiguration.TraceId, "PagedOutputResultWriter.CreateOutputObject Throw DataSourceTransientException"); throw new DataSourceTransientException(Strings.BackSyncFailedToConvertSyncObjectToDirectoryObject, ex); } return(result); }
internal static ADObjectId GetTenantOU(PropertyBag propertyBag) { bool flag = ProcessorHelper.IsDeletedObject(propertyBag); bool flag2 = ProcessorHelper.IsObjectOrganizationUnit(propertyBag); ADObjectId adobjectId = (ADObjectId)propertyBag[ADObjectSchema.Id]; ADObjectId adobjectId2 = flag2 ? adobjectId : adobjectId.Parent; if (flag) { ADObjectId adobjectId3 = (ADObjectId)propertyBag[SyncObjectSchema.LastKnownParent]; if (adobjectId3 == null) { adobjectId3 = adobjectId.DomainId.GetChildId("CN", "LostAndFound"); ExTraceGlobals.BackSyncTracer.TraceWarning <string>((long)SyncConfiguration.TraceId, "ProcessorHelper::GetTenantOU for id {0}. Change for deleted object does not include lastKnowParent. This are not properly auth restored objects in the past prior to MSO tenants. Ignoring.", adobjectId.ToString()); } adobjectId2 = (flag2 ? adobjectId : adobjectId3); } if (adobjectId2.Rdn.Equals(ProcessorHelper.SoftDeletedContainerName)) { adobjectId2 = adobjectId2.Parent; } return(adobjectId2); }
private bool HandleRelocationState(bool isRelocationCompleted, bool isSourceOfRelocation, PropertyBag propertyBag, ADRawEntry org) { if (!isRelocationCompleted) { if (!isSourceOfRelocation) { this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RelocationStageFilter); } return(isSourceOfRelocation); } if (!isSourceOfRelocation) { if (this.isIncrementalSync) { WatermarkMap vectorToFilterRelocationData = TenantRelocationProcessor.GetVectorToFilterRelocationData(org); if (vectorToFilterRelocationData.ContainsKey(this.invocationId)) { long num = vectorToFilterRelocationData[this.invocationId]; if ((long)(propertyBag[ADRecipientSchema.UsnChanged] ?? 9223372036854775807L) < num) { this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RelocationPartOfRelocationSyncFilter); return(false); } } } return(true); } if (ProcessorHelper.IsObjectOrganizationUnit(propertyBag)) { this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RelocationStageFilter); return(false); } ServiceInstanceId value = new ServiceInstanceId(string.Format("exchange/{0}", org[ExchangeConfigurationUnitSchema.TargetForest])); propertyBag.SetField(SyncObjectSchema.FaultInServiceInstance, value); return(true); }
protected override bool ProcessInternal(PropertyBag propertyBag) { ADObjectId tenantOU = ProcessorHelper.GetTenantOU(propertyBag); if (tenantOU != null) { ADRawEntry properties = this.organizationPropertyLookup.GetProperties(tenantOU); if (properties != null) { string value = (string)properties[ExchangeConfigurationUnitSchema.ExternalDirectoryOrganizationId]; if (!string.IsNullOrEmpty(value)) { propertyBag.SetField(SyncObjectSchema.ContextId, value); if (ProcessorHelper.IsObjectOrganizationUnit(propertyBag)) { if (this.ShouldIgnoreOrganizationUnit(propertyBag)) { ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "<OrganizationFilter.ProcessInternal> tenant has no output attribute. Skip processing."); return(false); } propertyBag.SetField(SyncObjectSchema.ObjectId, value); } propertyBag.SetField(OrganizationSchema.IsDirSyncRunning, properties[OrganizationSchema.IsDirSyncRunning]); propertyBag.SetField(OrganizationSchema.DirSyncStatus, properties[OrganizationSchema.DirSyncStatus]); if (OrganizationFilter.IsExcludedOrg(properties)) { this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.UnspecifiedError, ProcessingStage.OrganizationFilter); return(false); } return(true); } } } this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.OrganizationFilter); return(false); }
internal static bool IsSoftDeletedObject(PropertyBag propertyBag) { ADObjectId id = (ADObjectId)propertyBag[ADObjectSchema.Id]; return(!ProcessorHelper.IsObjectOrganizationUnit(propertyBag) && ProcessorHelper.IsSoftDeletedObject(id)); }
private static bool WasOrganizationForThisObjectDeleted(ADRawEntry org) { return(ProcessorHelper.IsDeletedObject(org.propertyBag) || ExchangeConfigurationUnit.IsBeingDeleted((OrganizationStatus)org[ExchangeConfigurationUnitSchema.OrganizationStatus])); }