示例#1
0
        private void ValidateRetentionPolicy()
        {
            IConfigurationSession session = base.DataSession as IConfigurationSession;

            session.SessionSettings.IsSharedConfigChecked = true;
            MultiValuedProperty <ADObjectId> first = (MultiValuedProperty <ADObjectId>) this.DataObject[RetentionPolicyTagSchema.PolicyIds];

            RetentionPolicy[] array = (from x in first
                                       select session.Read <RetentionPolicy>(x) into x
                                       where x != null
                                       select x).ToArray <RetentionPolicy>();
            PresentationRetentionPolicyTag[] second = new PresentationRetentionPolicyTag[]
            {
                new PresentationRetentionPolicyTag(this.DataObject, this.contentSettingsObject)
            };
            foreach (RetentionPolicy retentionPolicy in array)
            {
                PresentationRetentionPolicyTag[] retentionTags = (from x in retentionPolicy.RetentionPolicyTagLinks
                                                                  where !x.Equals(this.DataObject.Id)
                                                                  select session.Read <RetentionPolicyTag>(x) into x
                                                                  select new PresentationRetentionPolicyTag(x)).Concat(second).ToArray <PresentationRetentionPolicyTag>();
                if (this.DataObject.Type == ElcFolderType.All)
                {
                    RetentionPolicyValidator.ValicateDefaultTags(retentionPolicy, retentionTags, new Task.TaskErrorLoggingDelegate(base.WriteError));
                }
                RetentionPolicyValidator.ValidateSystemFolderTags(retentionPolicy, retentionTags, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
        }
        protected override void WriteResult()
        {
            TaskLogger.LogEnter(new object[]
            {
                this.DataObject.Identity
            });
            this.nonAtomicTagObject = this.DataObject;
            base.WriteVerbose(TaskVerboseStringHelper.GetReadObjectVerboseString(this.DataObject.Identity, base.DataSession, typeof(RetentionPolicyTag)));
            RetentionPolicyTag retentionPolicyTag = null;

            try
            {
                IConfigurationSession configurationSession = base.DataSession as IConfigurationSession;
                configurationSession.SessionSettings.IsSharedConfigChecked = true;
                retentionPolicyTag = configurationSession.Read <RetentionPolicyTag>(this.DataObject.Id);
            }
            finally
            {
                base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession));
            }
            if (retentionPolicyTag == null)
            {
                base.WriteError(new ManagementObjectNotFoundException(base.GetErrorMessageObjectNotFound(this.ResolveIdentityString(this.DataObject.Identity), typeof(RetentionPolicyTag).ToString(), (base.DataSession != null) ? base.DataSession.Source : null)), (ErrorCategory)1003, this.DataObject.Identity);
            }
            IConfigurationSession session = base.DataSession as IConfigurationSession;

            this.MakeContentSettingUniqueAndSave(session, this.DataObject, this.contentSettingsObject, this.contentSettingsObject.Name);
            this.nonAtomicTagObject = null;
            PresentationRetentionPolicyTag result = new PresentationRetentionPolicyTag(retentionPolicyTag, this.contentSettingsObject);

            this.WriteResult(result);
            TaskLogger.LogExit();
        }
示例#3
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            RetentionPolicyTag retentionPolicyTag = (RetentionPolicyTag)dataObject;

            if (base.Fields.Contains("Types") && this.Types.Length > 0 && !this.Types.Contains(retentionPolicyTag.Type))
            {
                return;
            }
            if (this.Identity != null || !retentionPolicyTag.SystemTag || this.IncludeSystemTags)
            {
                ElcContentSettings[] array = retentionPolicyTag.GetELCContentSettings().ToArray <ElcContentSettings>();
                if (array == null || array.Length > 1)
                {
                    this.WriteWarning(Strings.WarningRetentionPolicyTagCorrupted(retentionPolicyTag.Name));
                }
                PresentationRetentionPolicyTag dataObject2 = new PresentationRetentionPolicyTag(retentionPolicyTag, array.FirstOrDefault <ElcContentSettings>());
                base.WriteResult(dataObject2);
            }
        }