internal static void PopulatePresentationObject(TenantRelocationRequest presentationObject, string targetForestDomainController, out Exception ex)
        {
            TenantRelocationRequest targetForestObject;

            TenantRelocationRequest.LoadTargetForestObject(presentationObject, targetForestDomainController, out targetForestObject, out ex);
            if (ex == null)
            {
                TenantRelocationRequest.PopulatePresentationObject(presentationObject, targetForestObject);
            }
        }
 private static void LoadTargetForestObject(TenantRelocationRequest presentationObject, string targetForestDomainController, out TenantRelocationRequest targetForestObject, out Exception ex)
 {
     if (presentationObject == null)
     {
         throw new ArgumentNullException("presentationObject");
     }
     if (presentationObject.TargetForest == null)
     {
         throw new ADTransientException(DirectoryStrings.ErrorReplicationLatency);
     }
     TenantRelocationRequest.LoadOtherForestObjectInternal(targetForestDomainController, presentationObject.TargetForest, presentationObject.DistinguishedName, presentationObject.ExternalDirectoryOrganizationId, true, out targetForestObject, out ex);
 }
 internal static void PopulatePresentationObject(TenantRelocationRequest presentationObject, TenantRelocationRequest targetForestObject)
 {
     if (presentationObject == null)
     {
         throw new ArgumentNullException("presentationObject");
     }
     if (targetForestObject == null)
     {
         throw new ArgumentNullException("targetForestObject");
     }
     presentationObject.RelocationStatusDetailsDestination = (RelocationStatusDetailsDestination)targetForestObject.RelocationStatusDetailsRaw;
     presentationObject.SourceForest             = targetForestObject.RelocationSourceForestRaw;
     presentationObject.TargetOriginatingServer  = targetForestObject.OriginatingServer;
     presentationObject.TargetOrganizationStatus = targetForestObject.OrganizationStatus;
     if (targetForestObject.OrganizationId != OrganizationId.ForestWideOrgId)
     {
         presentationObject.TargetOrganizationId = targetForestObject.OrganizationId;
     }
     presentationObject.RelocationInProgress = presentationObject.IsRelocationInProgress();
 }
        internal static void LoadOtherForestObjectInternal(string dc, string searchForest, string originalObjectDN, string externalDirectoryOrganizationId, bool needTargetTenant, out TenantRelocationRequest otherForestObject, out Exception ex)
        {
            if (string.IsNullOrEmpty(searchForest))
            {
                throw new ArgumentNullException("searchForest");
            }
            if (string.IsNullOrEmpty(originalObjectDN))
            {
                throw new ArgumentNullException("originalObjectDN");
            }
            if (string.IsNullOrEmpty(externalDirectoryOrganizationId))
            {
                throw new ArgumentNullException("externalDirectoryOrganizationId");
            }
            ex = null;
            otherForestObject = null;
            PartitionId partitionId = new PartitionId(searchForest);
            ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.NonCacheSessionFactory.CreateTenantConfigurationSession(dc, false, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromAllTenantsPartitionId(partitionId), 1539, "LoadOtherForestObjectInternal", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\TenantRelocationRequest.cs");

            tenantConfigurationSession.SessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants;
            QueryFilter queryFilter;

            if (needTargetTenant)
            {
                queryFilter = TenantRelocationRequest.TenantRelocationLandingFilter;
            }
            else
            {
                queryFilter = TenantRelocationRequest.TenantRelocationRequestFilter;
            }
            QueryFilter filter = new AndFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, ExchangeConfigurationUnitSchema.ExternalDirectoryOrganizationId, externalDirectoryOrganizationId),
                queryFilter
            });

            try
            {
                TenantRelocationRequest[] array = tenantConfigurationSession.Find <TenantRelocationRequest>(null, QueryScope.SubTree, filter, null, 2);
                if (array.Length > 1)
                {
                    ex = new ADOperationException(DirectoryStrings.ErrorTargetPartitionHas2TenantsWithSameId(originalObjectDN, searchForest, externalDirectoryOrganizationId));
                }
                else if (array.Length > 0)
                {
                    otherForestObject = array[0];
                }
                else
                {
                    ex = new CannotFindTargetTenantException(originalObjectDN, searchForest, externalDirectoryOrganizationId);
                }
            }
            catch (ADTransientException ex2)
            {
                ex = ex2;
            }
        }
        internal static object GetRelocationStatus(IPropertyBag propertyBag)
        {
            RelocationStatusDetails r = (RelocationStatusDetails)propertyBag[TenantRelocationRequestSchema.RelocationStatusDetailsRaw];

            return(TenantRelocationRequest.GetRelocationStatusFromStatusDetails(r));
        }