Exemplo n.º 1
0
        protected override void StampChangesOn(IConfigurable dataObject)
        {
            RuleStorage ruleStorage = (RuleStorage)dataObject;

            ruleStorage.ResetChangeTracking(true);
            base.PsRulePresentationObject = new PsHoldRule(ruleStorage);
            PsHoldRule psHoldRule = (PsHoldRule)base.PsRulePresentationObject;

            base.PsRulePresentationObject.PopulateTaskProperties(this, base.DataSession as IConfigurationSession);
            if (base.PsRulePresentationObject.ReadOnly)
            {
                throw new TaskRuleIsTooAdvancedToModifyException(base.PsRulePresentationObject.Name);
            }
            if (ruleStorage.Mode == Mode.PendingDeletion)
            {
                base.WriteError(new ErrorCommonComplianceRuleIsDeletedException(ruleStorage.Name), ErrorCategory.InvalidOperation, null);
            }
            base.StampChangesOn(dataObject);
            this.CopyExplicitParameters();
            if (!Utils.ValidateContentDateParameter(psHoldRule.ContentDateFrom, psHoldRule.ContentDateTo))
            {
                throw new InvalidContentDateFromAndContentDateToPredicateException();
            }
            if (!psHoldRule.GetTaskActions().Any <PsComplianceRuleActionBase>())
            {
                base.WriteError(new RuleContainsNoActionsException(psHoldRule.Name), ErrorCategory.InvalidData, psHoldRule);
            }
            psHoldRule.UpdateStorageProperties(this, base.DataSession as IConfigurationSession, false);
        }
Exemplo n.º 2
0
        protected override IConfigurable PrepareDataObject()
        {
            RuleStorage ruleStorage = (RuleStorage)base.PrepareDataObject();

            ruleStorage.Name = base.Name;
            ruleStorage.SetId(((ADObjectId)this.policyStorage.Identity).GetChildId(base.Name));
            PsHoldRule psHoldRule = new PsHoldRule(ruleStorage)
            {
                Comment                 = base.Comment,
                Disabled                = base.Disabled,
                Mode                    = Mode.Enforce,
                Policy                  = Utils.GetUniversalIdentity(this.policyStorage),
                Workload                = this.policyStorage.Workload,
                ContentMatchQuery       = this.ContentMatchQuery,
                ContentDateFrom         = this.ContentDateFrom,
                ContentDateTo           = this.ContentDateTo,
                HoldContent             = this.HoldContent,
                HoldDurationDisplayHint = this.HoldDurationDisplayHint
            };

            if (!psHoldRule.GetTaskActions().Any <PsComplianceRuleActionBase>())
            {
                throw new RuleContainsNoActionsException(psHoldRule.Name);
            }
            ADObjectId adobjectId;

            base.TryGetExecutingUserId(out adobjectId);
            psHoldRule.UpdateStorageProperties(this, base.DataSession as IConfigurationSession, true);
            return(ruleStorage);
        }