protected override void InternalValidate() { if (base.OptionalIdentityData != null) { base.OptionalIdentityData.ConfigurationContainerRdn = ClassificationDefinitionConstants.ClassificationDefinitionsRdn; } base.InternalValidate(); if (base.HasErrors) { return; } ExAssert.RetailAssert(base.DataObject != null, "DataObject must not be null at this point as it should have been resolved by the base class."); if (!ClassificationDefinitionUtils.IsAdObjectAClassificationRuleCollection(base.DataObject)) { base.WriteError(new ClassificationRuleCollectionInvalidObjectException(Strings.ClassificationRuleCollectionInvalidObject), ErrorCategory.InvalidOperation, null); } if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled&& OrganizationId.ForestWideOrgId.Equals(((IDirectorySession)base.DataSession).SessionSettings.CurrentOrganizationId) && !this.Identity.IsHierarchical) { base.WriteError(new ClassificationRuleCollectionIllegalScopeException(Strings.ClassificationRuleCollectionIllegalScopedRemoveOperation), ErrorCategory.InvalidOperation, null); } SortedSet <string> sortedSet = new SortedSet <string>(); IList <string> allRulesInUse = this.GetAllRulesInUse(base.DataObject, sortedSet); if (allRulesInUse.Count > 0) { LocalizedString message = Strings.ClassificationRuleCollectionSharingViolationRemoveOperationVerbose(this.Identity.ToString(), string.Join(Strings.ClassificationRuleCollectionOffendingListSeparator, allRulesInUse), string.Join(Strings.ClassificationRuleCollectionOffendingListSeparator, sortedSet)); ClassificationRuleCollectionSharingViolationException exception = ClassificationDefinitionUtils.PopulateExceptionSource <ClassificationRuleCollectionSharingViolationException, IList <string> >(new ClassificationRuleCollectionSharingViolationException(message), allRulesInUse); base.WriteError(exception, ErrorCategory.InvalidOperation, null); } }
internal static XDocument GetRuleCollectionDocumentFromTransportRule(TransportRule transportRule) { if (transportRule == null) { throw new ArgumentNullException("transportRule"); } if (!ClassificationDefinitionUtils.IsAdObjectAClassificationRuleCollection(transportRule)) { throw new InvalidOperationException(); } if (transportRule.ReplicationSignature == null) { throw new ArgumentException(new ArgumentException().Message, "transportRule"); } byte[] bytes; Exception ex; if (!ClassificationDefinitionUtils.TryUncompressXmlBytes(transportRule.ReplicationSignature, out bytes, out ex)) { throw new AggregateException(new Exception[] { ex }); } XDocument result; try { result = XDocument.Parse(Encoding.Unicode.GetString(bytes)); } catch (ArgumentException ex2) { throw new AggregateException(new Exception[] { ex2 }); } return(result); }