private HostedContentFilterRule GetPolicyScopingRule()
        {
            TransportRule transportRule = HygieneUtils.ResolvePolicyRuleObject <HostedContentFilterPolicy>(this.DataObject, this.ConfigurationSession, "HostedContentFilterVersioned");

            if (transportRule != null)
            {
                TransportRule transportRule2 = this.GetTransportRule(transportRule.Name);
                return(HostedContentFilterRule.CreateFromInternalRule(transportRule, -1, transportRule2));
            }
            return(null);
        }
        protected override void InternalValidate()
        {
            base.InternalValidate();
            this.policyObject = HygieneUtils.ResolvePolicyObject <MalwareFilterPolicy>(this, this.ConfigurationSession, this.MalwareFilterPolicy);
            TransportRule transportRule = HygieneUtils.ResolvePolicyRuleObject <MalwareFilterPolicy>(this.policyObject, this.ConfigurationSession, this.ruleCollectionName);

            if (transportRule != null)
            {
                base.WriteError(new OperationNotAllowedException(Strings.ErrorPolicyRuleExists(this.policyObject.Name, transportRule.Name)), ErrorCategory.InvalidOperation, null);
            }
            if (this.policyObject != null && this.policyObject.IsDefault)
            {
                base.WriteError(new OperationNotAllowedException(Strings.ErrorDefaultPolicyCannotHaveRule(this.policyObject.Name)), ErrorCategory.InvalidOperation, null);
            }
        }
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     ((IConfigurationSession)base.DataSession).SessionSettings.IsSharedConfigChecked = true;
     if (!this.IgnoreDehydratedFlag)
     {
         SharedConfigurationTaskHelper.VerifyIsNotTinyTenant(base.CurrentOrgState, new Task.ErrorLoggerDelegate(base.WriteError));
     }
     if (this.DataObject.LanguageBlockList != null)
     {
         foreach (string text in this.DataObject.LanguageBlockList)
         {
             if (!HygieneUtils.IsAntispamFilterableLanguage(text))
             {
                 base.WriteError(new ArgumentException(Strings.ErrorUnsupportedBlockLanguage(text)), ErrorCategory.InvalidArgument, text);
             }
         }
     }
     if (this.DataObject.RegionBlockList != null)
     {
         foreach (string text2 in this.DataObject.RegionBlockList)
         {
             if (!HygieneUtils.IsValidIso3166Alpha2Code(text2))
             {
                 base.WriteError(new ArgumentException(Strings.ErrorInvalidIso3166Alpha2Code(text2)), ErrorCategory.InvalidArgument, text2);
             }
         }
     }
     if (this.DataObject.IsModified(HostedContentFilterPolicySchema.EnableEndUserSpamNotifications) && this.DataObject.EnableEndUserSpamNotifications)
     {
         HostedContentFilterRule policyScopingRule = this.GetPolicyScopingRule();
         if (policyScopingRule != null && !policyScopingRule.IsEsnCompatible)
         {
             base.WriteError(new OperationNotAllowedException(Strings.ErrorEsnIncompatibleRule(policyScopingRule.Name)), ErrorCategory.InvalidOperation, null);
         }
     }
     TaskLogger.LogExit();
 }
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (this.DataObject.LanguageBlockList != null)
     {
         foreach (string text in from x in this.DataObject.LanguageBlockList
                  where !HygieneUtils.IsAntispamFilterableLanguage(x)
                  select x)
         {
             base.WriteError(new ArgumentException(Strings.ErrorUnsupportedBlockLanguage(text)), ErrorCategory.InvalidArgument, text);
         }
     }
     if (this.DataObject.RegionBlockList != null)
     {
         foreach (string text2 in from x in this.DataObject.RegionBlockList
                  where !HygieneUtils.IsValidIso3166Alpha2Code(x)
                  select x)
         {
             base.WriteError(new ArgumentException(Strings.ErrorInvalidIso3166Alpha2Code(text2)), ErrorCategory.InvalidArgument, text2);
         }
     }
     TaskLogger.LogExit();
 }
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (this.HostedContentFilterPolicy != null)
     {
         this.policyObject          = HygieneUtils.ResolvePolicyObject <HostedContentFilterPolicy>(this, base.DataSession, this.HostedContentFilterPolicy);
         this.effectivePolicyObject = this.policyObject;
         TransportRule transportRule = HygieneUtils.ResolvePolicyRuleObject <HostedContentFilterPolicy>((HostedContentFilterPolicy)this.policyObject, base.DataSession, this.ruleCollectionName);
         if (transportRule != null)
         {
             base.WriteError(new OperationNotAllowedException(Strings.ErrorPolicyRuleExists(this.policyObject.Name, transportRule.Name)), ErrorCategory.InvalidOperation, null);
         }
         if (this.policyObject != null && ((HostedContentFilterPolicy)this.policyObject).IsDefault)
         {
             base.WriteError(new OperationNotAllowedException(Strings.ErrorDefaultPolicyCannotHaveRule(this.policyObject.Name)), ErrorCategory.InvalidOperation, null);
             return;
         }
     }
     else
     {
         HostedContentFilterRule hostedContentFilterRule = HostedContentFilterRule.CreateFromInternalRule((TransportRule)TransportRuleParser.Instance.GetRule(this.DataObject.Xml), -1, this.DataObject);
         this.effectivePolicyObject = HygieneUtils.ResolvePolicyObject <HostedContentFilterPolicy>(this, base.DataSession, hostedContentFilterRule.HostedContentFilterPolicy);
     }
 }