mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.6 KiB
50 lines
1.6 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using Squidex.Domain.Apps.Core.Rules;
|
|
using Squidex.Domain.Apps.Core.Rules.Triggers;
|
|
using Squidex.Infrastructure.Migrations;
|
|
using Squidex.Infrastructure.Reflection;
|
|
|
|
namespace Migrate_01.OldTriggers
|
|
{
|
|
[TypeName(nameof(ContentChangedTrigger))]
|
|
public sealed class ContentChangedTrigger : RuleTrigger, IMigrated<RuleTrigger>
|
|
{
|
|
public ReadOnlyCollection<ContentChangedTriggerSchema> Schemas { get; set; }
|
|
|
|
public bool HandleAll { get; set; }
|
|
|
|
public override T Accept<T>(IRuleTriggerVisitor<T> visitor)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public override void Freeze()
|
|
{
|
|
base.Freeze();
|
|
|
|
if (Schemas != null)
|
|
{
|
|
foreach (var schema in Schemas)
|
|
{
|
|
schema.Freeze();
|
|
}
|
|
}
|
|
}
|
|
|
|
public RuleTrigger Migrate()
|
|
{
|
|
var schemas = new ReadOnlyCollection<ContentChangedTriggerSchemaV2>(Schemas.Select(x => x.Migrate()).ToList());
|
|
|
|
return new ContentChangedTriggerV2 { HandleAll = HandleAll, Schemas = schemas };
|
|
}
|
|
}
|
|
}
|
|
|