diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 438171c2..515e235b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,77 @@ -# For more information do to https://github.com/Kentico/Home/wiki/CI-and-Automation-Guidelines - -name: "Build" # Represents the name of the whole action. -on: # Specifies the section where we describe our build triggers. - push: # The action runs with push. - pull_request: # The action runs with a pull request. - schedule: # Specifies the section where we describe the schedule of running the action. - - cron: '0 18 * * 1' # The CRON expression describes when to run the action. -jobs: # Specifies the section where we describe our jobs. - Build: # Specific job section. - runs-on: ubuntu-latest # Describes the environment. - steps: # Specifies the section where we describe the job's steps. - - name: Output some string - run: echo "Set some actual CI steps" \ No newline at end of file +name: "CI: Build and Test" + +on: + push: + branches: [master] + paths: + - "**.cs" + - "**.tsx" + - "**.js" + - "**.csproj" + - "**.props" + - "**.targets" + - "**.sln" + pull_request: + branches: [master] + paths: + - ".github/workflows/build.yml" + - "**.cs" + - "**.cshtml" + - "**.tsx" + - "**.js" + - "**.json" + - "**.csproj" + - "**.props" + - "**.targets" + - "**.sln" + +jobs: + dotnet-format: + name: .Net Format Check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Run dotnet format + run: dotnet format --exclude ./examples/** --verify-no-changes + + build_and_test: + name: Build and Test + runs-on: ubuntu-latest + needs: dotnet-format + defaults: + run: + shell: pwsh + + env: + ASPNETCORE_ENVIRONMENT: CI + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: 1 + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: Install dependencies + run: | + dotnet restore ` + --locked-mode + + - name: Build Solution + run: | + dotnet build ` + --configuration Release ` + --no-restore + + - name: Test Solution + run: | + dotnet test ` + --configuration Release ` + --no-build ` + --no-restore \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Contexts/SourceInstanceContext.cs b/KVA/Migration.Toolkit.Source/Contexts/SourceInstanceContext.cs index 1f7a8599..8da61af3 100644 --- a/KVA/Migration.Toolkit.Source/Contexts/SourceInstanceContext.cs +++ b/KVA/Migration.Toolkit.Source/Contexts/SourceInstanceContext.cs @@ -1,100 +1,100 @@ -namespace Migration.Toolkit.Source.Contexts; - -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common; -using Migration.Toolkit.Common.Services.Ipc; -using Migration.Toolkit.Source.Model; - -public class SourceInstanceContext( - IpcService ipcService, - ILogger logger, - ToolkitConfiguration configuration, - ModelFacade modelFacade) -{ - private readonly Dictionary _cachedInfos = new(StringComparer.InvariantCultureIgnoreCase); - - private bool _sourceInfoLoaded; - - public bool HasInfo => _cachedInfos.Count > 0 && _sourceInfoLoaded; - - public bool IsQuerySourceInstanceEnabled() - { - return configuration.OptInFeatures?.QuerySourceInstanceApi?.Enabled ?? false; - } - - public async Task RequestSourceInstanceInfo() - { - if (!_sourceInfoLoaded) - { - var result = await ipcService.GetSourceInstanceDiscoveredInfos(); - foreach (var (key, value) in result) - { - _cachedInfos.Add(key, value); - logger.LogInformation("Source instance info loaded for site '{SiteName}' successfully", key); - } - - _sourceInfoLoaded = true; - } - - return _sourceInfoLoaded; - } - - public List? GetWidgetPropertyFormComponents(string siteName, string widgetIdentifier) - { - if (_cachedInfos.TryGetValue(siteName, out var info)) - { - return info.WidgetProperties != null && info.WidgetProperties.TryGetValue(widgetIdentifier, out var widgetProperties) - ? widgetProperties - : null; - } - - throw new InvalidOperationException($"No info was loaded for site '{siteName}'"); - } - - public List? GetPageTemplateFormComponents(string siteName, string pageTemplateIdentifier) - { - if (_cachedInfos.TryGetValue(siteName, out var info)) - { - return info.PageTemplateProperties != null && info.PageTemplateProperties.TryGetValue(pageTemplateIdentifier, out var pageTemplate) - ? pageTemplate - : null; - } - - throw new InvalidOperationException($"No info was loaded for site '{siteName}'"); - } - - public List? GetWidgetPropertyFormComponents(int siteId, string widgetIdentifier) - { - var siteName = - modelFacade.SelectById(siteId)?.SiteName - ?? throw new InvalidOperationException($"Source site with SiteID '{siteId}' not exists"); - - return GetWidgetPropertyFormComponents(siteName, widgetIdentifier); - } - - public List? GetPageTemplateFormComponents(int siteId, string pageTemplateIdentifier) - { - var siteName = - modelFacade.SelectById(siteId)?.SiteName - ?? throw new InvalidOperationException($"Source site with SiteID '{siteId}' not exists"); - - return GetPageTemplateFormComponents(siteName, pageTemplateIdentifier); - } - - public List? GetSectionFormComponents(int siteId, string sectionIdentifier) - { - var siteName = - modelFacade.SelectById(siteId)?.SiteName - ?? throw new InvalidOperationException($"Source site with SiteID '{siteId}' not exists"); - - if (_cachedInfos.TryGetValue(siteName, out var info)) - { - return info.SectionProperties != null && info.SectionProperties.TryGetValue(sectionIdentifier, out var sectionFcs) - ? sectionFcs - : null; - } - - throw new InvalidOperationException($"No info was loaded for site '{siteName}'"); - } +namespace Migration.Toolkit.Source.Contexts; + +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common; +using Migration.Toolkit.Common.Services.Ipc; +using Migration.Toolkit.Source.Model; + +public class SourceInstanceContext( + IpcService ipcService, + ILogger logger, + ToolkitConfiguration configuration, + ModelFacade modelFacade) +{ + private readonly Dictionary _cachedInfos = new(StringComparer.InvariantCultureIgnoreCase); + + private bool _sourceInfoLoaded; + + public bool HasInfo => _cachedInfos.Count > 0 && _sourceInfoLoaded; + + public bool IsQuerySourceInstanceEnabled() + { + return configuration.OptInFeatures?.QuerySourceInstanceApi?.Enabled ?? false; + } + + public async Task RequestSourceInstanceInfo() + { + if (!_sourceInfoLoaded) + { + var result = await ipcService.GetSourceInstanceDiscoveredInfos(); + foreach (var (key, value) in result) + { + _cachedInfos.Add(key, value); + logger.LogInformation("Source instance info loaded for site '{SiteName}' successfully", key); + } + + _sourceInfoLoaded = true; + } + + return _sourceInfoLoaded; + } + + public List? GetWidgetPropertyFormComponents(string siteName, string widgetIdentifier) + { + if (_cachedInfos.TryGetValue(siteName, out var info)) + { + return info.WidgetProperties != null && info.WidgetProperties.TryGetValue(widgetIdentifier, out var widgetProperties) + ? widgetProperties + : null; + } + + throw new InvalidOperationException($"No info was loaded for site '{siteName}'"); + } + + public List? GetPageTemplateFormComponents(string siteName, string pageTemplateIdentifier) + { + if (_cachedInfos.TryGetValue(siteName, out var info)) + { + return info.PageTemplateProperties != null && info.PageTemplateProperties.TryGetValue(pageTemplateIdentifier, out var pageTemplate) + ? pageTemplate + : null; + } + + throw new InvalidOperationException($"No info was loaded for site '{siteName}'"); + } + + public List? GetWidgetPropertyFormComponents(int siteId, string widgetIdentifier) + { + var siteName = + modelFacade.SelectById(siteId)?.SiteName + ?? throw new InvalidOperationException($"Source site with SiteID '{siteId}' not exists"); + + return GetWidgetPropertyFormComponents(siteName, widgetIdentifier); + } + + public List? GetPageTemplateFormComponents(int siteId, string pageTemplateIdentifier) + { + var siteName = + modelFacade.SelectById(siteId)?.SiteName + ?? throw new InvalidOperationException($"Source site with SiteID '{siteId}' not exists"); + + return GetPageTemplateFormComponents(siteName, pageTemplateIdentifier); + } + + public List? GetSectionFormComponents(int siteId, string sectionIdentifier) + { + var siteName = + modelFacade.SelectById(siteId)?.SiteName + ?? throw new InvalidOperationException($"Source site with SiteID '{siteId}' not exists"); + + if (_cachedInfos.TryGetValue(siteName, out var info)) + { + return info.SectionProperties != null && info.SectionProperties.TryGetValue(sectionIdentifier, out var sectionFcs) + ? sectionFcs + : null; + } + + throw new InvalidOperationException($"No info was loaded for site '{siteName}'"); + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs b/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs index 283402af..5197ae1e 100644 --- a/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs +++ b/KVA/Migration.Toolkit.Source/Helpers/KenticoHelper.cs @@ -1,16 +1,16 @@ -namespace Migration.Toolkit.Source.Helpers; - -using CMS.Helpers; - -public static class KenticoHelper -{ - public static void CopyCustomData(ContainerCustomData target, string? sourceXml) - { - var customNodeData = new ContainerCustomData(); - customNodeData.LoadData(sourceXml); - foreach (var columnName in customNodeData.ColumnNames) - { - target.SetValue(columnName, customNodeData.GetValue(columnName)); - } - } +namespace Migration.Toolkit.Source.Helpers; + +using CMS.Helpers; + +public static class KenticoHelper +{ + public static void CopyCustomData(ContainerCustomData target, string? sourceXml) + { + var customNodeData = new ContainerCustomData(); + customNodeData.LoadData(sourceXml); + foreach (var columnName in customNodeData.ColumnNames) + { + target.SetValue(columnName, customNodeData.GetValue(columnName)); + } + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Helpers/PrintHelper.cs b/KVA/Migration.Toolkit.Source/Helpers/PrintHelper.cs index e1928c73..67451839 100644 --- a/KVA/Migration.Toolkit.Source/Helpers/PrintHelper.cs +++ b/KVA/Migration.Toolkit.Source/Helpers/PrintHelper.cs @@ -1,7 +1,7 @@ -namespace Migration.Toolkit.Source.Helpers; - -public static class PrintHelper -{ - public static string PrintDictionary(Dictionary dictionary) => - string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); +namespace Migration.Toolkit.Source.Helpers; + +public static class PrintHelper +{ + public static string PrintDictionary(Dictionary dictionary) => + string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/ISourceModel.cs b/KVA/Migration.Toolkit.Source/ISourceModel.cs index 862164d7..046b55e5 100644 --- a/KVA/Migration.Toolkit.Source/ISourceModel.cs +++ b/KVA/Migration.Toolkit.Source/ISourceModel.cs @@ -1,13 +1,13 @@ -namespace Migration.Toolkit.Source; - -using System.Data; -using Migration.Toolkit.Common; - -public interface ISourceModel -{ - static abstract bool IsAvailable(SemanticVersion version); - static abstract string GetPrimaryKeyName(SemanticVersion version); - static abstract string TableName { get; } - static abstract string GuidColumnName { get; } - static abstract T FromReader(IDataReader reader, SemanticVersion version); +namespace Migration.Toolkit.Source; + +using System.Data; +using Migration.Toolkit.Common; + +public interface ISourceModel +{ + static abstract bool IsAvailable(SemanticVersion version); + static abstract string GetPrimaryKeyName(SemanticVersion version); + static abstract string TableName { get; } + static abstract string GuidColumnName { get; } + static abstract T FromReader(IDataReader reader, SemanticVersion version); } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Mappers/AlternativeFormMapper.cs b/KVA/Migration.Toolkit.Source/Mappers/AlternativeFormMapper.cs index 229e2455..ac698869 100644 --- a/KVA/Migration.Toolkit.Source/Mappers/AlternativeFormMapper.cs +++ b/KVA/Migration.Toolkit.Source/Mappers/AlternativeFormMapper.cs @@ -1,98 +1,98 @@ -namespace Migration.Toolkit.Source.Mappers; - -using CMS.DataEngine; -using CMS.FormEngine; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.Enumerations; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.KXP.Api.Services.CmsClass; -using Migration.Toolkit.Source.Contexts; -using Migration.Toolkit.Source.Model; -using Migration.Toolkit.Source.Services; - -public record AlternativeFormMapperSource(ICmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); - -public class AlternativeFormMapper( - ILogger logger, - PrimaryKeyMappingContext pkContext, - IProtocol protocol, - FieldMigrationService fieldMigrationService, - ModelFacade modelFacade - ) - : EntityMapperBase(logger, pkContext, protocol) -{ - protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) - => AlternativeFormInfo.New(); - - protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - var (source, xbkFormClass) = sourceObj; - - target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassID, source.FormClassID, out var classId) - ? classId ?? 0 - : 0; - target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassID, source.FormCoupledClassID, out var coupledClassId) - ? coupledClassId ?? 0 - : 0; - - var formCoupledClass = modelFacade.SelectById(source.FormCoupledClassID); - var formClass = modelFacade.SelectById(source.FormClassID); - - var coupledClassIsDeprecated = - formCoupledClass?.ClassName is { } coupledClassName && - K12SystemClass.NoLongerSupported.Contains(coupledClassName); - - var classIsSysInternal = K12SystemClass.All.Contains(formClass.ClassName); - - var mergedDefinition = formClass.ClassFormDefinition; - if (formCoupledClass != null) - { - logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", formCoupledClass.ClassName, formClass.ClassName); - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, formCoupledClass.ClassFormDefinition); - } - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); - - var patcher = new FormDefinitionPatcher( - logger, - mergedDefinition, - fieldMigrationService, - formClass.ClassIsForm.GetValueOrDefault(false), - formClass.ClassIsDocumentType, - false, - !classIsSysInternal, - true - ); - - var fieldNames = patcher.GetFieldNames().ToList(); - logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); - - patcher.PatchFields(); - - var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); - logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); - - if (coupledClassIsDeprecated && formCoupledClass != null) - { - logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", formCoupledClass.ClassName); - patcher.RemoveFields(formCoupledClass.ClassFormDefinition); - - var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); - logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); - } - - var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); - - var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); - - target.FormDefinition = formDefinitionDifference; - - target.FormDisplayName = source.FormDisplayName; - target.FormGUID = source.FormGUID; - target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); - target.FormLastModified = source.FormLastModified; - target.FormName = source.FormName; - - return target; - } +namespace Migration.Toolkit.Source.Mappers; + +using CMS.DataEngine; +using CMS.FormEngine; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.Enumerations; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.KXP.Api.Services.CmsClass; +using Migration.Toolkit.Source.Contexts; +using Migration.Toolkit.Source.Model; +using Migration.Toolkit.Source.Services; + +public record AlternativeFormMapperSource(ICmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); + +public class AlternativeFormMapper( + ILogger logger, + PrimaryKeyMappingContext pkContext, + IProtocol protocol, + FieldMigrationService fieldMigrationService, + ModelFacade modelFacade + ) + : EntityMapperBase(logger, pkContext, protocol) +{ + protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) + => AlternativeFormInfo.New(); + + protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + var (source, xbkFormClass) = sourceObj; + + target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassID, source.FormClassID, out var classId) + ? classId ?? 0 + : 0; + target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassID, source.FormCoupledClassID, out var coupledClassId) + ? coupledClassId ?? 0 + : 0; + + var formCoupledClass = modelFacade.SelectById(source.FormCoupledClassID); + var formClass = modelFacade.SelectById(source.FormClassID); + + var coupledClassIsDeprecated = + formCoupledClass?.ClassName is { } coupledClassName && + K12SystemClass.NoLongerSupported.Contains(coupledClassName); + + var classIsSysInternal = K12SystemClass.All.Contains(formClass.ClassName); + + var mergedDefinition = formClass.ClassFormDefinition; + if (formCoupledClass != null) + { + logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", formCoupledClass.ClassName, formClass.ClassName); + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, formCoupledClass.ClassFormDefinition); + } + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); + + var patcher = new FormDefinitionPatcher( + logger, + mergedDefinition, + fieldMigrationService, + formClass.ClassIsForm.GetValueOrDefault(false), + formClass.ClassIsDocumentType, + false, + !classIsSysInternal, + true + ); + + var fieldNames = patcher.GetFieldNames().ToList(); + logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); + + patcher.PatchFields(); + + var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); + logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); + + if (coupledClassIsDeprecated && formCoupledClass != null) + { + logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", formCoupledClass.ClassName); + patcher.RemoveFields(formCoupledClass.ClassFormDefinition); + + var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); + logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); + } + + var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); + + var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); + + target.FormDefinition = formDefinitionDifference; + + target.FormDisplayName = source.FormDisplayName; + target.FormGUID = source.FormGUID; + target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); + target.FormLastModified = source.FormLastModified; + target.FormName = source.FormName; + + return target; + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Mappers/CmsAttachmentMapper.cs b/KVA/Migration.Toolkit.Source/Mappers/CmsAttachmentMapper.cs index c5f3338a..69196f7a 100644 --- a/KVA/Migration.Toolkit.Source/Mappers/CmsAttachmentMapper.cs +++ b/KVA/Migration.Toolkit.Source/Mappers/CmsAttachmentMapper.cs @@ -1,55 +1,55 @@ -namespace Migration.Toolkit.Source.Mappers; - -using CMS.Base; -using CMS.MediaLibrary; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Source.Contexts; -using Migration.Toolkit.Source.Helpers; -using Migration.Toolkit.Source.Model; - -public record CmsAttachmentMapperSource(ICmsAttachment Attachment, int TargetLibraryId, IUploadedFile File, string LibrarySubFolder, ICmsTree? AttachmentNode); - -public class CmsAttachmentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) - : EntityMapperBase(logger, pkContext, protocol) -{ - private const string LegacyOriginalPath = "__LegacyOriginalPath"; - - protected override MediaFileInfo? CreateNewInstance(CmsAttachmentMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) - { - // library name is generated with site name in it - return new MediaFileInfo(source.File, source.TargetLibraryId, source.LibrarySubFolder, 0, 0, 0); - } - - protected override MediaFileInfo MapInternal(CmsAttachmentMapperSource args, MediaFileInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - var (cmsAttachment, targetLibraryId, _, _, attachmentNode) = args; - - target.FileName = Path.GetFileNameWithoutExtension(cmsAttachment.AttachmentName); - target.FileTitle = cmsAttachment.AttachmentTitle ?? cmsAttachment.AttachmentName; - target.FileDescription = cmsAttachment.AttachmentDescription ?? string.Empty; - target.FileExtension = cmsAttachment.AttachmentExtension; - target.FileMimeType = cmsAttachment.AttachmentMimeType; - target.FileSize = cmsAttachment.AttachmentSize; - target.FileImageWidth = cmsAttachment.AttachmentImageWidth ?? 0; - target.FileImageHeight = cmsAttachment.AttachmentImageHeight ?? 0; - target.FileGUID = cmsAttachment.AttachmentGUID; - target.FileLibraryID = targetLibraryId; - - // target.FileCreatedByUserID = cmsAttachment.?; - // target.FileModifiedByUserID = cmsAttachment.?; - // target.FileCreatedWhen = cmsAttachment.?; - - target.FileModifiedWhen = cmsAttachment.AttachmentLastModified; - - KenticoHelper.CopyCustomData(target.FileCustomData, cmsAttachment.AttachmentCustomData); - - if (attachmentNode != null) - { - target.FileCustomData.SetValue(LegacyOriginalPath, attachmentNode.NodeAliasPath); - } - - return target; - } +namespace Migration.Toolkit.Source.Mappers; + +using CMS.Base; +using CMS.MediaLibrary; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Source.Contexts; +using Migration.Toolkit.Source.Helpers; +using Migration.Toolkit.Source.Model; + +public record CmsAttachmentMapperSource(ICmsAttachment Attachment, int TargetLibraryId, IUploadedFile File, string LibrarySubFolder, ICmsTree? AttachmentNode); + +public class CmsAttachmentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) + : EntityMapperBase(logger, pkContext, protocol) +{ + private const string LEGACY_ORIGINAL_PATH = "__LegacyOriginalPath"; + + protected override MediaFileInfo? CreateNewInstance(CmsAttachmentMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) + { + // library name is generated with site name in it + return new MediaFileInfo(source.File, source.TargetLibraryId, source.LibrarySubFolder, 0, 0, 0); + } + + protected override MediaFileInfo MapInternal(CmsAttachmentMapperSource args, MediaFileInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + var (cmsAttachment, targetLibraryId, _, _, attachmentNode) = args; + + target.FileName = Path.GetFileNameWithoutExtension(cmsAttachment.AttachmentName); + target.FileTitle = cmsAttachment.AttachmentTitle ?? cmsAttachment.AttachmentName; + target.FileDescription = cmsAttachment.AttachmentDescription ?? string.Empty; + target.FileExtension = cmsAttachment.AttachmentExtension; + target.FileMimeType = cmsAttachment.AttachmentMimeType; + target.FileSize = cmsAttachment.AttachmentSize; + target.FileImageWidth = cmsAttachment.AttachmentImageWidth ?? 0; + target.FileImageHeight = cmsAttachment.AttachmentImageHeight ?? 0; + target.FileGUID = cmsAttachment.AttachmentGUID; + target.FileLibraryID = targetLibraryId; + + // target.FileCreatedByUserID = cmsAttachment.?; + // target.FileModifiedByUserID = cmsAttachment.?; + // target.FileCreatedWhen = cmsAttachment.?; + + target.FileModifiedWhen = cmsAttachment.AttachmentLastModified; + + KenticoHelper.CopyCustomData(target.FileCustomData, cmsAttachment.AttachmentCustomData); + + if (attachmentNode != null) + { + target.FileCustomData.SetValue(LEGACY_ORIGINAL_PATH, attachmentNode.NodeAliasPath); + } + + return target; + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Mappers/CmsClassMapper.cs b/KVA/Migration.Toolkit.Source/Mappers/CmsClassMapper.cs index 8462ce1e..12141a2c 100644 --- a/KVA/Migration.Toolkit.Source/Mappers/CmsClassMapper.cs +++ b/KVA/Migration.Toolkit.Source/Mappers/CmsClassMapper.cs @@ -324,7 +324,7 @@ private static void AppendDocumentNameField(FormInfo nfi, string className, out }); } - private const string RequiredRuleIdentifier = "Kentico.Administration.RequiredValue"; + private const string REQUIRED_RULE_IDENTIFIER = "Kentico.Administration.RequiredValue"; private string AppendRequiredValidationRule(string rulesXml) { @@ -340,7 +340,7 @@ private string AppendRequiredValidationRule(string rulesXml) if (mbIdentifierNodes != null) { - if (mbIdentifierNodes.Cast().Any(identifierNode => identifierNode is { InnerText: RequiredRuleIdentifier })) + if (mbIdentifierNodes.Cast().Any(identifierNode => identifierNode is { InnerText: REQUIRED_RULE_IDENTIFIER })) { return rulesXml; } diff --git a/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs b/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs index 5961fbff..54691464 100644 --- a/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs +++ b/KVA/Migration.Toolkit.Source/Mappers/ContentItemMapper.cs @@ -803,7 +803,7 @@ ICmsClass nodeClass if (fieldMigration.Actions?.Contains(TcaDirective.ConvertToPages) ?? false) { // relation to other document - var convertedRelation = relationshipService.GetNodeRelationships(cmsTree.NodeID) + var convertedRelation = relationshipService.GetNodeRelationships(cmsTree.NodeID, nodeClass.ClassName, field.Guid) .Select(r => new WebPageRelatedItem { WebPageGuid = spoiledGuidContext.EnsureNodeGuid(r.RightNode.NodeGUID, r.RightNode.NodeSiteID, r.RightNode.NodeID) diff --git a/KVA/Migration.Toolkit.Source/ModelExtensions/ICmsPageTemplateConfiguration.cs b/KVA/Migration.Toolkit.Source/ModelExtensions/ICmsPageTemplateConfiguration.cs index 806a2c31..4f8591b9 100644 --- a/KVA/Migration.Toolkit.Source/ModelExtensions/ICmsPageTemplateConfiguration.cs +++ b/KVA/Migration.Toolkit.Source/ModelExtensions/ICmsPageTemplateConfiguration.cs @@ -1,18 +1,18 @@ -namespace Migration.Toolkit.Source.Model; - -public interface ICmsPageTemplateConfigurationK12K13 -{ - int PageTemplateConfigurationID { get; } - Guid PageTemplateConfigurationGUID { get; } - int PageTemplateConfigurationSiteID { get; } - DateTime PageTemplateConfigurationLastModified { get; } - string PageTemplateConfigurationName { get; } - string? PageTemplateConfigurationDescription { get; } - Guid? PageTemplateConfigurationThumbnailGUID { get; } - string PageTemplateConfigurationTemplate { get; } - string? PageTemplateConfigurationWidgets { get; } -} - -public partial record CmsPageTemplateConfigurationK12 : ICmsPageTemplateConfigurationK12K13; - +namespace Migration.Toolkit.Source.Model; + +public interface ICmsPageTemplateConfigurationK12K13 +{ + int PageTemplateConfigurationID { get; } + Guid PageTemplateConfigurationGUID { get; } + int PageTemplateConfigurationSiteID { get; } + DateTime PageTemplateConfigurationLastModified { get; } + string PageTemplateConfigurationName { get; } + string? PageTemplateConfigurationDescription { get; } + Guid? PageTemplateConfigurationThumbnailGUID { get; } + string PageTemplateConfigurationTemplate { get; } + string? PageTemplateConfigurationWidgets { get; } +} + +public partial record CmsPageTemplateConfigurationK12 : ICmsPageTemplateConfigurationK12K13; + public partial record CmsPageTemplateConfigurationK13 : ICmsPageTemplateConfigurationK12K13; \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Providers/ContentItemNameValidator.cs b/KVA/Migration.Toolkit.Source/Providers/ContentItemNameValidator.cs index c8edd722..7c76bc72 100644 --- a/KVA/Migration.Toolkit.Source/Providers/ContentItemNameValidator.cs +++ b/KVA/Migration.Toolkit.Source/Providers/ContentItemNameValidator.cs @@ -1,25 +1,25 @@ -namespace Migration.Toolkit.Source.Providers; - -using CMS.ContentEngine.Internal; - -internal class ContentItemNameValidator : IContentItemNameValidator -{ - /// - public bool IsUnique(string name) - { - return IsUnique(0, name); - } - - - /// - public bool IsUnique(int id, string name) - { - var contentItemInfo = new ContentItemInfo() - { - ContentItemID = id, - ContentItemName = name, - }; - - return contentItemInfo.CheckUniqueCodeName(); - } +namespace Migration.Toolkit.Source.Providers; + +using CMS.ContentEngine.Internal; + +internal class ContentItemNameValidator : IContentItemNameValidator +{ + /// + public bool IsUnique(string name) + { + return IsUnique(0, name); + } + + + /// + public bool IsUnique(int id, string name) + { + var contentItemInfo = new ContentItemInfo() + { + ContentItemID = id, + ContentItemName = name, + }; + + return contentItemInfo.CheckUniqueCodeName(); + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Providers/UniqueContentItemNameProvider.cs b/KVA/Migration.Toolkit.Source/Providers/UniqueContentItemNameProvider.cs index a3a4e748..cfb0e000 100644 --- a/KVA/Migration.Toolkit.Source/Providers/UniqueContentItemNameProvider.cs +++ b/KVA/Migration.Toolkit.Source/Providers/UniqueContentItemNameProvider.cs @@ -1,48 +1,48 @@ -namespace Migration.Toolkit.Source.Providers; - -using System.Threading.Tasks; -using CMS.Base; -using CMS.ContentEngine.Internal; - -internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase -{ - private readonly IContentItemNameValidator codeNameValidator; - - - /// - /// Creates a new instance of . - /// - public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) - : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) - { - this.codeNameValidator = codeNameValidator; - } - - public override Task GetUniqueValue(string inputValue) - { - return base.GetUniqueValue(AddSuffix(inputValue)); - } - - - private string AddSuffix(string codeName) - { - var randomSuffix = GetRandomSuffix(); - var codeNameWithSuffix = codeName += randomSuffix; - - if (codeNameWithSuffix.Length > MaxLength) - { - var availableLength = MaxLength - randomSuffix.Length; - - codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; - } - - return codeNameWithSuffix; - } - - - /// - protected override Task IsValueUnique(string value) - { - return Task.FromResult(codeNameValidator.IsUnique(value)); - } +namespace Migration.Toolkit.Source.Providers; + +using System.Threading.Tasks; +using CMS.Base; +using CMS.ContentEngine.Internal; + +internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase +{ + private readonly IContentItemNameValidator codeNameValidator; + + + /// + /// Creates a new instance of . + /// + public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) + : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) + { + this.codeNameValidator = codeNameValidator; + } + + public override Task GetUniqueValue(string inputValue) + { + return base.GetUniqueValue(AddSuffix(inputValue)); + } + + + private string AddSuffix(string codeName) + { + var randomSuffix = GetRandomSuffix(); + var codeNameWithSuffix = codeName += randomSuffix; + + if (codeNameWithSuffix.Length > MaxLength) + { + var availableLength = MaxLength - randomSuffix.Length; + + codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; + } + + return codeNameWithSuffix; + } + + + /// + protected override Task IsValueUnique(string value) + { + return Task.FromResult(codeNameValidator.IsUnique(value)); + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/ClassService.cs b/KVA/Migration.Toolkit.Source/Services/ClassService.cs index d802ed4f..b238f912 100644 --- a/KVA/Migration.Toolkit.Source/Services/ClassService.cs +++ b/KVA/Migration.Toolkit.Source/Services/ClassService.cs @@ -1,32 +1,32 @@ -namespace Migration.Toolkit.Source.Services; - -using System.Collections.Concurrent; -using Microsoft.Data.SqlClient; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Source.Model; - -public class ClassService(ILogger logger, ModelFacade modelFacade) -{ - private readonly ConcurrentDictionary _userControlsCache = new(StringComparer.InvariantCultureIgnoreCase); - public ICmsFormUserControl? GetFormControlDefinition(string userControlCodeName) - { - return _userControlsCache.GetOrAdd(userControlCodeName, s => - { - try - { - var cmsFormUserControl = modelFacade.SelectWhere( - "UserControlCodeName = @userControlCodeName", - new SqlParameter("userControlCodeName", userControlCodeName) - ).SingleOrDefault(); - - return cmsFormUserControl; - } - catch (Exception ex) - { - logger.LogError("Error while retrieving FormUserControl with codename {CodeName}", s); - } - - return null; - }); - } +namespace Migration.Toolkit.Source.Services; + +using System.Collections.Concurrent; +using Microsoft.Data.SqlClient; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Source.Model; + +public class ClassService(ILogger logger, ModelFacade modelFacade) +{ + private readonly ConcurrentDictionary _userControlsCache = new(StringComparer.InvariantCultureIgnoreCase); + public ICmsFormUserControl? GetFormControlDefinition(string userControlCodeName) + { + return _userControlsCache.GetOrAdd(userControlCodeName, s => + { + try + { + var cmsFormUserControl = modelFacade.SelectWhere( + "UserControlCodeName = @userControlCodeName", + new SqlParameter("userControlCodeName", userControlCodeName) + ).SingleOrDefault(); + + return cmsFormUserControl; + } + catch (Exception ex) + { + logger.LogError("Error while retrieving FormUserControl with codename {CodeName}", s); + } + + return null; + }); + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/CmsRelationshipService.cs b/KVA/Migration.Toolkit.Source/Services/CmsRelationshipService.cs index 2c6fd5ed..75d81208 100644 --- a/KVA/Migration.Toolkit.Source/Services/CmsRelationshipService.cs +++ b/KVA/Migration.Toolkit.Source/Services/CmsRelationshipService.cs @@ -5,23 +5,27 @@ namespace Migration.Toolkit.Source.Services; using Migration.Toolkit.Source.Model; public class CmsRelationshipService( - ILogger logger, ModelFacade modelFacade) { public record NodeRelationShipResult(ICmsRelationship Relationship, ICmsTree? RightNode); - public IEnumerable GetNodeRelationships(int nodeId) + public IEnumerable GetNodeRelationships(int nodeId, string className, Guid fieldGuid) { - var relationships = modelFacade.SelectWhere("LeftNodeId = @nodeId", new SqlParameter("nodeId", nodeId)); + var relationshipName = $"{className}_{fieldGuid}"; + var relationships = modelFacade.SelectWhere(""" + LeftNodeId = @nodeId AND + EXISTS( + SELECT 1 FROM CMS_RelationshipName + WHERE CMS_Relationship.RelationshipNameID = CMS_RelationshipName.RelationshipNameID AND + RelationshipName = @relationshipName + ) + """, + new SqlParameter("nodeId", nodeId), + new SqlParameter("relationshipName", relationshipName) + ); + foreach (var cmsRelationship in relationships) { yield return new(cmsRelationship, modelFacade.SelectById(cmsRelationship.RightNodeID)); } - // foreach (var cmsRelationship in kx13Context.CmsRelationships - // .Include(r => r.RelationshipName) - // .Include(r => r.RightNode) - // .Where(r => r.LeftNodeId == nodeId)) - // { - // yield return cmsRelationship; - // } } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/Model/AttachmentSelectorItem.cs b/KVA/Migration.Toolkit.Source/Services/Model/AttachmentSelectorItem.cs index 4d842f2a..d97e8b56 100644 --- a/KVA/Migration.Toolkit.Source/Services/Model/AttachmentSelectorItem.cs +++ b/KVA/Migration.Toolkit.Source/Services/Model/AttachmentSelectorItem.cs @@ -1,11 +1,11 @@ -namespace Migration.Toolkit.Source.Services.Model; - -using Newtonsoft.Json; - -/// Represents an item for the attachment selector. -public class AttachmentSelectorItem -{ - /// Attachment GUID. - [JsonProperty("fileGuid")] - public Guid FileGuid { get; set; } +namespace Migration.Toolkit.Source.Services.Model; + +using Newtonsoft.Json; + +/// Represents an item for the attachment selector. +public class AttachmentSelectorItem +{ + /// Attachment GUID. + [JsonProperty("fileGuid")] + public Guid FileGuid { get; set; } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/Model/PageSelectorItem.cs b/KVA/Migration.Toolkit.Source/Services/Model/PageSelectorItem.cs index 7711b333..47846270 100644 --- a/KVA/Migration.Toolkit.Source/Services/Model/PageSelectorItem.cs +++ b/KVA/Migration.Toolkit.Source/Services/Model/PageSelectorItem.cs @@ -1,11 +1,11 @@ -namespace Migration.Toolkit.Source.Services.Model; - -using Newtonsoft.Json; - -/// Represents an item for a page selector. -public class PageSelectorItem -{ - /// Node Guid of a page. - [JsonProperty("nodeGuid")] - public Guid NodeGuid { get; set; } +namespace Migration.Toolkit.Source.Services.Model; + +using Newtonsoft.Json; + +/// Represents an item for a page selector. +public class PageSelectorItem +{ + /// Node Guid of a page. + [JsonProperty("nodeGuid")] + public Guid NodeGuid { get; set; } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/Model/PageTemplateConfiguration.cs b/KVA/Migration.Toolkit.Source/Services/Model/PageTemplateConfiguration.cs index d896cd9d..c44216ca 100644 --- a/KVA/Migration.Toolkit.Source/Services/Model/PageTemplateConfiguration.cs +++ b/KVA/Migration.Toolkit.Source/Services/Model/PageTemplateConfiguration.cs @@ -1,29 +1,29 @@ -namespace Migration.Toolkit.Source.Services.Model; - -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -/// -/// Page template configuration for the instance. -/// -[DataContract(Name = "PageTemplate", Namespace = "")] -public class PageTemplateConfiguration -{ - /// Identifier of the page template. - [DataMember] - [JsonProperty("identifier")] - public string Identifier { get; set; } - - /// - /// Identifier of the page template configuration based on which the page was created. - /// - [DataMember] - [JsonProperty("configurationIdentifier")] - public Guid ConfigurationIdentifier { get; set; } - - /// Page template properties. - [DataMember] - [JsonProperty("properties")] - public JObject Properties { get; set; } +namespace Migration.Toolkit.Source.Services.Model; + +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +/// +/// Page template configuration for the instance. +/// +[DataContract(Name = "PageTemplate", Namespace = "")] +public class PageTemplateConfiguration +{ + /// Identifier of the page template. + [DataMember] + [JsonProperty("identifier")] + public string Identifier { get; set; } + + /// + /// Identifier of the page template configuration based on which the page was created. + /// + [DataMember] + [JsonProperty("configurationIdentifier")] + public Guid ConfigurationIdentifier { get; set; } + + /// Page template properties. + [DataMember] + [JsonProperty("properties")] + public JObject Properties { get; set; } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/ModuleLoader.cs b/KVA/Migration.Toolkit.Source/Services/ModuleLoader.cs index 7388ada2..3154b4b6 100644 --- a/KVA/Migration.Toolkit.Source/Services/ModuleLoader.cs +++ b/KVA/Migration.Toolkit.Source/Services/ModuleLoader.cs @@ -1,35 +1,35 @@ -namespace Migration.Toolkit.Source.Services; - -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.Services.Ipc; -using Migration.Toolkit.Source.Contexts; - -public class ModuleLoader( - IpcService ipc, - SourceInstanceContext sourceInstanceContext, - ILogger logger -) - : IModuleLoader -{ - public async Task LoadAsync() - { - try - { - if (sourceInstanceContext.IsQuerySourceInstanceEnabled()) - { - var ipcConfigured = await ipc.IsConfiguredAsync(); - if (ipcConfigured) - { - await sourceInstanceContext.RequestSourceInstanceInfo(); - } - } - } - catch (Exception ex) - { - logger.LogCritical(ex, "Check if opt-in feature 'QuerySourceInstanceApi' is configured correctly and all connections configured are reachable and hosted on localhost"); - throw; - } - } +namespace Migration.Toolkit.Source.Services; + +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.Services.Ipc; +using Migration.Toolkit.Source.Contexts; + +public class ModuleLoader( + IpcService ipc, + SourceInstanceContext sourceInstanceContext, + ILogger logger +) + : IModuleLoader +{ + public async Task LoadAsync() + { + try + { + if (sourceInstanceContext.IsQuerySourceInstanceEnabled()) + { + var ipcConfigured = await ipc.IsConfiguredAsync(); + if (ipcConfigured) + { + await sourceInstanceContext.RequestSourceInstanceInfo(); + } + } + } + catch (Exception ex) + { + logger.LogCritical(ex, "Check if opt-in feature 'QuerySourceInstanceApi' is configured correctly and all connections configured are reachable and hosted on localhost"); + throw; + } + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/PageTemplateMigrator.cs b/KVA/Migration.Toolkit.Source/Services/PageTemplateMigrator.cs index c8469570..cb6e4332 100644 --- a/KVA/Migration.Toolkit.Source/Services/PageTemplateMigrator.cs +++ b/KVA/Migration.Toolkit.Source/Services/PageTemplateMigrator.cs @@ -1,54 +1,54 @@ -namespace Migration.Toolkit.Source.Services; - -using CMS.DataEngine; -using CMS.Websites; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Source.Model; - -public class PageTemplateMigrator( - ILogger logger, - IEntityMapper pageTemplateConfigurationMapper, - IProtocol protocol) -{ - public Task MigratePageTemplateConfigurationAsync(ICmsPageTemplateConfiguration ksPageTemplateConfiguration) - { - if (ksPageTemplateConfiguration is ICmsPageTemplateConfigurationK12K13 pageTemplateConfiguration) - { - var kxpProvider = Provider.Instance; - var kxpPageTemplateConfiguration = kxpProvider.Get().WhereEquals("PageTemplateConfigurationGUID", pageTemplateConfiguration.PageTemplateConfigurationGUID).FirstOrDefault(); - - var mapped = pageTemplateConfigurationMapper.Map(ksPageTemplateConfiguration, kxpPageTemplateConfiguration); - - if (mapped is { Success: true, Item: { } result }) - { - try - { - kxpProvider.Set(result); - - protocol.Success(ksPageTemplateConfiguration, result, null); - } - catch (Exception exception) - { - logger.LogError(exception, "Failed to create target instance of PageTemplateConfiguration"); - protocol.Append(HandbookReferences - .ErrorCreatingTargetInstance(exception) - .NeedsManualAction() - .WithData(new - { - exception, - SourcePageTemplateConfigurationGuid = pageTemplateConfiguration.PageTemplateConfigurationGUID, - SourcePageTemplateConfigurationName = pageTemplateConfiguration.PageTemplateConfigurationName - }) - ); - } - } - return Task.CompletedTask; - } - else - { - return Task.CompletedTask; - } - } +namespace Migration.Toolkit.Source.Services; + +using CMS.DataEngine; +using CMS.Websites; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Source.Model; + +public class PageTemplateMigrator( + ILogger logger, + IEntityMapper pageTemplateConfigurationMapper, + IProtocol protocol) +{ + public Task MigratePageTemplateConfigurationAsync(ICmsPageTemplateConfiguration ksPageTemplateConfiguration) + { + if (ksPageTemplateConfiguration is ICmsPageTemplateConfigurationK12K13 pageTemplateConfiguration) + { + var kxpProvider = Provider.Instance; + var kxpPageTemplateConfiguration = kxpProvider.Get().WhereEquals("PageTemplateConfigurationGUID", pageTemplateConfiguration.PageTemplateConfigurationGUID).FirstOrDefault(); + + var mapped = pageTemplateConfigurationMapper.Map(ksPageTemplateConfiguration, kxpPageTemplateConfiguration); + + if (mapped is { Success: true, Item: { } result }) + { + try + { + kxpProvider.Set(result); + + protocol.Success(ksPageTemplateConfiguration, result, null); + } + catch (Exception exception) + { + logger.LogError(exception, "Failed to create target instance of PageTemplateConfiguration"); + protocol.Append(HandbookReferences + .ErrorCreatingTargetInstance(exception) + .NeedsManualAction() + .WithData(new + { + exception, + SourcePageTemplateConfigurationGuid = pageTemplateConfiguration.PageTemplateConfigurationGUID, + SourcePageTemplateConfigurationName = pageTemplateConfiguration.PageTemplateConfigurationName + }) + ); + } + } + return Task.CompletedTask; + } + else + { + return Task.CompletedTask; + } + } } \ No newline at end of file diff --git a/KVA/Migration.Toolkit.Source/Services/ReusableSchemaService.cs b/KVA/Migration.Toolkit.Source/Services/ReusableSchemaService.cs index 77fa91e7..e2cdf445 100644 --- a/KVA/Migration.Toolkit.Source/Services/ReusableSchemaService.cs +++ b/KVA/Migration.Toolkit.Source/Services/ReusableSchemaService.cs @@ -1,135 +1,135 @@ -namespace Migration.Toolkit.Source.Services; - -using CMS.ContentEngine.Internal; -using CMS.Core; -using CMS.DataEngine; -using CMS.FormEngine; -using Kentico.Xperience.Admin.Base.UIPages; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common; -using Migration.Toolkit.Common.Helpers; - -public class ReusableSchemaService(ILogger logger, ToolkitConfiguration configuration) -{ - private readonly IReusableFieldSchemaManager _reusableFieldSchemaManager = Service.Resolve(); - - public bool IsConversionToReusableFieldSchemaRequested(string className) - { - return configuration.ClassNamesCreateReusableSchema.Contains(className); - } - - public DataClassInfo ConvertToReusableSchema(DataClassInfo kxoDataClass) - { - var reusableSchemaGuid = GuidHelper.CreateReusableSchemaGuid($"{kxoDataClass.ClassName}|{kxoDataClass.ClassGUID}"); - var schema = _reusableFieldSchemaManager.Get(reusableSchemaGuid); - if (schema == null) - { - _reusableFieldSchemaManager.CreateSchema(new CreateReusableFieldSchemaParameters(kxoDataClass.ClassName, kxoDataClass.ClassDisplayName) { Guid = reusableSchemaGuid }); - } - - var formInfo = new FormInfo(kxoDataClass.ClassFormDefinition); - var fieldsForRem = new List(); - foreach (var formFieldInfo in formInfo.GetFields(true, true)) - { - if (formFieldInfo is { PrimaryKey: false, System: false }) - { - var success = false; - try - { - try - { - formFieldInfo.Name = GetUniqueFieldName(kxoDataClass.ClassName, formFieldInfo.Name); - _reusableFieldSchemaManager.AddField(kxoDataClass.ClassName, formFieldInfo); - success = true; - } - catch (InvalidOperationException ioex) when (ioex.Message.Contains("already exist on reusable field schema")) - { - // exists - we do not support update of reusable field schema - // _reusableFieldSchemaManager.UpdateField(kxoDataClass.ClassName, formFieldInfo.Name, formFieldInfo); - success = true; - } - } - catch (Exception ex) - { - logger.LogError(ex, "Failed to convert field {Name} for reusable schema: {FormFieldInfo}", formFieldInfo.Name, formFieldInfo.ToString()); - } - - if (success) - { - fieldsForRem.Add(formFieldInfo); - } - } - } - - foreach (var formFieldInfo in fieldsForRem) - { - formInfo.RemoveFormField(formFieldInfo.Name); - } - - formInfo.AddFormItem(new FormSchemaInfo { Name = kxoDataClass.ClassName, Guid = reusableSchemaGuid }); - kxoDataClass.ClassFormDefinition = formInfo.GetXmlDefinition(); - return kxoDataClass; - } - - public bool HasClassReusableSchema(DataClassInfo dataClassInfo, Guid reusableFieldSchemaGuid) - { - var formInfo = new FormInfo(dataClassInfo.ClassFormDefinition); - return formInfo - .GetFields() - .Any(x => x.Guid.Equals(reusableFieldSchemaGuid)); - } - - public void AddReusableSchemaToDataClass(DataClassInfo dataClassInfo, Guid reusableFieldSchemaGuid) - { - var formInfo = new FormInfo(dataClassInfo.ClassFormDefinition); - formInfo.AddFormItem(new FormSchemaInfo { Name = dataClassInfo.ClassName, Guid = reusableFieldSchemaGuid }); - dataClassInfo.ClassFormDefinition = formInfo.GetXmlDefinition(); - } - - public Guid EnsureReusableFieldSchema(string name, string displayName, string description, params FormFieldInfo[] fields) - { - var reusableSchemaGuid = GuidHelper.CreateReusableSchemaGuid($"{name}|{displayName}"); - var schema = _reusableFieldSchemaManager.Get(reusableSchemaGuid); - if (schema == null) - { - _reusableFieldSchemaManager.CreateSchema(new CreateReusableFieldSchemaParameters(name, displayName, description) { Guid = reusableSchemaGuid }); - } - - foreach (var formFieldInfo in fields) - { - if (formFieldInfo is { PrimaryKey: false, System: false }) - { - try - { - try - { - _reusableFieldSchemaManager.AddField(name, formFieldInfo); - } - catch (InvalidOperationException ioex) when (ioex.Message.Contains("already exist on reusable field schema")) - { - // exists - we do not support update of reusable field schema - // _reusableFieldSchemaManager.UpdateField(kxoDataClass.ClassName, formFieldInfo.Name, formFieldInfo); - } - } - catch (Exception ex) - { - logger.LogError(ex, "Failed to convert field {Name} for reusable schema: {FormFieldInfo}", formFieldInfo.Name, formFieldInfo.ToString()); - } - } - else - { - throw new InvalidOperationException("Unable to add field to reusable schema, field is primary key or system"); - } - } - - return reusableSchemaGuid; - } - - public static string GetUniqueFieldName(string className, string fieldName) - { - return $"{className}__{fieldName}".Replace(".", "_"); - } - - public static string RemoveClassPrefix(string className, string schemaFieldName) - => schemaFieldName.Replace($"{className}__".Replace(".", "_"), ""); +namespace Migration.Toolkit.Source.Services; + +using CMS.ContentEngine.Internal; +using CMS.Core; +using CMS.DataEngine; +using CMS.FormEngine; +using Kentico.Xperience.Admin.Base.UIPages; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common; +using Migration.Toolkit.Common.Helpers; + +public class ReusableSchemaService(ILogger logger, ToolkitConfiguration configuration) +{ + private readonly IReusableFieldSchemaManager _reusableFieldSchemaManager = Service.Resolve(); + + public bool IsConversionToReusableFieldSchemaRequested(string className) + { + return configuration.ClassNamesCreateReusableSchema.Contains(className); + } + + public DataClassInfo ConvertToReusableSchema(DataClassInfo kxoDataClass) + { + var reusableSchemaGuid = GuidHelper.CreateReusableSchemaGuid($"{kxoDataClass.ClassName}|{kxoDataClass.ClassGUID}"); + var schema = _reusableFieldSchemaManager.Get(reusableSchemaGuid); + if (schema == null) + { + _reusableFieldSchemaManager.CreateSchema(new CreateReusableFieldSchemaParameters(kxoDataClass.ClassName, kxoDataClass.ClassDisplayName) { Guid = reusableSchemaGuid }); + } + + var formInfo = new FormInfo(kxoDataClass.ClassFormDefinition); + var fieldsForRem = new List(); + foreach (var formFieldInfo in formInfo.GetFields(true, true)) + { + if (formFieldInfo is { PrimaryKey: false, System: false }) + { + var success = false; + try + { + try + { + formFieldInfo.Name = GetUniqueFieldName(kxoDataClass.ClassName, formFieldInfo.Name); + _reusableFieldSchemaManager.AddField(kxoDataClass.ClassName, formFieldInfo); + success = true; + } + catch (InvalidOperationException ioex) when (ioex.Message.Contains("already exist on reusable field schema")) + { + // exists - we do not support update of reusable field schema + // _reusableFieldSchemaManager.UpdateField(kxoDataClass.ClassName, formFieldInfo.Name, formFieldInfo); + success = true; + } + } + catch (Exception ex) + { + logger.LogError(ex, "Failed to convert field {Name} for reusable schema: {FormFieldInfo}", formFieldInfo.Name, formFieldInfo.ToString()); + } + + if (success) + { + fieldsForRem.Add(formFieldInfo); + } + } + } + + foreach (var formFieldInfo in fieldsForRem) + { + formInfo.RemoveFormField(formFieldInfo.Name); + } + + formInfo.AddFormItem(new FormSchemaInfo { Name = kxoDataClass.ClassName, Guid = reusableSchemaGuid }); + kxoDataClass.ClassFormDefinition = formInfo.GetXmlDefinition(); + return kxoDataClass; + } + + public bool HasClassReusableSchema(DataClassInfo dataClassInfo, Guid reusableFieldSchemaGuid) + { + var formInfo = new FormInfo(dataClassInfo.ClassFormDefinition); + return formInfo + .GetFields() + .Any(x => x.Guid.Equals(reusableFieldSchemaGuid)); + } + + public void AddReusableSchemaToDataClass(DataClassInfo dataClassInfo, Guid reusableFieldSchemaGuid) + { + var formInfo = new FormInfo(dataClassInfo.ClassFormDefinition); + formInfo.AddFormItem(new FormSchemaInfo { Name = dataClassInfo.ClassName, Guid = reusableFieldSchemaGuid }); + dataClassInfo.ClassFormDefinition = formInfo.GetXmlDefinition(); + } + + public Guid EnsureReusableFieldSchema(string name, string displayName, string description, params FormFieldInfo[] fields) + { + var reusableSchemaGuid = GuidHelper.CreateReusableSchemaGuid($"{name}|{displayName}"); + var schema = _reusableFieldSchemaManager.Get(reusableSchemaGuid); + if (schema == null) + { + _reusableFieldSchemaManager.CreateSchema(new CreateReusableFieldSchemaParameters(name, displayName, description) { Guid = reusableSchemaGuid }); + } + + foreach (var formFieldInfo in fields) + { + if (formFieldInfo is { PrimaryKey: false, System: false }) + { + try + { + try + { + _reusableFieldSchemaManager.AddField(name, formFieldInfo); + } + catch (InvalidOperationException ioex) when (ioex.Message.Contains("already exist on reusable field schema")) + { + // exists - we do not support update of reusable field schema + // _reusableFieldSchemaManager.UpdateField(kxoDataClass.ClassName, formFieldInfo.Name, formFieldInfo); + } + } + catch (Exception ex) + { + logger.LogError(ex, "Failed to convert field {Name} for reusable schema: {FormFieldInfo}", formFieldInfo.Name, formFieldInfo.ToString()); + } + } + else + { + throw new InvalidOperationException("Unable to add field to reusable schema, field is primary key or system"); + } + } + + return reusableSchemaGuid; + } + + public static string GetUniqueFieldName(string className, string fieldName) + { + return $"{className}__{fieldName}".Replace(".", "_"); + } + + public static string RemoveClassPrefix(string className, string schemaFieldName) + => schemaFieldName.Replace($"{className}__".Replace(".", "_"), ""); } \ No newline at end of file diff --git a/Migration.Toolkit.CLI/README.md b/Migration.Toolkit.CLI/README.md index 89e8770f..02358550 100644 --- a/Migration.Toolkit.CLI/README.md +++ b/Migration.Toolkit.CLI/README.md @@ -1,6 +1,6 @@ # Migration CLI -The [Migration toolkit](/README.md) transfers content and other data from **Kentico Xperience 13**, **Kentico 12** or **Kentico 11** to **Xperience by Kentico**. +The [Xperience by Kentico: Kentico Migration Tool](/README.md) transfers content and other data from **Kentico Xperience 13**, **Kentico 12** or **Kentico 11** to **Xperience by Kentico**. The migration is performed by running a command for the .NET CLI. @@ -10,7 +10,7 @@ The target of the migration must be an Xperience by Kentico instance that fulfil * The instance's database and file system must be accessible from the environment where you run the migration. * The target application *must not be running* when you start the migration. -* The target instance must be empty except for data from the source instance created by previous runs of the Migration toolkit. +* The target instance must be empty except for data from the source instance created by previous runs of this tool. * For performance optimization, the migration transfers certain objects using bulk SQL queries. As a result, you always need to delete all objects of the following types before running repeated migrations: * **Contacts**, including their **Activities** (when using the `migrate --contact-management` parameter) * **Consent agreements** (when using the `migrate --data-protection` parameter) @@ -48,7 +48,7 @@ Migration.Toolkit.CLI.exe migrate --sites --custom-modules --users --members --f | `--members` | Enables migration of live site user accounts to [members](https://docs.xperience.io/x/BIsuCw).

See: [Migration details for specific object types - Members](#members) | `--sites`, `--custom-modules` | | `--settings-keys` | Enables migration of values for [settings](https://docs.xperience.io/x/7YjFC) that are available in Xperience by Kentico. | `--sites` | | `--page-types` | Enables migration of [content types](https://docs.xperience.io/x/gYHWCQ) (originally *page types* in Kentico Xperience 13) and [preset page templates](https://docs.xperience.io/x/KZnWCQ) (originally *custom page templates*). Required to migrate Pages.

See: [Migration details for specific object types - Content types](#content-types) | `--sites` | -| `--pages` | Enables migration of [pages](https://docs.xperience.io/x/bxzfBw).

The target instance must not contain pages other than those created by previous runs of the Migration toolkit.

See: [Migration details for specific object types - Pages](#pages) | `--sites`, `--users`, `--page-types` | +| `--pages` | Enables migration of [pages](https://docs.xperience.io/x/bxzfBw).

The target instance must not contain pages other than those created by previous runs of the Kentico Migration Tool.

See: [Migration details for specific object types - Pages](#pages) | `--sites`, `--users`, `--page-types` | | `--categories` | Enables migration of categories to taxonomies. Xperience by Kentico uses a different approach to categorization. Categories are migrated to [taxonomies](https://docs.kentico.com/x/taxonomies_xp) and selected categories for each page are assigned to pages in the target instance via a [reusable field schema](https://docs.kentico.com/x/D4_OD). See [`Categories`](#categories). | `--sites`, `--users`, `--pagetypes`, `--pages` | | `--attachments` | Enables migration of page attachments to [media libraries](https://docs.xperience.io/x/agKiCQ) (page attachments are not supported in Xperience by Kentico).

See: [Migration details for specific object types - Attachments](#attachments) | `--sites`, `--custom-modules` | | `--contact-management` | Enables migration of [contacts](https://docs.xperience.io/x/nYPWCQ) and [activities](https://docs.xperience.io/x/oYPWCQ). The target instance must not contain any contacts or activities. May run for a long time depending on the number of contacts in the source database. | `--users`, `--custom-modules` | @@ -79,9 +79,9 @@ Xperience by Kentico currently does not support: * Page type inheritance. You cannot migrate page types that inherit fields from other types. * Categories for page type fields. Field categories are not migrated with page types. -The Migration toolkit attempts to map the *Data type* and *Form control* of page type fields to an appropriate equivalent in Xperience by Kentico. This is not always possible, and cannot be done for custom data types or form controls. We recommend that you check your content type fields after the migration and adjust them if necessary. +The Kentico Migration Tool attempts to map the *Data type* and *Form control* of page type fields to an appropriate equivalent in Xperience by Kentico. This is not always possible, and cannot be done for custom data types or form controls. We recommend that you check your content type fields after the migration and adjust them if necessary. -The following table describes how the Migration toolkit maps the data types and form controls/components of page type fields: +The following table describes how the Kentico Migration Tool maps the data types and form controls/components of page type fields: | KX13/12/11 Data type | XbK Data type | KX13/12/11 Form control | XbK Form component | | ------------------------- | ------------------------ | ----------------------------- | --------------------- | @@ -137,7 +137,7 @@ You can create [reusable field schemas](https://docs.kentico.com/x/D4_OD) from p By default, JSON data storing the Page Builder content of pages and custom page templates is migrated directly without modifications. On the target Xperience by Kentico instance, the migrated data can work in the Page Builder's legacy compatibility mode. However, we strongly recommend updating your codebase to the new Xperience by Kentico components. -The Migration toolkit provides an advanced migration mode for Page Builder content that utilizes API discovery on the source instance. To learn more details and how to configure this feature, see [Source instance API discovery](#source-instance-api-discovery). +The Kentico Migration Tool provides an advanced migration mode for Page Builder content that utilizes API discovery on the source instance. To learn more details and how to configure this feature, see [Source instance API discovery](#source-instance-api-discovery). #### Categories @@ -180,7 +180,7 @@ Module and class migration does NOT include: * Custom settings under modules, which are currently not supported in Xperience by Kentico * Module permissions (permissions work differently in Xperience by Kentico, see [Role management](https://docs.xperience.io/x/7IVwCg) and [UI page permission checks](https://docs.xperience.io/x/8IKyCg)) -As with all object types, the migration toolkit does not transfer code files to the target project. You need to manually move all code files generated for your custom classes (*Info*, *InfoProvider*, etc.). +As with all object types, the Kentico Migration Tool does not transfer code files to the target project. You need to manually move all code files generated for your custom classes (*Info*, *InfoProvider*, etc.). To learn more about custom modules and classes in Xperience by Kentico, see the [Object types](https://docs.xperience.io/x/AKDWCQ) documentation. @@ -213,7 +213,7 @@ Page attachments are not supported in Xperience by Kentico. Attachment files are * Any "floating" attachments without an associated page are migrated into the media library root folder. * The migration does not include temporary attachments (created when a file upload is not finished correctly). If any are present on the source instance, a warning is logged in the [migration protocol](./MIGRATION_PROTOCOL_REFERENCE.md). -The following is an example of a media library created by the Migration toolkit for page attachments: +The following is an example of a media library created by the Kentico Migration Tool for page attachments: #### Media library "Attachments for site DancingGoat" @@ -312,19 +312,19 @@ Before you run the migration, configure options in the `Migration.Toolkit.CLI/ap Add the options under the `Settings` section in the configuration file. -| Configuration | Description | -|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| -| KxConnectionString | The connection string to the source Kentico Xperience 13 database. | -| KxCmsDirPath | The absolute file system path of the **CMS** folder in the source Kentico Xperience 13 administration project. Required to migrate media library files. | -| XbKDirPath | The absolute file system path of the root of the target Xperience by Kentico project. Required to migrate media library and page attachment files. | -| XbKApiSettings | Configuration options set for the API when creating migrated objects in the target application.

The `ConnectionStrings.CMSConnectionString`option is required - set the connection string to the target Xperience by Kentico database (the same value as `XbKConnectionString`). | -| MigrationProtocolPath | The absolute file system path of the location where the [migration protocol file](./MIGRATION_PROTOCOL_REFERENCE.md) is generated.

For example: `"C:\\Logs\\Migration.Toolkit.Protocol.log"` | -| MigrateOnlyMediaFileInfo | If set to `true`, only the database representations of media files are migrated, without the files in the media folder in the project's file system. For example, enable this option if your media library files are mapped to a shared directory or Cloud storage.

If `false`, media files are migrated based on the `KxCmsDirPath` location. | -| MemberIncludeUserSystemFields | Determines which system fields from the *CMS_User* and *CMS_UserSettings* tables are migrated to *CMS_Member* in Xperience by Kentico. Fields that do not exist in *CMS_Member* are automatically created.

The sample `appsettings.json` file included with the toolkit by default includes all user fields that can be migrated from Kentico Xperience 13. Exclude specific fields from the migration by removing them from this configuration option. | -| UseOmActivityNodeRelationAutofix | Determines how the migration handles references from Contact management activities to non-existing pages.

Possible options:
`DiscardData` - faulty references are removed,
`AttemptFix` - references are updated to the IDs of corresponding pages created by the migration,
`Error` - an error is reported and the reference can be translated or otherwise handled manually | -| UseOmActivitySiteRelationAutofix | Determines how the migration handles site references from Contact management activities.

Possible options: `DiscardData`,`AttemptFix`,`Error` | -| EntityConfigurations | Contains options that allow you to fine-tune the migration of specific object types. | -| EntityConfigurations.*<object table name>*.ExcludeCodeNames | Excludes objects with the specified code names from the migration. | +| Configuration | Description | +|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| +| KxConnectionString | The connection string to the source Kentico Xperience 13 database. | +| KxCmsDirPath | The absolute file system path of the **CMS** folder in the source Kentico Xperience 13 administration project. Required to migrate media library files. | +| XbKDirPath | The absolute file system path of the root of the target Xperience by Kentico project. Required to migrate media library and page attachment files. | +| XbKApiSettings | Configuration options set for the API when creating migrated objects in the target application.

The `ConnectionStrings.CMSConnectionString`option is required - set the connection string to the target Xperience by Kentico database (the same value as `XbKConnectionString`). | +| MigrationProtocolPath | The absolute file system path of the location where the [migration protocol file](./MIGRATION_PROTOCOL_REFERENCE.md) is generated.

For example: `"C:\\Logs\\Migration.Toolkit.Protocol.log"` | +| MigrateOnlyMediaFileInfo | If set to `true`, only the database representations of media files are migrated, without the files in the media folder in the project's file system. For example, enable this option if your media library files are mapped to a shared directory or Cloud storage.

If `false`, media files are migrated based on the `KxCmsDirPath` location. | +| MemberIncludeUserSystemFields | Determines which system fields from the *CMS_User* and *CMS_UserSettings* tables are migrated to *CMS_Member* in Xperience by Kentico. Fields that do not exist in *CMS_Member* are automatically created.

The sample `appsettings.json` file included with the tool by default includes all user fields that can be migrated from Kentico Xperience 13. Exclude specific fields from the migration by removing them from this configuration option. | +| UseOmActivityNodeRelationAutofix | Determines how the migration handles references from Contact management activities to non-existing pages.

Possible options:
`DiscardData` - faulty references are removed,
`AttemptFix` - references are updated to the IDs of corresponding pages created by the migration,
`Error` - an error is reported and the reference can be translated or otherwise handled manually | +| UseOmActivitySiteRelationAutofix | Determines how the migration handles site references from Contact management activities.

Possible options: `DiscardData`,`AttemptFix`,`Error` | +| EntityConfigurations | Contains options that allow you to fine-tune the migration of specific object types. | +| EntityConfigurations.*<object table name>*.ExcludeCodeNames | Excludes objects with the specified code names from the migration. | | CreateReusableFieldSchemaForClasses | Specifies which page types are also converted to [reusable field schemas](#convert-page-types-to-reusable-field-schemas). | | OptInFeatures.QuerySourceInstanceApi.Enabled | If `true`, [source instance API discovery](#source-instance-api-discovery) is enabled to allow advanced migration of Page Builder content for pages and page templates. | | OptInFeatures.QuerySourceInstanceApi.Connections | To use [source instance API discovery](#source-instance-api-discovery), you need to add a connection JSON object containing the following values:
`SourceInstanceUri` - the base URI where the source instance's live site application is running.
`Secret` - the secret that you set in the *ToolkitApiController.cs* file on the source instance. | @@ -413,7 +413,7 @@ By default, JSON data storing the Page Builder content of pages and custom page However, we strongly recommend updating your codebase to the new Xperience by Kentico components. See [Editing components in Xperience by Kentico](https://docs.xperience.io/x/wIfWCQ) to learn more. -To convert Page Builder data to a format suitable for the Xperience by Kentico components, the Migration toolkit provides an advanced migration mode that utilizes API discovery on the source instance. The advanced mode currently provides the following data conversion: +To convert Page Builder data to a format suitable for the Xperience by Kentico components, the Kentico Migration Tool provides an advanced migration mode that utilizes API discovery on the source instance. The advanced mode currently provides the following data conversion: * **Attachment selector** properties - converted to a format suitable for the Xperience by Kentico **Media selector** component, with `IEnumerable` values. * **Page selector** properties - converted to a format suitable for the Xperience by Kentico Page selector component, with `IEnumerable` values. @@ -438,7 +438,7 @@ public class MyWidgetProperties : IWidgetProperties ### API discovery setup -1. Copy the `ToolkitApiController.cs` file to the `Controllers` folder in the **live site project** of your Kentico Xperience 13 source instance. Get the file from the following location in the Migration toolkit repository: +1. Copy the `ToolkitApiController.cs` file to the `Controllers` folder in the **live site project** of your Kentico Xperience 13 source instance. Get the file from the following location in the Kentico Migration Tool repository: * For .NET Core projects: `KX13.Extensions\ToolkitApiController.cs` * For MVC 5 (.NET Framework 4.8) projects: `KX13.NET48.Extensions\ToolkitApiController.NET48.cs` @@ -491,7 +491,7 @@ public class MyWidgetProperties : IWidgetProperties private const string Secret = "__your secret string__"; ``` -4. Configure the `Settings.OptInFeatures.QuerySourceInstanceApi` [configuration options](#configuration) for the Migration toolkit: +4. Configure the `Settings.OptInFeatures.QuerySourceInstanceApi` [configuration options](#configuration) for the Migration Tool: ```json "OptInFeatures":{ @@ -506,7 +506,7 @@ public class MyWidgetProperties : IWidgetProperties You can test the source instance API discovery by making a POST request to `/ToolkitApi/Test` with `{ "secret":"__your secret string__" }` in the body. If your setup is correct, the response should be: `{ "pong": true }` -When you now [Migrate data](#migrate-data), the toolkit performs API discovery of Page Builder component code on the source instance and advanced migration of Page Builder data. +When you now [migrate data](#migrate-data), the tool performs API discovery of Page Builder component code on the source instance and advanced migration of Page Builder data. ## Convert page types to reusable field schemas @@ -529,7 +529,7 @@ The following example specifies two page types from which reusable schemas are c ## Convert text fields with media links to media libraries -By default, page type and module class fields with the _Text_ data type and the _Media selection_ [form control](https://docs.xperience.io/x/0A_RBg) from the source instance are converted to plain _Text_ fields in the target instance. You can instead configure the Migration toolkit to convert these fields to the _Media files_ data type and use the _Media file selector_ form component. +By default, page type and module class fields with the _Text_ data type and the _Media selection_ [form control](https://docs.xperience.io/x/0A_RBg) from the source instance are converted to plain _Text_ fields in the target instance. You can instead configure the Kentico Migration Tool to convert these fields to the _Media files_ data type and use the _Media file selector_ form component. * Attachment links (containing a `getattachment` handler) are migrated as [attachments](#attachments) and changed to the _Media files_ data type. * Media file links (containing a `getmedia` handler) are changed to the _Media files_ data type. It is expected that the media library containing the targeted file has been migrated. @@ -539,7 +539,7 @@ By default, page type and module class fields with the _Text_ data type and the > * Only media libraries using the **Permanent** [file URL format](https://docs.xperience.io/x/xQ_RBg) are supported. Content from media libraries with enabled **Use direct path for files in content** setting will not be converted. > * If you enable this feature, you also need to change retrieval and handling of affected files in your code, as the structure of the stored data changes from a text path (e.g.,`~/getmedia/CCEAD0F0-E2BF-459B-814A-36699E5C773E/somefile.jpeg?width=300&height=100`) to a _Media files_ data type (internally stored as e.g., `[{"Identifier":"CCEAD0F0-E2BF-459B-814A-36699E5C773E","Some file":"somefile.jpeg","Size":11803,"Dimensions":{"Width":300,"Height":100}}]`). The value of the field now needs to be [retrieved as a media library file](https://docs.xperience.io/x/LA2RBg). -To enable this feature, configure the `OptInFeatures.CustomMigration.FieldMigrations` [options](#configuration) for the Migration toolkit. Use the values in the code snippet below: +To enable this feature, configure the `OptInFeatures.CustomMigration.FieldMigrations` [options](#configuration) for this tool. Use the values in the code snippet below: ```json "OptInFeatures":{ diff --git a/Migration.Toolkit.Common/Abstractions/Command.cs b/Migration.Toolkit.Common/Abstractions/Command.cs index a93624e4..eb2c8ff4 100644 --- a/Migration.Toolkit.Common/Abstractions/Command.cs +++ b/Migration.Toolkit.Common/Abstractions/Command.cs @@ -1,18 +1,18 @@ -namespace Migration.Toolkit.Common.Abstractions; - -using System.Reflection; - -public interface ICommand -{ - Type[] Dependencies { get; } - - int Rank => (int)(GetType().GetField("Rank", BindingFlags.Static | BindingFlags.Public)?.GetValue(null) ?? 999); - - static virtual string Moniker { get; } = ""; - static virtual string MonikerFriendly { get; } = ""; -} - -public interface ICultureReliantCommand -{ - string CultureCode { get; } +namespace Migration.Toolkit.Common.Abstractions; + +using System.Reflection; + +public interface ICommand +{ + Type[] Dependencies { get; } + + int Rank => (int)(GetType().GetField("Rank", BindingFlags.Static | BindingFlags.Public)?.GetValue(null) ?? 999); + + static virtual string Moniker { get; } = ""; + static virtual string MonikerFriendly { get; } = ""; +} + +public interface ICultureReliantCommand +{ + string CultureCode { get; } } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Abstractions/IEntityMapper.cs b/Migration.Toolkit.Common/Abstractions/IEntityMapper.cs index 57067b2c..535efd2a 100644 --- a/Migration.Toolkit.Common/Abstractions/IEntityMapper.cs +++ b/Migration.Toolkit.Common/Abstractions/IEntityMapper.cs @@ -1,13 +1,13 @@ -namespace Migration.Toolkit.Common.Abstractions; - -using Kentico.Xperience.UMT.Model; - -public interface IEntityMapper -{ - IModelMappingResult Map(TSourceEntity? source, TTargetEntity? target); -} - -public interface IUmtMapper -{ - IEnumerable Map(TSourceEntity source); +namespace Migration.Toolkit.Common.Abstractions; + +using Kentico.Xperience.UMT.Model; + +public interface IEntityMapper +{ + IModelMappingResult Map(TSourceEntity? source, TTargetEntity? target); +} + +public interface IUmtMapper +{ + IEnumerable Map(TSourceEntity source); } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Abstractions/IModuleLoader.cs b/Migration.Toolkit.Common/Abstractions/IModuleLoader.cs index 9a149cd5..8bc0abe6 100644 --- a/Migration.Toolkit.Common/Abstractions/IModuleLoader.cs +++ b/Migration.Toolkit.Common/Abstractions/IModuleLoader.cs @@ -1,6 +1,6 @@ -namespace Migration.Toolkit.Common.Abstractions; - -public interface IModuleLoader -{ - Task LoadAsync(); +namespace Migration.Toolkit.Common.Abstractions; + +public interface IModuleLoader +{ + Task LoadAsync(); } \ No newline at end of file diff --git a/Migration.Toolkit.Common/CommonDiExtensions.cs b/Migration.Toolkit.Common/CommonDiExtensions.cs index 650e3f9b..36380844 100644 --- a/Migration.Toolkit.Common/CommonDiExtensions.cs +++ b/Migration.Toolkit.Common/CommonDiExtensions.cs @@ -1,15 +1,15 @@ -namespace Migration.Toolkit.Common; - -using Microsoft.Extensions.DependencyInjection; -using Migration.Toolkit.Common.MigrationProtocol; - -public static class CommonDiExtensions -{ - public static IServiceCollection UseToolkitCommon(this IServiceCollection services) - { - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - return services; - } +namespace Migration.Toolkit.Common; + +using Microsoft.Extensions.DependencyInjection; +using Migration.Toolkit.Common.MigrationProtocol; + +public static class CommonDiExtensions +{ + public static IServiceCollection UseToolkitCommon(this IServiceCollection services) + { + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + return services; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Enumerations/KsFieldDataType.cs b/Migration.Toolkit.Common/Enumerations/KsFieldDataType.cs index f0deef9f..6d21ea65 100644 --- a/Migration.Toolkit.Common/Enumerations/KsFieldDataType.cs +++ b/Migration.Toolkit.Common/Enumerations/KsFieldDataType.cs @@ -1,50 +1,50 @@ -namespace Migration.Toolkit.Common.Enumerations; - -/// -/// field data types are same in major versions 11 / 12 / 13 -/// -public static partial class KsFieldDataType -{ - /// All datatypes. - public const string ALL = "all"; - /// Unknown data type - public const string Unknown = ""; - /// Text. - public const string Text = "text"; - /// Long text. - public const string LongText = "longtext"; - /// Integer. - public const string Integer = "integer"; - /// Long integer. - public const string LongInteger = "longinteger"; - /// Double. - public const string Double = "double"; - /// Date and time. - public const string DateTime = "datetime"; - /// Boolean. - public const string Boolean = "boolean"; - /// File. - public const string File = "file"; - /// Document attachments. - public const string DocAttachments = "docattachments"; - /// GUID. - public const string Guid = "guid"; - /// Binary. - public const string Binary = "binary"; - /// XML - public const string Xml = "xml"; - /// Decimal - public const string Decimal = "decimal"; - /// Time span - public const string TimeSpan = "timespan"; - /// Date - public const string Date = "date"; - /// Document relationships - public const string DocRelationships = "docrelationships"; -} - -// manual updates, non-obvious types, exotic types -public static partial class KsFieldDataType -{ - public const string BizFormFile = "bizformfile"; +namespace Migration.Toolkit.Common.Enumerations; + +/// +/// field data types are same in major versions 11 / 12 / 13 +/// +public static partial class KsFieldDataType +{ + /// All datatypes. + public const string ALL = "all"; + /// Unknown data type + public const string Unknown = ""; + /// Text. + public const string Text = "text"; + /// Long text. + public const string LongText = "longtext"; + /// Integer. + public const string Integer = "integer"; + /// Long integer. + public const string LongInteger = "longinteger"; + /// Double. + public const string Double = "double"; + /// Date and time. + public const string DateTime = "datetime"; + /// Boolean. + public const string Boolean = "boolean"; + /// File. + public const string File = "file"; + /// Document attachments. + public const string DocAttachments = "docattachments"; + /// GUID. + public const string Guid = "guid"; + /// Binary. + public const string Binary = "binary"; + /// XML + public const string Xml = "xml"; + /// Decimal + public const string Decimal = "decimal"; + /// Time span + public const string TimeSpan = "timespan"; + /// Date + public const string Date = "date"; + /// Document relationships + public const string DocRelationships = "docrelationships"; +} + +// manual updates, non-obvious types, exotic types +public static partial class KsFieldDataType +{ + public const string BizFormFile = "bizformfile"; } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Enumerations/Kx13FormControls.cs b/Migration.Toolkit.Common/Enumerations/Kx13FormControls.cs index 5b0ef8c2..8704b9b2 100644 --- a/Migration.Toolkit.Common/Enumerations/Kx13FormControls.cs +++ b/Migration.Toolkit.Common/Enumerations/Kx13FormControls.cs @@ -1,265 +1,265 @@ -// ReSharper disable InconsistentNaming -namespace Migration.Toolkit.Common.Enumerations; - -public class Kx13FormControls -{ - public class UserControlForText - { - public const string AbTestConversionTypeSelector = "ABTestConversionTypeSelector"; - public const string ActivityTypeSelector = "ActivityTypeSelector"; - public const string AllowedExtensionsSelector = "AllowedExtensionsSelector"; - public const string Selectalternativeform = "selectalternativeform"; - public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; - public const string AssemblyClassSelector = "AssemblyClassSelector"; - public const string Fieldselector = "fieldselector"; - public const string BizFormSelector = "BizFormSelector"; - public const string BundleInventoryTypeSelector = "BundleInventoryTypeSelector"; - public const string CampaignSelector = "CampaignSelector"; - public const string CategorySelector = "CategorySelector"; - public const string ClassFieldSelector = "ClassFieldSelector"; - public const string ClassFields = "Class_fields"; - public const string CodeName = "CodeName"; - public const string CodeNameWithPrefix = "CodeNameWithPrefix"; - public const string Selectcolor = "selectcolor"; - public const string Columns = "Columns"; - public const string ConnectionStringSelector = "Connection_string_selector"; - public const string ContactClassFields = "Contact_class_fields"; - public const string CountrySelector = "countrySelector"; - public const string CssStylesEditor = "CSS_Styles_Editor"; - public const string Selectculture = "selectculture"; - public const string CultureSelectorForSettings = "CultureSelectorForSettings"; - public const string CurrencySelector = "currencySelector"; - public const string CustomTableItemSelector = "CustomTableItemSelector"; - public const string CustomTableSelector = "CustomTableSelector"; - public const string Selectcolumns = "selectcolumns"; - public const string DepartmentSelector = "DepartmentSelector"; - public const string DropDownListControl = "DropDownListControl"; - public const string DueDateSelector = "Due_date_selector"; - public const string Emailinput = "emailinput"; - public const string EmailTemplateSelector = "Email_template_selector"; - public const string EmailTemplateTypeSelector = "Email_template_type_selector"; - public const string EncodingTextBox = "EncodingTextBox"; - public const string EncryptedPassword = "EncryptedPassword"; - public const string EnumSelector = "EnumSelector"; - public const string EventLogTypeSelector = "EventLogTypeSelector"; - public const string FacebookAutoPost = "Facebook_auto_post"; - public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; - public const string FileSystemSelector = "FileSystemSelector"; - public const string FontIconSelector = "FontIconSelector"; - public const string FormFieldSelector = "FormFieldSelector"; - public const string FormPassword = "FormPassword"; - public const string FullMediaLibrarySelector = "FullMediaLibrarySelector"; - public const string GetGoogleTranslatorApiKey = "Get_Google_Translator_API_key"; - public const string GetMsTranslatorTextApiKey = "GetMSTranslatorTextAPIKey"; - public const string GoToExternalUrl = "Go_to_external_URL"; - public const string GoogleAnalyticsParameterSelector = "Google_Analytics_parameter_selector"; - public const string Html5Input = "HTML5Input"; - public const string IconSelector = "IconSelector"; - public const string InternalStatusSelector = "InternalStatusSelector"; - public const string Internationalphone = "internationalphone"; - public const string LabelControl = "LabelControl"; - public const string LargeTextArea = "LargeTextArea"; - public const string LicenseSelector = "LicenseSelector"; - public const string LinkedInAutoPost = "LinkedInAutoPost"; - public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; - public const string ListBoxControl = "ListBoxControl"; - public const string LocalizableTextArea = "LocalizableTextArea"; - public const string LocalizableTextBox = "LocalizableTextBox"; - public const string MacroAnyAllBoolSelector = "Macro_any-all_bool_selector"; - public const string MacroAnyAllSelector = "MacroAnyAllSelector"; - public const string MacroDateOperator = "Macro_date_operator"; - public const string MacroEditor = "MacroEditor"; - public const string MacroEqualityOperator = "MacroEqualityOperator"; - public const string MacroNegationOperator = "MacroNegationOperator"; - public const string MacroNumericOperator = "Macro_numeric_operator"; - public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; - public const string MacroTextOperator = "Macro_text_operator"; - public const string MacroType = "MacroType"; - public const string ManufacturerSelector = "ManufacturerSelector"; - public const string MediaLibrarySelector = "MediaLibrarySelector"; - public const string MediaSelectionControl = "MediaSelectionControl"; - public const string MembershipSelector = "MembershipSelector"; - public const string MetafileUploaderControl = "MetafileUploaderControl"; - public const string ModuleSelector = "ModuleSelector"; - public const string MultipleCategoriesSelector = "MultipleCategoriesSelector"; - public const string MultipleChoiceControl = "MultipleChoiceControl"; - public const string RoleCheckboxSelector = "RoleCheckboxSelector"; - public const string SimpleCheckboxRoleSelector = "SimpleCheckboxRoleSelector"; - public const string SimpleCheckboxSiteSelector = "SimpleCheckboxSiteSelector"; - public const string MultipleUserSelector = "MultipleUserSelector"; - public const string NewsletterSelector = "NewsletterSelector"; - public const string NewsletterSelectorSimple = "NewsletterSelectorSimple"; - public const string NumericUpDown = "NumericUpDown"; - public const string ObjectColumnSelector = "ObjectColumnSelector"; - public const string ObjectSelector = "ObjectSelector"; - public const string ObjectTransformation = "ObjectTransformation"; - public const string ObjectTypeBinSelector = "ObjectTypeBinSelector"; - public const string ObjectTypeSelector = "ObjectTypeSelector"; - public const string OptionCategoryProductOptionSelector = "OptionCategoryProductOptionSelector"; - public const string OptionCategorySelectionTypeSelector = "OptionCategorySelectionTypeSelector"; - public const string OrderBy = "OrderBy"; - public const string OrderStatusSelector = "OrderStatusSelector"; - public const string DocumentCultureFilter = "DocumentCultureFilter"; - public const string PageLayoutCode = "Page_layout_code"; - public const string Selectdocument = "selectdocument"; - public const string PageTemplateLevels = "PageTemplateLevels"; - public const string Selectpagetemplate = "selectpagetemplate"; - public const string DocumentTypeIconSelector = "DocumentTypeIconSelector"; - public const string Selectclassnames = "selectclassnames"; - public const string Password = "Password"; - public const string PasswordStrength = "PasswordStrength"; - public const string PasswordConfirmator = "PasswordConfirmator"; - public const string Selectpath = "selectpath"; - public const string PaymentSelector = "paymentSelector"; - public const string ProductImageSelector = "ProductImageSelector"; - public const string ProductRelationshipNameSelector = "ProductRelationshipNameSelector"; - public const string ProductSectionsSelector = "ProductSectionsSelector"; - public const string ProductTypeSelector = "ProductTypeSelector"; - public const string PublicStatusSelector = "PublicStatusSelector"; - public const string Selectquery = "selectquery"; - public const string RadioButtonsControl = "RadioButtonsControl"; - public const string AgeRangeSelector = "AgeRangeSelector"; - public const string RelatedDocuments = "RelatedDocuments"; - public const string Relationshipconfiguration = "relationshipconfiguration"; - public const string SelectRelationshipName = "SelectRelationshipName"; - public const string ReportSelectorDropDown = "ReportSelectorDropDown"; - public const string RoleSelector = "RoleSelector"; - public const string SearchClassNameSelector = "SearchClassNameSelector"; - public const string SearchIndexSelector = "SearchIndexSelector"; - public const string SearchIndexTypeSelector = "SearchIndexTypeSelector"; - public const string SelectCmsVersion = "SelectCMSVersion"; - public const string SettingsKeyControlSelector = "SettingsKeyControlSelector"; - public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; - public const string SharePointListSelector = "SharePointListSelector"; - public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; - public const string ShippingSelector = "shippingSelector"; - public const string ShippingServiceSelector = "ShippingServiceSelector"; - public const string Selectsinglepath = "selectsinglepath"; - public const string SinglePathSelectorWithPermissions = "SinglePathSelectorWithPermissions"; - public const string SiteContentCulture = "SiteContentCulture"; - public const string SiteCultureSelector = "SiteCultureSelector"; - public const string SiteCultureSelectorAll = "SiteCultureSelectorAll"; - public const string Selectsite = "selectsite"; - public const string SiteSelectorWithAllFieldForGlobalAdmin = "SiteSelectorWithAllFieldForGlobalAdmin"; - public const string SkuSelector = "SKUSelector"; - public const string StopWordsSelector = "StopWordsSelector"; - public const string SupplierSelector = "SupplierSelector"; - public const string SupportedCultureSelector = "SupportedCultureSelector"; - public const string TableConversionSettings = "TableConversionSettings"; - public const string TagGroupSelector = "TagGroupSelector"; - public const string TagSelector = "TagSelector"; - public const string TaxAddressTypeSelector = "TaxAddressTypeSelector"; - public const string TextAreaControl = "TextAreaControl"; - public const string TextBoxControl = "TextBoxControl"; - public const string TextFilter = "TextFilter"; - public const string TextboxDefaultValueFromSetting = "Textbox_default_value_from_setting"; - public const string TextboxDoubleValidator = "Textbox_double_validator"; - public const string TimeZoneSelector = "TimeZoneSelector"; - public const string TimeZoneTypeSelector = "TimeZoneTypeSelector"; - public const string ToggleButton = "ToggleButton"; - public const string Selecttransformation = "selecttransformation"; - public const string TranslationServiceSelector = "Translation_service_selector"; - public const string TwitterAutoPost = "Twitter_auto_post"; - public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; - public const string Usphone = "usphone"; - public const string Uszipcode = "uszipcode"; - public const string UiCultureSelector = "UICultureSelector"; - public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; - public const string UniSelector = "Uni_selector"; - public const string UrlChecker = "UrlChecker"; - public const string UrlSelector = "URLSelector"; - public const string SmurlShortenerSelector = "SMURLShortenerSelector"; - public const string UserName = "UserName"; - public const string UserNameSelector = "UserNameSelector"; - public const string UserSelector = "UserSelector"; - public const string ValiditySelector = "ValiditySelector"; - public const string ViewSecureText = "ViewSecureText"; - public const string WhereCondition = "WhereCondition"; - public const string WorkflowScopeDefinition = "WorkflowScopeDefinition"; - } - - public class UserControlForLongText - { - public const string AbTestConversionSelector = "ABTestConversionSelector"; - public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; - public const string BbEditorControl = "BBEditorControl"; - public const string CacheDependencies = "CacheDependencies"; - public const string ClassFields = "Class_fields"; - public const string Columns = "Columns"; - public const string ConditionBuilder = "ConditionBuilder"; - public const string ContactClassFields = "Contact_class_fields"; - public const string CssStylesEditor = "CSS_Styles_Editor"; - public const string Selectcolumns = "selectcolumns"; - public const string DropDownListControl = "DropDownListControl"; - public const string FacebookAutoPost = "Facebook_auto_post"; - public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; - public const string FileSystemSelector = "FileSystemSelector"; - public const string Html5Input = "HTML5Input"; - public const string AutoResizeConfiguration = "AutoResizeConfiguration"; - public const string LabelControl = "LabelControl"; - public const string LargeTextArea = "LargeTextArea"; - public const string LinkedInAutoPost = "LinkedInAutoPost"; - public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; - public const string LocalizableTextArea = "LocalizableTextArea"; - public const string LocalizableTextBox = "LocalizableTextBox"; - public const string MacroEditor = "MacroEditor"; - public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; - public const string MultipleObjectBindingControl = "MultipleObjectBindingControl"; - public const string ObjectTypeSelector = "ObjectTypeSelector"; - public const string OptionsSelector = "OptionsSelector"; - public const string OrderBy = "OrderBy"; - public const string PageLayoutCode = "Page_layout_code"; - public const string ProductSectionsSelector = "ProductSectionsSelector"; - public const string RelatedDocuments = "RelatedDocuments"; - public const string ReportGraphSelector = "ReportGraphSelector"; - public const string ReportTableSelector = "ReportTableSelector"; - public const string ReportValueSelector = "ReportValueSelector"; - public const string HtmlAreaControl = "HtmlAreaControl"; - public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; - public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; - public const string TagSelector = "TagSelector"; - public const string TextAreaControl = "TextAreaControl"; - public const string TextBoxControl = "TextBoxControl"; - public const string TextFilter = "TextFilter"; - public const string TranslationServiceSelector = "Translation_service_selector"; - public const string TwitterAutoPost = "Twitter_auto_post"; - public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; - public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; - public const string UniSelector = "Uni_selector"; - public const string SmurlShortenerSelector = "SMURLShortenerSelector"; - public const string ViewSecureText = "ViewSecureText"; - public const string WhereCondition = "WhereCondition"; - } -} - -public class Kx13FormComponents -{ - public const string Kentico_BoolFieldValueTypeSelector = "Kentico.BoolFieldValueTypeSelector"; - public const string Kentico_CheckBox = "Kentico.CheckBox"; - public const string Kentico_CompareToFieldSelector = "Kentico.CompareToFieldSelector"; - public const string Kentico_ConsentAgreement = "Kentico.ConsentAgreement"; - public const string Kentico_ConsentSelector = "Kentico.ConsentSelector"; - public const string Kentico_DropDown = "Kentico.DropDown"; - public const string Kentico_EmailInput = "Kentico.EmailInput"; - public const string Kentico_FileUploader = "Kentico.FileUploader"; - public const string Kentico_HiddenGuidInput = "Kentico.HiddenGuidInput"; - public const string Kentico_IntInput = "Kentico.IntInput"; - public const string Kentico_MultipleChoice = "Kentico.MultipleChoice"; - public const string Kentico_Name = "Kentico.Name"; - public const string Kentico_NumericFieldComparisonTypeSelector = "Kentico.NumericFieldComparisonTypeSelector"; - public const string Kentico_RadioButtons = "Kentico.RadioButtons"; - public const string Kentico_Recaptcha = "Kentico.Recaptcha"; - public const string Kentico_StringFieldComparisonTypeSelector = "Kentico.StringFieldComparisonTypeSelector"; - public const string Kentico_TextArea = "Kentico.TextArea"; - public const string Kentico_TextInput = "Kentico.TextInput"; - public const string Kentico_USPhone = "Kentico.USPhone"; - public const string Kentico_Invalid = "Kentico.Invalid"; - public const string Kentico_RichText = "Kentico.RichText"; - public const string Kentico_AttachmentSelector = "Kentico.AttachmentSelector"; - public const string Kentico_MediaFilesSelector = "Kentico.MediaFilesSelector"; - public const string Kentico_GeneralSelector = "Kentico.GeneralSelector"; - public const string Kentico_ObjectSelector = "Kentico.ObjectSelector"; - public const string Kentico_PageSelector = "Kentico.PageSelector"; - public const string Kentico_PathSelector = "Kentico.PathSelector"; - public const string Kentico_UrlSelector = "Kentico.UrlSelector"; +// ReSharper disable InconsistentNaming +namespace Migration.Toolkit.Common.Enumerations; + +public class Kx13FormControls +{ + public class UserControlForText + { + public const string AbTestConversionTypeSelector = "ABTestConversionTypeSelector"; + public const string ActivityTypeSelector = "ActivityTypeSelector"; + public const string AllowedExtensionsSelector = "AllowedExtensionsSelector"; + public const string Selectalternativeform = "selectalternativeform"; + public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; + public const string AssemblyClassSelector = "AssemblyClassSelector"; + public const string Fieldselector = "fieldselector"; + public const string BizFormSelector = "BizFormSelector"; + public const string BundleInventoryTypeSelector = "BundleInventoryTypeSelector"; + public const string CampaignSelector = "CampaignSelector"; + public const string CategorySelector = "CategorySelector"; + public const string ClassFieldSelector = "ClassFieldSelector"; + public const string ClassFields = "Class_fields"; + public const string CodeName = "CodeName"; + public const string CodeNameWithPrefix = "CodeNameWithPrefix"; + public const string Selectcolor = "selectcolor"; + public const string Columns = "Columns"; + public const string ConnectionStringSelector = "Connection_string_selector"; + public const string ContactClassFields = "Contact_class_fields"; + public const string CountrySelector = "countrySelector"; + public const string CssStylesEditor = "CSS_Styles_Editor"; + public const string Selectculture = "selectculture"; + public const string CultureSelectorForSettings = "CultureSelectorForSettings"; + public const string CurrencySelector = "currencySelector"; + public const string CustomTableItemSelector = "CustomTableItemSelector"; + public const string CustomTableSelector = "CustomTableSelector"; + public const string Selectcolumns = "selectcolumns"; + public const string DepartmentSelector = "DepartmentSelector"; + public const string DropDownListControl = "DropDownListControl"; + public const string DueDateSelector = "Due_date_selector"; + public const string Emailinput = "emailinput"; + public const string EmailTemplateSelector = "Email_template_selector"; + public const string EmailTemplateTypeSelector = "Email_template_type_selector"; + public const string EncodingTextBox = "EncodingTextBox"; + public const string EncryptedPassword = "EncryptedPassword"; + public const string EnumSelector = "EnumSelector"; + public const string EventLogTypeSelector = "EventLogTypeSelector"; + public const string FacebookAutoPost = "Facebook_auto_post"; + public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; + public const string FileSystemSelector = "FileSystemSelector"; + public const string FontIconSelector = "FontIconSelector"; + public const string FormFieldSelector = "FormFieldSelector"; + public const string FormPassword = "FormPassword"; + public const string FullMediaLibrarySelector = "FullMediaLibrarySelector"; + public const string GetGoogleTranslatorApiKey = "Get_Google_Translator_API_key"; + public const string GetMsTranslatorTextApiKey = "GetMSTranslatorTextAPIKey"; + public const string GoToExternalUrl = "Go_to_external_URL"; + public const string GoogleAnalyticsParameterSelector = "Google_Analytics_parameter_selector"; + public const string Html5Input = "HTML5Input"; + public const string IconSelector = "IconSelector"; + public const string InternalStatusSelector = "InternalStatusSelector"; + public const string Internationalphone = "internationalphone"; + public const string LabelControl = "LabelControl"; + public const string LargeTextArea = "LargeTextArea"; + public const string LicenseSelector = "LicenseSelector"; + public const string LinkedInAutoPost = "LinkedInAutoPost"; + public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; + public const string ListBoxControl = "ListBoxControl"; + public const string LocalizableTextArea = "LocalizableTextArea"; + public const string LocalizableTextBox = "LocalizableTextBox"; + public const string MacroAnyAllBoolSelector = "Macro_any-all_bool_selector"; + public const string MacroAnyAllSelector = "MacroAnyAllSelector"; + public const string MacroDateOperator = "Macro_date_operator"; + public const string MacroEditor = "MacroEditor"; + public const string MacroEqualityOperator = "MacroEqualityOperator"; + public const string MacroNegationOperator = "MacroNegationOperator"; + public const string MacroNumericOperator = "Macro_numeric_operator"; + public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; + public const string MacroTextOperator = "Macro_text_operator"; + public const string MacroType = "MacroType"; + public const string ManufacturerSelector = "ManufacturerSelector"; + public const string MediaLibrarySelector = "MediaLibrarySelector"; + public const string MediaSelectionControl = "MediaSelectionControl"; + public const string MembershipSelector = "MembershipSelector"; + public const string MetafileUploaderControl = "MetafileUploaderControl"; + public const string ModuleSelector = "ModuleSelector"; + public const string MultipleCategoriesSelector = "MultipleCategoriesSelector"; + public const string MultipleChoiceControl = "MultipleChoiceControl"; + public const string RoleCheckboxSelector = "RoleCheckboxSelector"; + public const string SimpleCheckboxRoleSelector = "SimpleCheckboxRoleSelector"; + public const string SimpleCheckboxSiteSelector = "SimpleCheckboxSiteSelector"; + public const string MultipleUserSelector = "MultipleUserSelector"; + public const string NewsletterSelector = "NewsletterSelector"; + public const string NewsletterSelectorSimple = "NewsletterSelectorSimple"; + public const string NumericUpDown = "NumericUpDown"; + public const string ObjectColumnSelector = "ObjectColumnSelector"; + public const string ObjectSelector = "ObjectSelector"; + public const string ObjectTransformation = "ObjectTransformation"; + public const string ObjectTypeBinSelector = "ObjectTypeBinSelector"; + public const string ObjectTypeSelector = "ObjectTypeSelector"; + public const string OptionCategoryProductOptionSelector = "OptionCategoryProductOptionSelector"; + public const string OptionCategorySelectionTypeSelector = "OptionCategorySelectionTypeSelector"; + public const string OrderBy = "OrderBy"; + public const string OrderStatusSelector = "OrderStatusSelector"; + public const string DocumentCultureFilter = "DocumentCultureFilter"; + public const string PageLayoutCode = "Page_layout_code"; + public const string Selectdocument = "selectdocument"; + public const string PageTemplateLevels = "PageTemplateLevels"; + public const string Selectpagetemplate = "selectpagetemplate"; + public const string DocumentTypeIconSelector = "DocumentTypeIconSelector"; + public const string Selectclassnames = "selectclassnames"; + public const string Password = "Password"; + public const string PasswordStrength = "PasswordStrength"; + public const string PasswordConfirmator = "PasswordConfirmator"; + public const string Selectpath = "selectpath"; + public const string PaymentSelector = "paymentSelector"; + public const string ProductImageSelector = "ProductImageSelector"; + public const string ProductRelationshipNameSelector = "ProductRelationshipNameSelector"; + public const string ProductSectionsSelector = "ProductSectionsSelector"; + public const string ProductTypeSelector = "ProductTypeSelector"; + public const string PublicStatusSelector = "PublicStatusSelector"; + public const string Selectquery = "selectquery"; + public const string RadioButtonsControl = "RadioButtonsControl"; + public const string AgeRangeSelector = "AgeRangeSelector"; + public const string RelatedDocuments = "RelatedDocuments"; + public const string Relationshipconfiguration = "relationshipconfiguration"; + public const string SelectRelationshipName = "SelectRelationshipName"; + public const string ReportSelectorDropDown = "ReportSelectorDropDown"; + public const string RoleSelector = "RoleSelector"; + public const string SearchClassNameSelector = "SearchClassNameSelector"; + public const string SearchIndexSelector = "SearchIndexSelector"; + public const string SearchIndexTypeSelector = "SearchIndexTypeSelector"; + public const string SelectCmsVersion = "SelectCMSVersion"; + public const string SettingsKeyControlSelector = "SettingsKeyControlSelector"; + public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; + public const string SharePointListSelector = "SharePointListSelector"; + public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; + public const string ShippingSelector = "shippingSelector"; + public const string ShippingServiceSelector = "ShippingServiceSelector"; + public const string Selectsinglepath = "selectsinglepath"; + public const string SinglePathSelectorWithPermissions = "SinglePathSelectorWithPermissions"; + public const string SiteContentCulture = "SiteContentCulture"; + public const string SiteCultureSelector = "SiteCultureSelector"; + public const string SiteCultureSelectorAll = "SiteCultureSelectorAll"; + public const string Selectsite = "selectsite"; + public const string SiteSelectorWithAllFieldForGlobalAdmin = "SiteSelectorWithAllFieldForGlobalAdmin"; + public const string SkuSelector = "SKUSelector"; + public const string StopWordsSelector = "StopWordsSelector"; + public const string SupplierSelector = "SupplierSelector"; + public const string SupportedCultureSelector = "SupportedCultureSelector"; + public const string TableConversionSettings = "TableConversionSettings"; + public const string TagGroupSelector = "TagGroupSelector"; + public const string TagSelector = "TagSelector"; + public const string TaxAddressTypeSelector = "TaxAddressTypeSelector"; + public const string TextAreaControl = "TextAreaControl"; + public const string TextBoxControl = "TextBoxControl"; + public const string TextFilter = "TextFilter"; + public const string TextboxDefaultValueFromSetting = "Textbox_default_value_from_setting"; + public const string TextboxDoubleValidator = "Textbox_double_validator"; + public const string TimeZoneSelector = "TimeZoneSelector"; + public const string TimeZoneTypeSelector = "TimeZoneTypeSelector"; + public const string ToggleButton = "ToggleButton"; + public const string Selecttransformation = "selecttransformation"; + public const string TranslationServiceSelector = "Translation_service_selector"; + public const string TwitterAutoPost = "Twitter_auto_post"; + public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; + public const string Usphone = "usphone"; + public const string Uszipcode = "uszipcode"; + public const string UiCultureSelector = "UICultureSelector"; + public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; + public const string UniSelector = "Uni_selector"; + public const string UrlChecker = "UrlChecker"; + public const string UrlSelector = "URLSelector"; + public const string SmurlShortenerSelector = "SMURLShortenerSelector"; + public const string UserName = "UserName"; + public const string UserNameSelector = "UserNameSelector"; + public const string UserSelector = "UserSelector"; + public const string ValiditySelector = "ValiditySelector"; + public const string ViewSecureText = "ViewSecureText"; + public const string WhereCondition = "WhereCondition"; + public const string WorkflowScopeDefinition = "WorkflowScopeDefinition"; + } + + public class UserControlForLongText + { + public const string AbTestConversionSelector = "ABTestConversionSelector"; + public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; + public const string BbEditorControl = "BBEditorControl"; + public const string CacheDependencies = "CacheDependencies"; + public const string ClassFields = "Class_fields"; + public const string Columns = "Columns"; + public const string ConditionBuilder = "ConditionBuilder"; + public const string ContactClassFields = "Contact_class_fields"; + public const string CssStylesEditor = "CSS_Styles_Editor"; + public const string Selectcolumns = "selectcolumns"; + public const string DropDownListControl = "DropDownListControl"; + public const string FacebookAutoPost = "Facebook_auto_post"; + public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; + public const string FileSystemSelector = "FileSystemSelector"; + public const string Html5Input = "HTML5Input"; + public const string AutoResizeConfiguration = "AutoResizeConfiguration"; + public const string LabelControl = "LabelControl"; + public const string LargeTextArea = "LargeTextArea"; + public const string LinkedInAutoPost = "LinkedInAutoPost"; + public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; + public const string LocalizableTextArea = "LocalizableTextArea"; + public const string LocalizableTextBox = "LocalizableTextBox"; + public const string MacroEditor = "MacroEditor"; + public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; + public const string MultipleObjectBindingControl = "MultipleObjectBindingControl"; + public const string ObjectTypeSelector = "ObjectTypeSelector"; + public const string OptionsSelector = "OptionsSelector"; + public const string OrderBy = "OrderBy"; + public const string PageLayoutCode = "Page_layout_code"; + public const string ProductSectionsSelector = "ProductSectionsSelector"; + public const string RelatedDocuments = "RelatedDocuments"; + public const string ReportGraphSelector = "ReportGraphSelector"; + public const string ReportTableSelector = "ReportTableSelector"; + public const string ReportValueSelector = "ReportValueSelector"; + public const string HtmlAreaControl = "HtmlAreaControl"; + public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; + public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; + public const string TagSelector = "TagSelector"; + public const string TextAreaControl = "TextAreaControl"; + public const string TextBoxControl = "TextBoxControl"; + public const string TextFilter = "TextFilter"; + public const string TranslationServiceSelector = "Translation_service_selector"; + public const string TwitterAutoPost = "Twitter_auto_post"; + public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; + public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; + public const string UniSelector = "Uni_selector"; + public const string SmurlShortenerSelector = "SMURLShortenerSelector"; + public const string ViewSecureText = "ViewSecureText"; + public const string WhereCondition = "WhereCondition"; + } +} + +public class Kx13FormComponents +{ + public const string Kentico_BoolFieldValueTypeSelector = "Kentico.BoolFieldValueTypeSelector"; + public const string Kentico_CheckBox = "Kentico.CheckBox"; + public const string Kentico_CompareToFieldSelector = "Kentico.CompareToFieldSelector"; + public const string Kentico_ConsentAgreement = "Kentico.ConsentAgreement"; + public const string Kentico_ConsentSelector = "Kentico.ConsentSelector"; + public const string Kentico_DropDown = "Kentico.DropDown"; + public const string Kentico_EmailInput = "Kentico.EmailInput"; + public const string Kentico_FileUploader = "Kentico.FileUploader"; + public const string Kentico_HiddenGuidInput = "Kentico.HiddenGuidInput"; + public const string Kentico_IntInput = "Kentico.IntInput"; + public const string Kentico_MultipleChoice = "Kentico.MultipleChoice"; + public const string Kentico_Name = "Kentico.Name"; + public const string Kentico_NumericFieldComparisonTypeSelector = "Kentico.NumericFieldComparisonTypeSelector"; + public const string Kentico_RadioButtons = "Kentico.RadioButtons"; + public const string Kentico_Recaptcha = "Kentico.Recaptcha"; + public const string Kentico_StringFieldComparisonTypeSelector = "Kentico.StringFieldComparisonTypeSelector"; + public const string Kentico_TextArea = "Kentico.TextArea"; + public const string Kentico_TextInput = "Kentico.TextInput"; + public const string Kentico_USPhone = "Kentico.USPhone"; + public const string Kentico_Invalid = "Kentico.Invalid"; + public const string Kentico_RichText = "Kentico.RichText"; + public const string Kentico_AttachmentSelector = "Kentico.AttachmentSelector"; + public const string Kentico_MediaFilesSelector = "Kentico.MediaFilesSelector"; + public const string Kentico_GeneralSelector = "Kentico.GeneralSelector"; + public const string Kentico_ObjectSelector = "Kentico.ObjectSelector"; + public const string Kentico_PageSelector = "Kentico.PageSelector"; + public const string Kentico_PathSelector = "Kentico.PathSelector"; + public const string Kentico_UrlSelector = "Kentico.UrlSelector"; } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Enumerations/Kx13SystemClasses.cs b/Migration.Toolkit.Common/Enumerations/Kx13SystemClasses.cs index bd679a1e..18a147fa 100644 --- a/Migration.Toolkit.Common/Enumerations/Kx13SystemClasses.cs +++ b/Migration.Toolkit.Common/Enumerations/Kx13SystemClasses.cs @@ -1,178 +1,178 @@ -// ReSharper disable InconsistentNaming - -namespace Migration.Toolkit.Common.Enumerations; - -public static class Kx13SystemClass -{ - public const string cms_culture = "cms.culture"; - public const string cms_site = "cms.site"; - public const string cms_Role = "cms.Role"; - public const string cms_user = "cms.user"; - public const string cms_UserRole = "cms.UserRole"; - public const string cms_emailtemplate = "cms.emailtemplate"; - public const string cms_permission = "cms.permission"; - public const string cms_resource = "cms.resource"; - public const string CMS_EventLog = "CMS.EventLog"; - public const string cms_tree = "cms.tree"; - public const string cms_document = "cms.document"; - public const string cms_class = "cms.class"; - public const string cms_pagetemplate = "cms.pagetemplate"; - public const string cms_query = "cms.query"; - public const string cms_transformation = "cms.transformation"; - public const string cms_workflow = "cms.workflow"; - public const string cms_workflowstep = "cms.workflowstep"; - public const string cms_workflowscope = "cms.workflowscope"; - public const string cms_versionhistory = "cms.versionhistory"; - public const string cms_acl = "cms.acl"; - public const string cms_pagetemplatecategory = "cms.pagetemplatecategory"; - public const string cms_layout = "cms.layout"; - public const string cms_webpartcategory = "cms.webpartcategory"; - public const string cms_webpart = "cms.webpart"; - public const string cms_attachment = "cms.attachment"; - public const string cms_attachmenthistory = "cms.attachmenthistory"; - public const string cms_relationshipname = "cms.relationshipname"; - public const string CMS_RelationshipNameSite = "CMS.RelationshipNameSite"; - public const string CMS_Relationship = "CMS.Relationship"; - public const string cms_sitedomainalias = "cms.sitedomainalias"; - public const string cms_form = "cms.form"; - public const string newsletter_emailtemplate = "newsletter.emailtemplate"; - public const string newsletter_subscriber = "newsletter.subscriber"; - public const string Newsletter_SubscriberNewsletter = "Newsletter.SubscriberNewsletter"; - public const string newsletter_newsletter = "newsletter.newsletter"; - public const string cms_WebPartContainer = "cms.WebPartContainer"; - public const string cms_LicenseKey = "cms.LicenseKey"; - public const string cms_WebFarmServer = "cms.WebFarmServer"; - public const string cms_country = "cms.country"; - public const string cms_state = "cms.state"; - public const string staging_synchronization = "staging.synchronization"; - public const string staging_server = "staging.server"; - public const string Reporting_Report = "Reporting.Report"; - public const string analytics_statistics = "analytics.statistics"; - public const string analytics_hitsweek = "analytics.hitsweek"; - public const string Reporting_ReportCategory = "Reporting.ReportCategory"; - public const string cms_WebPartLayout = "cms.WebPartLayout"; - public const string CMS_SettingsKey = "CMS.SettingsKey"; - public const string export_history = "export.history"; - public const string CMS_ResourceSite = "CMS.ResourceSite"; - public const string CMS_CultureSite = "CMS.CultureSite"; - public const string CMS_UserSite = "CMS.UserSite"; - public const string CMS_WorkflowStepRole = "CMS.WorkflowStepRole"; - public const string CMS_ClassSite = "CMS.ClassSite"; - public const string cms_FormRole = "cms.FormRole"; - public const string CMS_AllowedChildClass = "CMS.AllowedChildClass"; - public const string cms_rolepermission = "cms.rolepermission"; - public const string cms_settingscategory = "cms.settingscategory"; - public const string CMS_VersionAttachment = "CMS.VersionAttachment"; - public const string CMS_WebPartContainerSite = "CMS.WebPartContainerSite"; - public const string cms_category = "cms.category"; - public const string cms_documentcategory = "cms.documentcategory"; - public const string cms_AlternativeForm = "cms.AlternativeForm"; - public const string cms_timezone = "cms.timezone"; - public const string cms_avatar = "cms.avatar"; - public const string cms_usersettings = "cms.usersettings"; - public const string cms_email = "cms.email"; - public const string cms_attachmentforemail = "cms.attachmentforemail"; - public const string CMS_EmailUser = "CMS.EmailUser"; - public const string media_library = "media.library"; - public const string media_file = "media.file"; - public const string media_libraryrolepermission = "media.libraryrolepermission"; - public const string cms_SearchIndex = "cms.SearchIndex"; - public const string cms_SearchIndexSite = "cms.SearchIndexSite"; - public const string cms_SearchIndexCulture = "cms.SearchIndexCulture"; - public const string CMS_SearchTask = "CMS.SearchTask"; - public const string cms_userculture = "cms.userculture"; - public const string CMS_UIElement = "CMS.UIElement"; - public const string CMS_RoleUIElement = "CMS.RoleUIElement"; - public const string cms_Widget = "cms.Widget"; - public const string CMS_WidgetCategory = "CMS.WidgetCategory"; - public const string CMS_WidgetRole = "CMS.WidgetRole"; - public const string newsletter_openedemail = "newsletter.openedemail"; - public const string OM_ABTest = "OM.ABTest"; - public const string CMS_Membership = "CMS.Membership"; - public const string CMS_SMTPServer = "CMS.SMTPServer"; - public const string CMS_SMTPServerSite = "CMS.SMTPServerSite"; - public const string CMS_MembershipRole = "CMS.MembershipRole"; - public const string CMS_MembershipUser = "CMS.MembershipUser"; - public const string OM_Account = "OM.Account"; - public const string OM_AccountStatus = "OM.AccountStatus"; - public const string OM_Contact = "OM.Contact"; - public const string OM_ContactStatus = "OM.ContactStatus"; - public const string OM_ContactRole = "OM.ContactRole"; - public const string OM_AccountContact = "OM.AccountContact"; - public const string OM_ContactGroup = "OM.ContactGroup"; - public const string OM_ContactGroupMember = "OM.ContactGroupMember"; - public const string OM_Activity = "OM.Activity"; - public const string OM_ActivityType = "OM.ActivityType"; - public const string Integration_Connector = "Integration.Connector"; - public const string Integration_Synchronization = "Integration.Synchronization"; - public const string Analytics_Campaign = "Analytics.Campaign"; - public const string OM_Rule = "OM.Rule"; - public const string OM_Score = "OM.Score"; - public const string CMS_WorkflowTransition = "CMS.WorkflowTransition"; - public const string Newsletter_EmailTemplateNewsletter = "Newsletter.EmailTemplateNewsletter"; - public const string CMS_MacroRule = "CMS.MacroRule"; - public const string CMS_WorkflowStepUser = "CMS.WorkflowStepUser"; - public const string CMS_WorkflowUser = "CMS.WorkflowUser"; - public const string cms_aclitem = "cms.aclitem"; - public const string CMS_TranslationService = "CMS.TranslationService"; - public const string CMS_TranslationSubmission = "CMS.TranslationSubmission"; - public const string cms_workflowaction = "cms.workflowaction"; - public const string cms_webfarmservertask = "cms.webfarmservertask"; - public const string OM_ScoreContactRule = "OM.ScoreContactRule"; - public const string CMS_DocumentTypeScope = "CMS.DocumentTypeScope"; - public const string CMS_DocumentTypeScopeClass = "CMS.DocumentTypeScopeClass"; - public const string SM_FacebookApplication = "SM.FacebookApplication"; - public const string SM_FacebookAccount = "SM.FacebookAccount"; - public const string SM_TwitterApplication = "SM.TwitterApplication"; - public const string SM_TwitterAccount = "SM.TwitterAccount"; - public const string SM_FacebookPost = "SM.FacebookPost"; - public const string SM_TwitterPost = "SM.TwitterPost"; - public const string analytics_exitpage = "analytics.exitpage"; - public const string SM_Insight = "SM.Insight"; - public const string SM_InsightHit_Day = "SM.InsightHit_Day"; - public const string SM_InsightHit_Week = "SM.InsightHit_Week"; - public const string SM_InsightHit_Month = "SM.InsightHit_Month"; - public const string SM_InsightHit_Year = "SM.InsightHit_Year"; - public const string Personas_Persona = "Personas.Persona"; - public const string Analytics_CampaignConversion = "Analytics.CampaignConversion"; - public const string Analytics_CampaignConversionHits = "Analytics.CampaignConversionHits"; - public const string OM_VisitorToContact = "OM.VisitorToContact"; - public const string CMS_ModuleLicenseKey = "CMS.ModuleLicenseKey"; - public const string newsletter_issuecontactgroup = "newsletter.issuecontactgroup"; - public const string Analytics_CampaignObjective = "Analytics.CampaignObjective"; - public const string CMS_ModuleUsageCounter = "CMS.ModuleUsageCounter"; - public const string CMS_MacroIdentity = "CMS.MacroIdentity"; - public const string CMS_UserMacroIdentity = "CMS.UserMacroIdentity"; - public const string Newsletter_EmailWidget = "Newsletter.EmailWidget"; - public const string CMS_SearchTaskAzure = "CMS.SearchTaskAzure"; - public const string Newsletter_EmailWidgetTemplate = "Newsletter.EmailWidgetTemplate"; - public const string Personas_PersonaContactHistory = "Personas.PersonaContactHistory"; - public const string CMS_Consent = "CMS.Consent"; - public const string CMS_ConsentAgreement = "CMS.ConsentAgreement"; - public const string CMS_ConsentArchive = "CMS.ConsentArchive"; - public const string Temp_PageBuilderWidgets = "Temp.PageBuilderWidgets"; - public const string CMS_AlternativeUrl = "CMS.AlternativeUrl"; - public const string CMS_PageTemplateConfiguration = "CMS.PageTemplateConfiguration"; - public const string OM_ABVariantData = "OM.ABVariantData"; - public const string CMS_AutomationTemplate = "CMS.AutomationTemplate"; - public const string CMS_PageUrlPath = "CMS.PageUrlPath"; - public const string CMS_PageFormerUrlPath = "CMS.PageFormerUrlPath"; - - public static HashSet All = new( - new[] - { - cms_culture, cms_site, cms_Role, cms_user, cms_UserRole, cms_emailtemplate, cms_permission, cms_resource, CMS_EventLog, cms_tree, cms_document, cms_class, cms_pagetemplate, cms_query, - cms_transformation, cms_workflow, cms_workflowstep, cms_workflowscope, cms_versionhistory, cms_acl, cms_pagetemplatecategory, cms_layout, cms_webpartcategory, cms_webpart, - cms_attachment, cms_attachmenthistory, cms_relationshipname, CMS_RelationshipNameSite, CMS_Relationship, cms_sitedomainalias, cms_form, cms_WebPartContainer, cms_LicenseKey, - cms_WebFarmServer, cms_country, cms_state, cms_WebPartLayout, CMS_SettingsKey, CMS_ResourceSite, CMS_CultureSite, CMS_UserSite, CMS_WorkflowStepRole, CMS_ClassSite, cms_FormRole, - CMS_AllowedChildClass, cms_rolepermission, cms_settingscategory, CMS_VersionAttachment, CMS_WebPartContainerSite, cms_category, cms_documentcategory, cms_AlternativeForm, cms_timezone, - cms_avatar, cms_usersettings, cms_email, cms_attachmentforemail, CMS_EmailUser, cms_SearchIndex, cms_SearchIndexSite, cms_SearchIndexCulture, CMS_SearchTask, cms_userculture, - CMS_UIElement, CMS_RoleUIElement, cms_Widget, CMS_WidgetCategory, CMS_WidgetRole, CMS_Membership, CMS_SMTPServer, CMS_SMTPServerSite, CMS_MembershipRole, CMS_MembershipUser, - CMS_WorkflowTransition, CMS_MacroRule, CMS_WorkflowStepUser, CMS_WorkflowUser, cms_aclitem, CMS_TranslationService, CMS_TranslationSubmission, cms_workflowaction, - cms_webfarmservertask, CMS_DocumentTypeScope, CMS_DocumentTypeScopeClass, CMS_ModuleLicenseKey, CMS_ModuleUsageCounter, CMS_MacroIdentity, CMS_UserMacroIdentity, CMS_SearchTaskAzure, - CMS_Consent, CMS_ConsentAgreement, CMS_ConsentArchive, CMS_AlternativeUrl, CMS_PageTemplateConfiguration, CMS_AutomationTemplate, CMS_PageUrlPath, CMS_PageFormerUrlPath, - }, StringComparer.InvariantCultureIgnoreCase); - - public static HashSet Customizable = new(new[] { cms_user, cms_usersettings, media_file, OM_Account, OM_Contact }, StringComparer.InvariantCultureIgnoreCase); - public static HashSet NoLongerSupported = new(new[] { cms_usersettings }, StringComparer.InvariantCultureIgnoreCase); +// ReSharper disable InconsistentNaming + +namespace Migration.Toolkit.Common.Enumerations; + +public static class Kx13SystemClass +{ + public const string cms_culture = "cms.culture"; + public const string cms_site = "cms.site"; + public const string cms_Role = "cms.Role"; + public const string cms_user = "cms.user"; + public const string cms_UserRole = "cms.UserRole"; + public const string cms_emailtemplate = "cms.emailtemplate"; + public const string cms_permission = "cms.permission"; + public const string cms_resource = "cms.resource"; + public const string CMS_EventLog = "CMS.EventLog"; + public const string cms_tree = "cms.tree"; + public const string cms_document = "cms.document"; + public const string cms_class = "cms.class"; + public const string cms_pagetemplate = "cms.pagetemplate"; + public const string cms_query = "cms.query"; + public const string cms_transformation = "cms.transformation"; + public const string cms_workflow = "cms.workflow"; + public const string cms_workflowstep = "cms.workflowstep"; + public const string cms_workflowscope = "cms.workflowscope"; + public const string cms_versionhistory = "cms.versionhistory"; + public const string cms_acl = "cms.acl"; + public const string cms_pagetemplatecategory = "cms.pagetemplatecategory"; + public const string cms_layout = "cms.layout"; + public const string cms_webpartcategory = "cms.webpartcategory"; + public const string cms_webpart = "cms.webpart"; + public const string cms_attachment = "cms.attachment"; + public const string cms_attachmenthistory = "cms.attachmenthistory"; + public const string cms_relationshipname = "cms.relationshipname"; + public const string CMS_RelationshipNameSite = "CMS.RelationshipNameSite"; + public const string CMS_Relationship = "CMS.Relationship"; + public const string cms_sitedomainalias = "cms.sitedomainalias"; + public const string cms_form = "cms.form"; + public const string newsletter_emailtemplate = "newsletter.emailtemplate"; + public const string newsletter_subscriber = "newsletter.subscriber"; + public const string Newsletter_SubscriberNewsletter = "Newsletter.SubscriberNewsletter"; + public const string newsletter_newsletter = "newsletter.newsletter"; + public const string cms_WebPartContainer = "cms.WebPartContainer"; + public const string cms_LicenseKey = "cms.LicenseKey"; + public const string cms_WebFarmServer = "cms.WebFarmServer"; + public const string cms_country = "cms.country"; + public const string cms_state = "cms.state"; + public const string staging_synchronization = "staging.synchronization"; + public const string staging_server = "staging.server"; + public const string Reporting_Report = "Reporting.Report"; + public const string analytics_statistics = "analytics.statistics"; + public const string analytics_hitsweek = "analytics.hitsweek"; + public const string Reporting_ReportCategory = "Reporting.ReportCategory"; + public const string cms_WebPartLayout = "cms.WebPartLayout"; + public const string CMS_SettingsKey = "CMS.SettingsKey"; + public const string export_history = "export.history"; + public const string CMS_ResourceSite = "CMS.ResourceSite"; + public const string CMS_CultureSite = "CMS.CultureSite"; + public const string CMS_UserSite = "CMS.UserSite"; + public const string CMS_WorkflowStepRole = "CMS.WorkflowStepRole"; + public const string CMS_ClassSite = "CMS.ClassSite"; + public const string cms_FormRole = "cms.FormRole"; + public const string CMS_AllowedChildClass = "CMS.AllowedChildClass"; + public const string cms_rolepermission = "cms.rolepermission"; + public const string cms_settingscategory = "cms.settingscategory"; + public const string CMS_VersionAttachment = "CMS.VersionAttachment"; + public const string CMS_WebPartContainerSite = "CMS.WebPartContainerSite"; + public const string cms_category = "cms.category"; + public const string cms_documentcategory = "cms.documentcategory"; + public const string cms_AlternativeForm = "cms.AlternativeForm"; + public const string cms_timezone = "cms.timezone"; + public const string cms_avatar = "cms.avatar"; + public const string cms_usersettings = "cms.usersettings"; + public const string cms_email = "cms.email"; + public const string cms_attachmentforemail = "cms.attachmentforemail"; + public const string CMS_EmailUser = "CMS.EmailUser"; + public const string media_library = "media.library"; + public const string media_file = "media.file"; + public const string media_libraryrolepermission = "media.libraryrolepermission"; + public const string cms_SearchIndex = "cms.SearchIndex"; + public const string cms_SearchIndexSite = "cms.SearchIndexSite"; + public const string cms_SearchIndexCulture = "cms.SearchIndexCulture"; + public const string CMS_SearchTask = "CMS.SearchTask"; + public const string cms_userculture = "cms.userculture"; + public const string CMS_UIElement = "CMS.UIElement"; + public const string CMS_RoleUIElement = "CMS.RoleUIElement"; + public const string cms_Widget = "cms.Widget"; + public const string CMS_WidgetCategory = "CMS.WidgetCategory"; + public const string CMS_WidgetRole = "CMS.WidgetRole"; + public const string newsletter_openedemail = "newsletter.openedemail"; + public const string OM_ABTest = "OM.ABTest"; + public const string CMS_Membership = "CMS.Membership"; + public const string CMS_SMTPServer = "CMS.SMTPServer"; + public const string CMS_SMTPServerSite = "CMS.SMTPServerSite"; + public const string CMS_MembershipRole = "CMS.MembershipRole"; + public const string CMS_MembershipUser = "CMS.MembershipUser"; + public const string OM_Account = "OM.Account"; + public const string OM_AccountStatus = "OM.AccountStatus"; + public const string OM_Contact = "OM.Contact"; + public const string OM_ContactStatus = "OM.ContactStatus"; + public const string OM_ContactRole = "OM.ContactRole"; + public const string OM_AccountContact = "OM.AccountContact"; + public const string OM_ContactGroup = "OM.ContactGroup"; + public const string OM_ContactGroupMember = "OM.ContactGroupMember"; + public const string OM_Activity = "OM.Activity"; + public const string OM_ActivityType = "OM.ActivityType"; + public const string Integration_Connector = "Integration.Connector"; + public const string Integration_Synchronization = "Integration.Synchronization"; + public const string Analytics_Campaign = "Analytics.Campaign"; + public const string OM_Rule = "OM.Rule"; + public const string OM_Score = "OM.Score"; + public const string CMS_WorkflowTransition = "CMS.WorkflowTransition"; + public const string Newsletter_EmailTemplateNewsletter = "Newsletter.EmailTemplateNewsletter"; + public const string CMS_MacroRule = "CMS.MacroRule"; + public const string CMS_WorkflowStepUser = "CMS.WorkflowStepUser"; + public const string CMS_WorkflowUser = "CMS.WorkflowUser"; + public const string cms_aclitem = "cms.aclitem"; + public const string CMS_TranslationService = "CMS.TranslationService"; + public const string CMS_TranslationSubmission = "CMS.TranslationSubmission"; + public const string cms_workflowaction = "cms.workflowaction"; + public const string cms_webfarmservertask = "cms.webfarmservertask"; + public const string OM_ScoreContactRule = "OM.ScoreContactRule"; + public const string CMS_DocumentTypeScope = "CMS.DocumentTypeScope"; + public const string CMS_DocumentTypeScopeClass = "CMS.DocumentTypeScopeClass"; + public const string SM_FacebookApplication = "SM.FacebookApplication"; + public const string SM_FacebookAccount = "SM.FacebookAccount"; + public const string SM_TwitterApplication = "SM.TwitterApplication"; + public const string SM_TwitterAccount = "SM.TwitterAccount"; + public const string SM_FacebookPost = "SM.FacebookPost"; + public const string SM_TwitterPost = "SM.TwitterPost"; + public const string analytics_exitpage = "analytics.exitpage"; + public const string SM_Insight = "SM.Insight"; + public const string SM_InsightHit_Day = "SM.InsightHit_Day"; + public const string SM_InsightHit_Week = "SM.InsightHit_Week"; + public const string SM_InsightHit_Month = "SM.InsightHit_Month"; + public const string SM_InsightHit_Year = "SM.InsightHit_Year"; + public const string Personas_Persona = "Personas.Persona"; + public const string Analytics_CampaignConversion = "Analytics.CampaignConversion"; + public const string Analytics_CampaignConversionHits = "Analytics.CampaignConversionHits"; + public const string OM_VisitorToContact = "OM.VisitorToContact"; + public const string CMS_ModuleLicenseKey = "CMS.ModuleLicenseKey"; + public const string newsletter_issuecontactgroup = "newsletter.issuecontactgroup"; + public const string Analytics_CampaignObjective = "Analytics.CampaignObjective"; + public const string CMS_ModuleUsageCounter = "CMS.ModuleUsageCounter"; + public const string CMS_MacroIdentity = "CMS.MacroIdentity"; + public const string CMS_UserMacroIdentity = "CMS.UserMacroIdentity"; + public const string Newsletter_EmailWidget = "Newsletter.EmailWidget"; + public const string CMS_SearchTaskAzure = "CMS.SearchTaskAzure"; + public const string Newsletter_EmailWidgetTemplate = "Newsletter.EmailWidgetTemplate"; + public const string Personas_PersonaContactHistory = "Personas.PersonaContactHistory"; + public const string CMS_Consent = "CMS.Consent"; + public const string CMS_ConsentAgreement = "CMS.ConsentAgreement"; + public const string CMS_ConsentArchive = "CMS.ConsentArchive"; + public const string Temp_PageBuilderWidgets = "Temp.PageBuilderWidgets"; + public const string CMS_AlternativeUrl = "CMS.AlternativeUrl"; + public const string CMS_PageTemplateConfiguration = "CMS.PageTemplateConfiguration"; + public const string OM_ABVariantData = "OM.ABVariantData"; + public const string CMS_AutomationTemplate = "CMS.AutomationTemplate"; + public const string CMS_PageUrlPath = "CMS.PageUrlPath"; + public const string CMS_PageFormerUrlPath = "CMS.PageFormerUrlPath"; + + public static HashSet All = new( + new[] + { + cms_culture, cms_site, cms_Role, cms_user, cms_UserRole, cms_emailtemplate, cms_permission, cms_resource, CMS_EventLog, cms_tree, cms_document, cms_class, cms_pagetemplate, cms_query, + cms_transformation, cms_workflow, cms_workflowstep, cms_workflowscope, cms_versionhistory, cms_acl, cms_pagetemplatecategory, cms_layout, cms_webpartcategory, cms_webpart, + cms_attachment, cms_attachmenthistory, cms_relationshipname, CMS_RelationshipNameSite, CMS_Relationship, cms_sitedomainalias, cms_form, cms_WebPartContainer, cms_LicenseKey, + cms_WebFarmServer, cms_country, cms_state, cms_WebPartLayout, CMS_SettingsKey, CMS_ResourceSite, CMS_CultureSite, CMS_UserSite, CMS_WorkflowStepRole, CMS_ClassSite, cms_FormRole, + CMS_AllowedChildClass, cms_rolepermission, cms_settingscategory, CMS_VersionAttachment, CMS_WebPartContainerSite, cms_category, cms_documentcategory, cms_AlternativeForm, cms_timezone, + cms_avatar, cms_usersettings, cms_email, cms_attachmentforemail, CMS_EmailUser, cms_SearchIndex, cms_SearchIndexSite, cms_SearchIndexCulture, CMS_SearchTask, cms_userculture, + CMS_UIElement, CMS_RoleUIElement, cms_Widget, CMS_WidgetCategory, CMS_WidgetRole, CMS_Membership, CMS_SMTPServer, CMS_SMTPServerSite, CMS_MembershipRole, CMS_MembershipUser, + CMS_WorkflowTransition, CMS_MacroRule, CMS_WorkflowStepUser, CMS_WorkflowUser, cms_aclitem, CMS_TranslationService, CMS_TranslationSubmission, cms_workflowaction, + cms_webfarmservertask, CMS_DocumentTypeScope, CMS_DocumentTypeScopeClass, CMS_ModuleLicenseKey, CMS_ModuleUsageCounter, CMS_MacroIdentity, CMS_UserMacroIdentity, CMS_SearchTaskAzure, + CMS_Consent, CMS_ConsentAgreement, CMS_ConsentArchive, CMS_AlternativeUrl, CMS_PageTemplateConfiguration, CMS_AutomationTemplate, CMS_PageUrlPath, CMS_PageFormerUrlPath, + }, StringComparer.InvariantCultureIgnoreCase); + + public static HashSet Customizable = new(new[] { cms_user, cms_usersettings, media_file, OM_Account, OM_Contact }, StringComparer.InvariantCultureIgnoreCase); + public static HashSet NoLongerSupported = new(new[] { cms_usersettings }, StringComparer.InvariantCultureIgnoreCase); } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Enumerations/Kx13SystemResource.cs b/Migration.Toolkit.Common/Enumerations/Kx13SystemResource.cs index b692cda9..95c3840f 100644 --- a/Migration.Toolkit.Common/Enumerations/Kx13SystemResource.cs +++ b/Migration.Toolkit.Common/Enumerations/Kx13SystemResource.cs @@ -1,72 +1,72 @@ -// ReSharper disable InconsistentNaming - -namespace Migration.Toolkit.Common.Enumerations; - -public static class Kx13SystemResource -{ - public const string CMS = "CMS"; - public const string CMS_ABTest = "CMS.ABTest"; - public const string CMS_Activities = "CMS.Activities"; - public const string CMS_Badges = "CMS.Badges"; - public const string CMS_Categories = "CMS.Categories"; - public const string CMS_ContactManagement = "CMS.ContactManagement"; - public const string CMS_Content = "CMS.Content"; - public const string CMS_ContinuousIntegration = "CMS.ContinuousIntegration"; - public const string cms_customsystemmodule = "cms.customsystemmodule"; - public const string CMS_CustomTables = "CMS.CustomTables"; - public const string CMS_DataProtection = "CMS.DataProtection"; - public const string CMS_Design = "CMS.Design"; - public const string CMS_DocumentEngine = "CMS.DocumentEngine"; - public const string CMS_Ecommerce = "CMS.Ecommerce"; - public const string CMS_EmailEngine = "CMS.EmailEngine"; - public const string CMS_EmailTemplates = "CMS.EmailTemplates"; - public const string CMS_EventLog = "CMS.EventLog"; - public const string CMS_Form = "CMS.Form"; - public const string CMS_Globalization = "CMS.Globalization"; - public const string CMS_GlobalPermissions = "CMS.GlobalPermissions"; - public const string CMS_Localization = "CMS.Localization"; - public const string CMS_MacroEngine = "CMS.MacroEngine"; - public const string CMS_MediaDialog = "CMS.MediaDialog"; - public const string CMS_MediaLibrary = "CMS.MediaLibrary"; - public const string CMS_Membership = "CMS.Membership"; - public const string CMS_ModuleLicenses = "CMS.ModuleLicenses"; - public const string CMS_ModuleUsageTracking = "CMS.ModuleUsageTracking"; - public const string CMS_Newsletter = "CMS.Newsletter"; - public const string CMS_OnlineMarketing = "CMS.OnlineMarketing"; - public const string CMS_Permissions = "CMS.Permissions"; - public const string CMS_Personas = "CMS.Personas"; - public const string CMS_Relationships = "CMS.Relationships"; - public const string CMS_Reporting = "CMS.Reporting"; - public const string CMS_Roles = "CMS.Roles"; - public const string CMS_ScheduledTasks = "CMS.ScheduledTasks"; - public const string CMS_Scoring = "CMS.Scoring"; - public const string CMS_Search = "CMS.Search"; - public const string CMS_Search_Azure = "CMS.Search.Azure"; - public const string CMS_SharePoint = "CMS.SharePoint"; - public const string CMS_SocialMarketing = "CMS.SocialMarketing"; - public const string CMS_Staging = "CMS.Staging"; - public const string CMS_Synchronization = "CMS.Synchronization"; - public const string CMS_Taxonomy = "CMS.Taxonomy"; - public const string CMS_TranslationServices = "CMS.TranslationServices"; - public const string CMS_UIPersonalization = "CMS.UIPersonalization"; - public const string CMS_Users = "CMS.Users"; - public const string CMS_WebAnalytics = "CMS.WebAnalytics"; - public const string CMS_WebFarm = "CMS.WebFarm"; - public const string CMS_Widgets = "CMS.Widgets"; - public const string CMS_WIFIntegration = "CMS.WIFIntegration"; - public const string CMS_WorkflowEngine = "CMS.WorkflowEngine"; - public const string CMS_WYSIWYGEditor = "CMS.WYSIWYGEditor"; - public const string Licenses = "Licenses"; - - public static HashSet All = new(new[] - { - CMS, CMS_ABTest, CMS_Activities, CMS_Badges, CMS_Categories, CMS_ContactManagement, CMS_Content, CMS_ContinuousIntegration, cms_customsystemmodule, CMS_CustomTables, CMS_DataProtection, - CMS_Design, CMS_DocumentEngine, CMS_Ecommerce, CMS_EmailEngine, CMS_EmailTemplates, CMS_EventLog, CMS_Form, CMS_Globalization, CMS_GlobalPermissions, CMS_Localization, CMS_MacroEngine, - CMS_MediaDialog, CMS_MediaLibrary, CMS_Membership, CMS_ModuleLicenses, CMS_ModuleUsageTracking, CMS_Newsletter, CMS_OnlineMarketing, CMS_Permissions, - CMS_Personas, CMS_Relationships, CMS_Reporting, CMS_Roles, CMS_ScheduledTasks, CMS_Scoring, CMS_Search, CMS_Search_Azure, CMS_SharePoint, CMS_SocialMarketing, CMS_Staging, - CMS_Synchronization, CMS_Taxonomy, CMS_TranslationServices, CMS_UIPersonalization, CMS_Users, CMS_WebAnalytics, CMS_WebFarm, CMS_Widgets, CMS_WIFIntegration, CMS_WorkflowEngine, - CMS_WYSIWYGEditor, Licenses, - }, StringComparer.InvariantCultureIgnoreCase); - - public static HashSet ConvertToNonSysResource = new(new[] { cms_customsystemmodule }, StringComparer.CurrentCultureIgnoreCase); +// ReSharper disable InconsistentNaming + +namespace Migration.Toolkit.Common.Enumerations; + +public static class Kx13SystemResource +{ + public const string CMS = "CMS"; + public const string CMS_ABTest = "CMS.ABTest"; + public const string CMS_Activities = "CMS.Activities"; + public const string CMS_Badges = "CMS.Badges"; + public const string CMS_Categories = "CMS.Categories"; + public const string CMS_ContactManagement = "CMS.ContactManagement"; + public const string CMS_Content = "CMS.Content"; + public const string CMS_ContinuousIntegration = "CMS.ContinuousIntegration"; + public const string cms_customsystemmodule = "cms.customsystemmodule"; + public const string CMS_CustomTables = "CMS.CustomTables"; + public const string CMS_DataProtection = "CMS.DataProtection"; + public const string CMS_Design = "CMS.Design"; + public const string CMS_DocumentEngine = "CMS.DocumentEngine"; + public const string CMS_Ecommerce = "CMS.Ecommerce"; + public const string CMS_EmailEngine = "CMS.EmailEngine"; + public const string CMS_EmailTemplates = "CMS.EmailTemplates"; + public const string CMS_EventLog = "CMS.EventLog"; + public const string CMS_Form = "CMS.Form"; + public const string CMS_Globalization = "CMS.Globalization"; + public const string CMS_GlobalPermissions = "CMS.GlobalPermissions"; + public const string CMS_Localization = "CMS.Localization"; + public const string CMS_MacroEngine = "CMS.MacroEngine"; + public const string CMS_MediaDialog = "CMS.MediaDialog"; + public const string CMS_MediaLibrary = "CMS.MediaLibrary"; + public const string CMS_Membership = "CMS.Membership"; + public const string CMS_ModuleLicenses = "CMS.ModuleLicenses"; + public const string CMS_ModuleUsageTracking = "CMS.ModuleUsageTracking"; + public const string CMS_Newsletter = "CMS.Newsletter"; + public const string CMS_OnlineMarketing = "CMS.OnlineMarketing"; + public const string CMS_Permissions = "CMS.Permissions"; + public const string CMS_Personas = "CMS.Personas"; + public const string CMS_Relationships = "CMS.Relationships"; + public const string CMS_Reporting = "CMS.Reporting"; + public const string CMS_Roles = "CMS.Roles"; + public const string CMS_ScheduledTasks = "CMS.ScheduledTasks"; + public const string CMS_Scoring = "CMS.Scoring"; + public const string CMS_Search = "CMS.Search"; + public const string CMS_Search_Azure = "CMS.Search.Azure"; + public const string CMS_SharePoint = "CMS.SharePoint"; + public const string CMS_SocialMarketing = "CMS.SocialMarketing"; + public const string CMS_Staging = "CMS.Staging"; + public const string CMS_Synchronization = "CMS.Synchronization"; + public const string CMS_Taxonomy = "CMS.Taxonomy"; + public const string CMS_TranslationServices = "CMS.TranslationServices"; + public const string CMS_UIPersonalization = "CMS.UIPersonalization"; + public const string CMS_Users = "CMS.Users"; + public const string CMS_WebAnalytics = "CMS.WebAnalytics"; + public const string CMS_WebFarm = "CMS.WebFarm"; + public const string CMS_Widgets = "CMS.Widgets"; + public const string CMS_WIFIntegration = "CMS.WIFIntegration"; + public const string CMS_WorkflowEngine = "CMS.WorkflowEngine"; + public const string CMS_WYSIWYGEditor = "CMS.WYSIWYGEditor"; + public const string Licenses = "Licenses"; + + public static HashSet All = new(new[] + { + CMS, CMS_ABTest, CMS_Activities, CMS_Badges, CMS_Categories, CMS_ContactManagement, CMS_Content, CMS_ContinuousIntegration, cms_customsystemmodule, CMS_CustomTables, CMS_DataProtection, + CMS_Design, CMS_DocumentEngine, CMS_Ecommerce, CMS_EmailEngine, CMS_EmailTemplates, CMS_EventLog, CMS_Form, CMS_Globalization, CMS_GlobalPermissions, CMS_Localization, CMS_MacroEngine, + CMS_MediaDialog, CMS_MediaLibrary, CMS_Membership, CMS_ModuleLicenses, CMS_ModuleUsageTracking, CMS_Newsletter, CMS_OnlineMarketing, CMS_Permissions, + CMS_Personas, CMS_Relationships, CMS_Reporting, CMS_Roles, CMS_ScheduledTasks, CMS_Scoring, CMS_Search, CMS_Search_Azure, CMS_SharePoint, CMS_SocialMarketing, CMS_Staging, + CMS_Synchronization, CMS_Taxonomy, CMS_TranslationServices, CMS_UIPersonalization, CMS_Users, CMS_WebAnalytics, CMS_WebFarm, CMS_Widgets, CMS_WIFIntegration, CMS_WorkflowEngine, + CMS_WYSIWYGEditor, Licenses, + }, StringComparer.InvariantCultureIgnoreCase); + + public static HashSet ConvertToNonSysResource = new(new[] { cms_customsystemmodule }, StringComparer.CurrentCultureIgnoreCase); } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Enumerations/NodeXmlColumns.cs b/Migration.Toolkit.Common/Enumerations/NodeXmlColumns.cs index b8cc4d67..bf43fa7b 100644 --- a/Migration.Toolkit.Common/Enumerations/NodeXmlColumns.cs +++ b/Migration.Toolkit.Common/Enumerations/NodeXmlColumns.cs @@ -1,42 +1,42 @@ -namespace Migration.Toolkit.Common.Enumerations; - -public class NodeXmlColumns -{ - public const string NODE_ID = "NodeID"; - public const string NODE_ALIAS_PATH = "NodeAliasPath"; - public const string NODE_NAME = "NodeName"; - public const string NODE_ALIAS = "NodeAlias"; - public const string NODE_CLASS_ID = "NodeClassID"; - public const string NODE_PARENT_ID = "NodeParentID"; - public const string NODE_LEVEL = "NodeLevel"; - public const string NODE_SITE_ID = "NodeSiteID"; - public const string NODE_GUID = "NodeGUID"; - public const string NODE_ORDER = "NodeOrder"; - public const string NODE_OWNER = "NodeOwner"; - public const string NODE_HAS_CHILDREN = "NodeHasChildren"; - public const string NODE_HAS_LINKS = "NodeHasLinks"; - public const string NODE_ORIGINAL_NODE_ID = "NodeOriginalNodeID"; - public const string NODE_IS_PAGE = "NodeIsPage"; - public const string NODE_IS_SECURED = "NodeIsSecured"; - public const string DOCUMENT_ID = "DocumentID"; - public const string DOCUMENT_NAME = "DocumentName"; - public const string DOCUMENT_MODIFIED_WHEN = "DocumentModifiedWhen"; - public const string DOCUMENT_MODIFIED_BY_USER_ID = "DocumentModifiedByUserID"; - public const string DOCUMENT_CREATED_BY_USER_ID = "DocumentCreatedByUserID"; - public const string DOCUMENT_CREATED_WHEN = "DocumentCreatedWhen"; - public const string DOCUMENT_CHECKED_OUT_VERSION_HISTORY_ID = "DocumentCheckedOutVersionHistoryID"; - public const string DOCUMENT_PUBLISHED_VERSION_HISTORY_ID = "DocumentPublishedVersionHistoryID"; - public const string DOCUMENT_WORKFLOW_STEP_ID = "DocumentWorkflowStepID"; - public const string DOCUMENT_CULTURE = "DocumentCulture"; - public const string DOCUMENT_NODE_ID = "DocumentNodeID"; - public const string DOCUMENT_CONTENT = "DocumentContent"; - public const string DOCUMENT_LAST_VERSION_NUMBER = "DocumentLastVersionNumber"; - public const string DOCUMENT_IS_ARCHIVED = "DocumentIsArchived"; - public const string DOCUMENT_GUID = "DocumentGUID"; - public const string DOCUMENT_WORKFLOW_CYCLE_GUID = "DocumentWorkflowCycleGUID"; - public const string DOCUMENT_CAN_BE_PUBLISHED = "DocumentCanBePublished"; - public const string DOCUMENT_PAGE_BUILDER_WIDGETS = "DocumentPageBuilderWidgets"; - public const string CLASS_NAME = "ClassName"; - - public const string DOCUMENT_PAGE_TEMPLATE_CONFIGURATION = "DocumentPageTemplateConfiguration"; +namespace Migration.Toolkit.Common.Enumerations; + +public class NodeXmlColumns +{ + public const string NODE_ID = "NodeID"; + public const string NODE_ALIAS_PATH = "NodeAliasPath"; + public const string NODE_NAME = "NodeName"; + public const string NODE_ALIAS = "NodeAlias"; + public const string NODE_CLASS_ID = "NodeClassID"; + public const string NODE_PARENT_ID = "NodeParentID"; + public const string NODE_LEVEL = "NodeLevel"; + public const string NODE_SITE_ID = "NodeSiteID"; + public const string NODE_GUID = "NodeGUID"; + public const string NODE_ORDER = "NodeOrder"; + public const string NODE_OWNER = "NodeOwner"; + public const string NODE_HAS_CHILDREN = "NodeHasChildren"; + public const string NODE_HAS_LINKS = "NodeHasLinks"; + public const string NODE_ORIGINAL_NODE_ID = "NodeOriginalNodeID"; + public const string NODE_IS_PAGE = "NodeIsPage"; + public const string NODE_IS_SECURED = "NodeIsSecured"; + public const string DOCUMENT_ID = "DocumentID"; + public const string DOCUMENT_NAME = "DocumentName"; + public const string DOCUMENT_MODIFIED_WHEN = "DocumentModifiedWhen"; + public const string DOCUMENT_MODIFIED_BY_USER_ID = "DocumentModifiedByUserID"; + public const string DOCUMENT_CREATED_BY_USER_ID = "DocumentCreatedByUserID"; + public const string DOCUMENT_CREATED_WHEN = "DocumentCreatedWhen"; + public const string DOCUMENT_CHECKED_OUT_VERSION_HISTORY_ID = "DocumentCheckedOutVersionHistoryID"; + public const string DOCUMENT_PUBLISHED_VERSION_HISTORY_ID = "DocumentPublishedVersionHistoryID"; + public const string DOCUMENT_WORKFLOW_STEP_ID = "DocumentWorkflowStepID"; + public const string DOCUMENT_CULTURE = "DocumentCulture"; + public const string DOCUMENT_NODE_ID = "DocumentNodeID"; + public const string DOCUMENT_CONTENT = "DocumentContent"; + public const string DOCUMENT_LAST_VERSION_NUMBER = "DocumentLastVersionNumber"; + public const string DOCUMENT_IS_ARCHIVED = "DocumentIsArchived"; + public const string DOCUMENT_GUID = "DocumentGUID"; + public const string DOCUMENT_WORKFLOW_CYCLE_GUID = "DocumentWorkflowCycleGUID"; + public const string DOCUMENT_CAN_BE_PUBLISHED = "DocumentCanBePublished"; + public const string DOCUMENT_PAGE_BUILDER_WIDGETS = "DocumentPageBuilderWidgets"; + public const string CLASS_NAME = "ClassName"; + + public const string DOCUMENT_PAGE_TEMPLATE_CONFIGURATION = "DocumentPageTemplateConfiguration"; } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Enumerations/XbKSystemClasses.cs b/Migration.Toolkit.Common/Enumerations/XbKSystemClasses.cs index 0f08fdbe..c851f820 100644 --- a/Migration.Toolkit.Common/Enumerations/XbKSystemClasses.cs +++ b/Migration.Toolkit.Common/Enumerations/XbKSystemClasses.cs @@ -1,111 +1,111 @@ -// ReSharper disable InconsistentNaming - -namespace Migration.Toolkit.Common.Enumerations; - -public class XbKSystemClasses -{ - public const string cms_culture = "cms.culture"; - public const string cms_site = "cms.site"; - public const string cms_Role = "cms.Role"; - public const string cms_user = "cms.user"; - public const string cms_UserRole = "cms.UserRole"; - public const string cms_emailtemplate = "cms.emailtemplate"; - public const string cms_permission = "cms.permission"; - public const string cms_resource = "cms.resource"; - public const string CMS_EventLog = "CMS.EventLog"; - public const string cms_tree = "cms.tree"; - public const string cms_document = "cms.document"; - public const string cms_class = "cms.class"; - public const string cms_query = "cms.query"; - public const string cms_transformation = "cms.transformation"; - public const string cms_workflow = "cms.workflow"; - public const string cms_workflowstep = "cms.workflowstep"; - public const string cms_workflowscope = "cms.workflowscope"; - public const string cms_versionhistory = "cms.versionhistory"; - public const string cms_sitedomainalias = "cms.sitedomainalias"; - public const string cms_form = "cms.form"; - public const string cms_LicenseKey = "cms.LicenseKey"; - public const string cms_WebFarmServer = "cms.WebFarmServer"; - public const string cms_country = "cms.country"; - public const string cms_state = "cms.state"; - public const string staging_synchronization = "staging.synchronization"; - public const string staging_server = "staging.server"; - public const string CMS_SettingsKey = "CMS.SettingsKey"; - public const string export_history = "export.history"; - public const string CMS_ResourceSite = "CMS.ResourceSite"; - public const string CMS_CultureSite = "CMS.CultureSite"; - public const string CMS_UserSite = "CMS.UserSite"; - public const string CMS_WorkflowStepRole = "CMS.WorkflowStepRole"; - public const string CMS_ClassSite = "CMS.ClassSite"; - public const string cms_FormRole = "cms.FormRole"; - public const string cms_rolepermission = "cms.rolepermission"; - public const string cms_settingscategory = "cms.settingscategory"; - public const string cms_AlternativeForm = "cms.AlternativeForm"; - public const string cms_timezone = "cms.timezone"; - public const string cms_email = "cms.email"; - public const string cms_attachmentforemail = "cms.attachmentforemail"; - public const string media_library = "media.library"; - public const string media_file = "media.file"; - public const string media_libraryrolepermission = "media.libraryrolepermission"; - public const string cms_SearchIndex = "cms.SearchIndex"; - public const string cms_SearchIndexSite = "cms.SearchIndexSite"; - public const string cms_SearchIndexCulture = "cms.SearchIndexCulture"; - public const string CMS_SearchTask = "CMS.SearchTask"; - public const string cms_userculture = "cms.userculture"; - public const string OM_ABTest = "OM.ABTest"; - public const string CMS_Membership = "CMS.Membership"; - public const string CMS_MembershipRole = "CMS.MembershipRole"; - public const string CMS_MembershipUser = "CMS.MembershipUser"; - public const string OM_Account = "OM.Account"; - public const string OM_AccountStatus = "OM.AccountStatus"; - public const string OM_Contact = "OM.Contact"; - public const string OM_ContactStatus = "OM.ContactStatus"; - public const string OM_ContactRole = "OM.ContactRole"; - public const string OM_AccountContact = "OM.AccountContact"; - public const string OM_ContactGroup = "OM.ContactGroup"; - public const string OM_ContactGroupMember = "OM.ContactGroupMember"; - public const string OM_Activity = "OM.Activity"; - public const string OM_ActivityType = "OM.ActivityType"; - public const string Integration_Connector = "Integration.Connector"; - public const string Integration_Synchronization = "Integration.Synchronization"; - public const string CMS_WorkflowTransition = "CMS.WorkflowTransition"; - public const string CMS_MacroRule = "CMS.MacroRule"; - public const string CMS_WorkflowStepUser = "CMS.WorkflowStepUser"; - public const string CMS_WorkflowUser = "CMS.WorkflowUser"; - public const string cms_workflowaction = "cms.workflowaction"; - public const string cms_webfarmservertask = "cms.webfarmservertask"; - public const string OM_VisitorToContact = "OM.VisitorToContact"; - public const string CMS_MacroIdentity = "CMS.MacroIdentity"; - public const string CMS_UserMacroIdentity = "CMS.UserMacroIdentity"; - public const string CMS_SearchTaskAzure = "CMS.SearchTaskAzure"; - public const string CMS_Consent = "CMS.Consent"; - public const string CMS_ConsentAgreement = "CMS.ConsentAgreement"; - public const string CMS_ConsentArchive = "CMS.ConsentArchive"; - public const string Temp_PageBuilderWidgets = "Temp.PageBuilderWidgets"; - public const string CMS_AlternativeUrl = "CMS.AlternativeUrl"; - public const string CMS_PageTemplateConfiguration = "CMS.PageTemplateConfiguration"; - public const string OM_ABVariantData = "OM.ABVariantData"; - public const string CMS_AutomationTemplate = "CMS.AutomationTemplate"; - public const string CMS_PageUrlPath = "CMS.PageUrlPath"; - public const string CMS_PageFormerUrlPath = "CMS.PageFormerUrlPath"; - public const string CMS_FormFeaturedField = "CMS.FormFeaturedField"; - public const string CMS_MacroRuleCategory = "CMS.MacroRuleCategory"; - public const string CMS_MacroRuleMacroRuleCategory = "CMS.MacroRuleMacroRuleCategory"; - public const string OM_TrackedWebsite = "OM.TrackedWebsite"; - public const string EmailLibrary_EmailConfiguration = "EmailLibrary.EmailConfiguration"; - public const string EmailLibrary_EmailTemplate = "EmailLibrary.EmailTemplate"; - public const string cms_contentrelationship = "cms.contentrelationship"; - public const string cms_contentrelationshipitem = "cms.contentrelationshipitem"; - - public static HashSet All = new( - new[] - { - cms_culture, cms_site, cms_Role, cms_user, cms_UserRole, cms_emailtemplate, cms_permission, cms_resource, CMS_EventLog, cms_tree, cms_document, cms_class, cms_query, - cms_transformation, cms_workflow, cms_workflowstep, cms_workflowscope, cms_versionhistory, cms_sitedomainalias, cms_form, cms_LicenseKey, cms_WebFarmServer, cms_country, cms_state, - CMS_SettingsKey, CMS_ResourceSite, CMS_CultureSite, CMS_UserSite, CMS_WorkflowStepRole, CMS_ClassSite, cms_FormRole, cms_rolepermission, cms_settingscategory, cms_AlternativeForm, - cms_timezone, cms_email, cms_attachmentforemail, cms_SearchIndex, cms_SearchIndexSite, cms_SearchIndexCulture, CMS_SearchTask, cms_userculture, CMS_Membership, CMS_MembershipRole, - CMS_MembershipUser, CMS_WorkflowTransition, CMS_MacroRule, CMS_WorkflowStepUser, CMS_WorkflowUser, cms_workflowaction, cms_webfarmservertask, CMS_MacroIdentity, CMS_UserMacroIdentity, - CMS_SearchTaskAzure, CMS_Consent, CMS_ConsentAgreement, CMS_ConsentArchive, CMS_AlternativeUrl, CMS_PageTemplateConfiguration, CMS_AutomationTemplate, CMS_PageUrlPath, - CMS_PageFormerUrlPath, CMS_FormFeaturedField, CMS_MacroRuleCategory, CMS_MacroRuleMacroRuleCategory, cms_contentrelationship, cms_contentrelationshipitem, - }, StringComparer.InvariantCultureIgnoreCase); +// ReSharper disable InconsistentNaming + +namespace Migration.Toolkit.Common.Enumerations; + +public class XbKSystemClasses +{ + public const string cms_culture = "cms.culture"; + public const string cms_site = "cms.site"; + public const string cms_Role = "cms.Role"; + public const string cms_user = "cms.user"; + public const string cms_UserRole = "cms.UserRole"; + public const string cms_emailtemplate = "cms.emailtemplate"; + public const string cms_permission = "cms.permission"; + public const string cms_resource = "cms.resource"; + public const string CMS_EventLog = "CMS.EventLog"; + public const string cms_tree = "cms.tree"; + public const string cms_document = "cms.document"; + public const string cms_class = "cms.class"; + public const string cms_query = "cms.query"; + public const string cms_transformation = "cms.transformation"; + public const string cms_workflow = "cms.workflow"; + public const string cms_workflowstep = "cms.workflowstep"; + public const string cms_workflowscope = "cms.workflowscope"; + public const string cms_versionhistory = "cms.versionhistory"; + public const string cms_sitedomainalias = "cms.sitedomainalias"; + public const string cms_form = "cms.form"; + public const string cms_LicenseKey = "cms.LicenseKey"; + public const string cms_WebFarmServer = "cms.WebFarmServer"; + public const string cms_country = "cms.country"; + public const string cms_state = "cms.state"; + public const string staging_synchronization = "staging.synchronization"; + public const string staging_server = "staging.server"; + public const string CMS_SettingsKey = "CMS.SettingsKey"; + public const string export_history = "export.history"; + public const string CMS_ResourceSite = "CMS.ResourceSite"; + public const string CMS_CultureSite = "CMS.CultureSite"; + public const string CMS_UserSite = "CMS.UserSite"; + public const string CMS_WorkflowStepRole = "CMS.WorkflowStepRole"; + public const string CMS_ClassSite = "CMS.ClassSite"; + public const string cms_FormRole = "cms.FormRole"; + public const string cms_rolepermission = "cms.rolepermission"; + public const string cms_settingscategory = "cms.settingscategory"; + public const string cms_AlternativeForm = "cms.AlternativeForm"; + public const string cms_timezone = "cms.timezone"; + public const string cms_email = "cms.email"; + public const string cms_attachmentforemail = "cms.attachmentforemail"; + public const string media_library = "media.library"; + public const string media_file = "media.file"; + public const string media_libraryrolepermission = "media.libraryrolepermission"; + public const string cms_SearchIndex = "cms.SearchIndex"; + public const string cms_SearchIndexSite = "cms.SearchIndexSite"; + public const string cms_SearchIndexCulture = "cms.SearchIndexCulture"; + public const string CMS_SearchTask = "CMS.SearchTask"; + public const string cms_userculture = "cms.userculture"; + public const string OM_ABTest = "OM.ABTest"; + public const string CMS_Membership = "CMS.Membership"; + public const string CMS_MembershipRole = "CMS.MembershipRole"; + public const string CMS_MembershipUser = "CMS.MembershipUser"; + public const string OM_Account = "OM.Account"; + public const string OM_AccountStatus = "OM.AccountStatus"; + public const string OM_Contact = "OM.Contact"; + public const string OM_ContactStatus = "OM.ContactStatus"; + public const string OM_ContactRole = "OM.ContactRole"; + public const string OM_AccountContact = "OM.AccountContact"; + public const string OM_ContactGroup = "OM.ContactGroup"; + public const string OM_ContactGroupMember = "OM.ContactGroupMember"; + public const string OM_Activity = "OM.Activity"; + public const string OM_ActivityType = "OM.ActivityType"; + public const string Integration_Connector = "Integration.Connector"; + public const string Integration_Synchronization = "Integration.Synchronization"; + public const string CMS_WorkflowTransition = "CMS.WorkflowTransition"; + public const string CMS_MacroRule = "CMS.MacroRule"; + public const string CMS_WorkflowStepUser = "CMS.WorkflowStepUser"; + public const string CMS_WorkflowUser = "CMS.WorkflowUser"; + public const string cms_workflowaction = "cms.workflowaction"; + public const string cms_webfarmservertask = "cms.webfarmservertask"; + public const string OM_VisitorToContact = "OM.VisitorToContact"; + public const string CMS_MacroIdentity = "CMS.MacroIdentity"; + public const string CMS_UserMacroIdentity = "CMS.UserMacroIdentity"; + public const string CMS_SearchTaskAzure = "CMS.SearchTaskAzure"; + public const string CMS_Consent = "CMS.Consent"; + public const string CMS_ConsentAgreement = "CMS.ConsentAgreement"; + public const string CMS_ConsentArchive = "CMS.ConsentArchive"; + public const string Temp_PageBuilderWidgets = "Temp.PageBuilderWidgets"; + public const string CMS_AlternativeUrl = "CMS.AlternativeUrl"; + public const string CMS_PageTemplateConfiguration = "CMS.PageTemplateConfiguration"; + public const string OM_ABVariantData = "OM.ABVariantData"; + public const string CMS_AutomationTemplate = "CMS.AutomationTemplate"; + public const string CMS_PageUrlPath = "CMS.PageUrlPath"; + public const string CMS_PageFormerUrlPath = "CMS.PageFormerUrlPath"; + public const string CMS_FormFeaturedField = "CMS.FormFeaturedField"; + public const string CMS_MacroRuleCategory = "CMS.MacroRuleCategory"; + public const string CMS_MacroRuleMacroRuleCategory = "CMS.MacroRuleMacroRuleCategory"; + public const string OM_TrackedWebsite = "OM.TrackedWebsite"; + public const string EmailLibrary_EmailConfiguration = "EmailLibrary.EmailConfiguration"; + public const string EmailLibrary_EmailTemplate = "EmailLibrary.EmailTemplate"; + public const string cms_contentrelationship = "cms.contentrelationship"; + public const string cms_contentrelationshipitem = "cms.contentrelationshipitem"; + + public static HashSet All = new( + new[] + { + cms_culture, cms_site, cms_Role, cms_user, cms_UserRole, cms_emailtemplate, cms_permission, cms_resource, CMS_EventLog, cms_tree, cms_document, cms_class, cms_query, + cms_transformation, cms_workflow, cms_workflowstep, cms_workflowscope, cms_versionhistory, cms_sitedomainalias, cms_form, cms_LicenseKey, cms_WebFarmServer, cms_country, cms_state, + CMS_SettingsKey, CMS_ResourceSite, CMS_CultureSite, CMS_UserSite, CMS_WorkflowStepRole, CMS_ClassSite, cms_FormRole, cms_rolepermission, cms_settingscategory, cms_AlternativeForm, + cms_timezone, cms_email, cms_attachmentforemail, cms_SearchIndex, cms_SearchIndexSite, cms_SearchIndexCulture, CMS_SearchTask, cms_userculture, CMS_Membership, CMS_MembershipRole, + CMS_MembershipUser, CMS_WorkflowTransition, CMS_MacroRule, CMS_WorkflowStepUser, CMS_WorkflowUser, cms_workflowaction, cms_webfarmservertask, CMS_MacroIdentity, CMS_UserMacroIdentity, + CMS_SearchTaskAzure, CMS_Consent, CMS_ConsentAgreement, CMS_ConsentArchive, CMS_AlternativeUrl, CMS_PageTemplateConfiguration, CMS_AutomationTemplate, CMS_PageUrlPath, + CMS_PageFormerUrlPath, CMS_FormFeaturedField, CMS_MacroRuleCategory, CMS_MacroRuleMacroRuleCategory, cms_contentrelationship, cms_contentrelationshipitem, + }, StringComparer.InvariantCultureIgnoreCase); } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Enumerations/XbkSystemResource.cs b/Migration.Toolkit.Common/Enumerations/XbkSystemResource.cs index d196606b..669aaa6f 100644 --- a/Migration.Toolkit.Common/Enumerations/XbkSystemResource.cs +++ b/Migration.Toolkit.Common/Enumerations/XbkSystemResource.cs @@ -1,53 +1,53 @@ -// ReSharper disable InconsistentNaming - -namespace Migration.Toolkit.Common.Enumerations; - -public static class XbkSystemResource -{ - public const string CMS = "CMS"; - public const string CMS_ABTest = "CMS.ABTest"; - public const string CMS_Activities = "CMS.Activities"; - public const string CMS_ContactManagement = "CMS.ContactManagement"; - public const string CMS_Content = "CMS.Content"; - public const string CMS_ContinuousIntegration = "CMS.ContinuousIntegration"; - public const string CMS_CrossSiteTracking = "CMS.CrossSiteTracking"; - public const string CMS_CustomTables = "CMS.CustomTables"; - public const string CMS_DataProtection = "CMS.DataProtection"; - public const string CMS_Design = "CMS.Design"; - public const string CMS_DocumentEngine = "CMS.DocumentEngine"; - public const string CMS_EmailEngine = "CMS.EmailEngine"; - public const string CMS_EmailLibrary = "CMS.EmailLibrary"; - public const string CMS_EmailTemplates = "CMS.EmailTemplates"; - public const string CMS_EventLog = "CMS.EventLog"; - public const string CMS_Form = "CMS.Form"; - public const string CMS_Globalization = "CMS.Globalization"; - public const string CMS_GlobalPermissions = "CMS.GlobalPermissions"; - public const string CMS_Licenses = "CMS.Licenses"; - public const string CMS_Localization = "CMS.Localization"; - public const string CMS_MacroEngine = "CMS.MacroEngine"; - public const string CMS_MediaDialog = "CMS.MediaDialog"; - public const string CMS_MediaLibrary = "CMS.MediaLibrary"; - public const string CMS_Membership = "CMS.Membership"; - public const string CMS_ModuleLicenses = "CMS.ModuleLicenses"; - public const string CMS_OnlineMarketing = "CMS.OnlineMarketing"; - public const string CMS_Permissions = "CMS.Permissions"; - public const string CMS_Roles = "CMS.Roles"; - public const string CMS_ScheduledTasks = "CMS.ScheduledTasks"; - public const string CMS_Search = "CMS.Search"; - public const string CMS_Search_Azure = "CMS.Search.Azure"; - public const string CMS_Staging = "CMS.Staging"; - public const string CMS_Synchronization = "CMS.Synchronization"; - public const string CMS_UIPersonalization = "CMS.UIPersonalization"; - public const string CMS_Users = "CMS.Users"; - public const string CMS_WebFarm = "CMS.WebFarm"; - public const string CMS_WorkflowEngine = "CMS.WorkflowEngine"; - public const string CMS_WYSIWYGEditor = "CMS.WYSIWYGEditor"; - - public static HashSet All = new(new[] - { - CMS, CMS_ABTest, CMS_Activities, CMS_ContactManagement, CMS_Content, CMS_ContinuousIntegration, CMS_CrossSiteTracking, CMS_CustomTables, CMS_DataProtection, CMS_Design, CMS_DocumentEngine, - CMS_EmailEngine, CMS_EmailLibrary, CMS_EmailTemplates, CMS_EventLog, CMS_Form, CMS_Globalization, CMS_GlobalPermissions, CMS_Licenses, CMS_Localization, CMS_MacroEngine, CMS_MediaDialog, - CMS_MediaLibrary, CMS_Membership, CMS_ModuleLicenses, CMS_OnlineMarketing, CMS_Permissions, CMS_Roles, CMS_ScheduledTasks, CMS_Search, CMS_Search_Azure, CMS_Staging, CMS_Synchronization, - CMS_UIPersonalization, CMS_Users, CMS_WebFarm, CMS_WorkflowEngine, CMS_WYSIWYGEditor, - }, StringComparer.InvariantCultureIgnoreCase); +// ReSharper disable InconsistentNaming + +namespace Migration.Toolkit.Common.Enumerations; + +public static class XbkSystemResource +{ + public const string CMS = "CMS"; + public const string CMS_ABTest = "CMS.ABTest"; + public const string CMS_Activities = "CMS.Activities"; + public const string CMS_ContactManagement = "CMS.ContactManagement"; + public const string CMS_Content = "CMS.Content"; + public const string CMS_ContinuousIntegration = "CMS.ContinuousIntegration"; + public const string CMS_CrossSiteTracking = "CMS.CrossSiteTracking"; + public const string CMS_CustomTables = "CMS.CustomTables"; + public const string CMS_DataProtection = "CMS.DataProtection"; + public const string CMS_Design = "CMS.Design"; + public const string CMS_DocumentEngine = "CMS.DocumentEngine"; + public const string CMS_EmailEngine = "CMS.EmailEngine"; + public const string CMS_EmailLibrary = "CMS.EmailLibrary"; + public const string CMS_EmailTemplates = "CMS.EmailTemplates"; + public const string CMS_EventLog = "CMS.EventLog"; + public const string CMS_Form = "CMS.Form"; + public const string CMS_Globalization = "CMS.Globalization"; + public const string CMS_GlobalPermissions = "CMS.GlobalPermissions"; + public const string CMS_Licenses = "CMS.Licenses"; + public const string CMS_Localization = "CMS.Localization"; + public const string CMS_MacroEngine = "CMS.MacroEngine"; + public const string CMS_MediaDialog = "CMS.MediaDialog"; + public const string CMS_MediaLibrary = "CMS.MediaLibrary"; + public const string CMS_Membership = "CMS.Membership"; + public const string CMS_ModuleLicenses = "CMS.ModuleLicenses"; + public const string CMS_OnlineMarketing = "CMS.OnlineMarketing"; + public const string CMS_Permissions = "CMS.Permissions"; + public const string CMS_Roles = "CMS.Roles"; + public const string CMS_ScheduledTasks = "CMS.ScheduledTasks"; + public const string CMS_Search = "CMS.Search"; + public const string CMS_Search_Azure = "CMS.Search.Azure"; + public const string CMS_Staging = "CMS.Staging"; + public const string CMS_Synchronization = "CMS.Synchronization"; + public const string CMS_UIPersonalization = "CMS.UIPersonalization"; + public const string CMS_Users = "CMS.Users"; + public const string CMS_WebFarm = "CMS.WebFarm"; + public const string CMS_WorkflowEngine = "CMS.WorkflowEngine"; + public const string CMS_WYSIWYGEditor = "CMS.WYSIWYGEditor"; + + public static HashSet All = new(new[] + { + CMS, CMS_ABTest, CMS_Activities, CMS_ContactManagement, CMS_Content, CMS_ContinuousIntegration, CMS_CrossSiteTracking, CMS_CustomTables, CMS_DataProtection, CMS_Design, CMS_DocumentEngine, + CMS_EmailEngine, CMS_EmailLibrary, CMS_EmailTemplates, CMS_EventLog, CMS_Form, CMS_Globalization, CMS_GlobalPermissions, CMS_Licenses, CMS_Localization, CMS_MacroEngine, CMS_MediaDialog, + CMS_MediaLibrary, CMS_Membership, CMS_ModuleLicenses, CMS_OnlineMarketing, CMS_Permissions, CMS_Roles, CMS_ScheduledTasks, CMS_Search, CMS_Search_Azure, CMS_Staging, CMS_Synchronization, + CMS_UIPersonalization, CMS_Users, CMS_WebFarm, CMS_WorkflowEngine, CMS_WYSIWYGEditor, + }, StringComparer.InvariantCultureIgnoreCase); } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Helpers/ConsoleHelper.cs b/Migration.Toolkit.Common/Helpers/ConsoleHelper.cs index c184b8fa..d0104626 100644 --- a/Migration.Toolkit.Common/Helpers/ConsoleHelper.cs +++ b/Migration.Toolkit.Common/Helpers/ConsoleHelper.cs @@ -1,37 +1,37 @@ -namespace Migration.Toolkit.Common.Helpers; - -using System.Runtime.InteropServices; - -public static class ConsoleHelper -{ - const int STD_OUTPUT_HANDLE = -11; - const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4; - - [DllImport("kernel32.dll", SetLastError = true)] - static extern IntPtr GetStdHandle(int nStdHandle); - - [DllImport("kernel32.dll")] - static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode); - - [DllImport("kernel32.dll")] - static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode); - - public static void EnableVirtualTerminalProcessing() - { - var handle = GetStdHandle(STD_OUTPUT_HANDLE); - uint mode; - GetConsoleMode(handle, out mode); - mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; - SetConsoleMode(handle, mode); - } - - public const string RED = "\x1b[31m"; - public const string YELLOW = "\x1b[33m"; - public const string GREEN = "\x1b[32m"; - public const string RESET = "\x1b[0m"; - - public static string Yellow(string ctext) => $"{YELLOW}{ctext}{RESET}"; - public static string Green(string ctext) => $"{GREEN}{ctext}{RESET}"; - public static string Red(string ctext) => $"{RED}{ctext}{RESET}"; - +namespace Migration.Toolkit.Common.Helpers; + +using System.Runtime.InteropServices; + +public static class ConsoleHelper +{ + const int STD_OUTPUT_HANDLE = -11; + const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4; + + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr GetStdHandle(int nStdHandle); + + [DllImport("kernel32.dll")] + static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode); + + [DllImport("kernel32.dll")] + static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode); + + public static void EnableVirtualTerminalProcessing() + { + var handle = GetStdHandle(STD_OUTPUT_HANDLE); + uint mode; + GetConsoleMode(handle, out mode); + mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + SetConsoleMode(handle, mode); + } + + public const string RED = "\x1b[31m"; + public const string YELLOW = "\x1b[33m"; + public const string GREEN = "\x1b[32m"; + public const string RESET = "\x1b[0m"; + + public static string Yellow(string ctext) => $"{YELLOW}{ctext}{RESET}"; + public static string Green(string ctext) => $"{GREEN}{ctext}{RESET}"; + public static string Red(string ctext) => $"{RED}{ctext}{RESET}"; + } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Helpers/DeferrableItemEnumerableWrapper.cs b/Migration.Toolkit.Common/Helpers/DeferrableItemEnumerableWrapper.cs index 3e22d1ec..0033a28f 100644 --- a/Migration.Toolkit.Common/Helpers/DeferrableItemEnumerableWrapper.cs +++ b/Migration.Toolkit.Common/Helpers/DeferrableItemEnumerableWrapper.cs @@ -1,51 +1,51 @@ -using System.Runtime.CompilerServices; - -namespace Migration.Toolkit.Common.Helpers; - -public class DeferrableItemEnumerableWrapper(IEnumerable innerEnumerable, int maxRecurrenceLimit = 5) : IDisposable -{ - private readonly IEnumerator _innerEnumerator = innerEnumerable.GetEnumerator(); - - public record DeferrableItem(int Recurrence, T Item); - - private readonly Queue _deferredItems = new(); - - public bool GetNext(out DeferrableItem item) - { - if (_innerEnumerator.MoveNext()) - { - item = new DeferrableItem(0, _innerEnumerator.Current); - return true; - } - - if (_deferredItems.TryDequeue(out var deferred)) - { - item = deferred with - { - Recurrence = deferred.Recurrence + 1 - }; - return true; - } - - Unsafe.SkipInit(out item); - return false; - } - - public bool TryDeferItem(DeferrableItem item) - { - if (item.Recurrence < maxRecurrenceLimit) - { - _deferredItems.Enqueue(item); - return true; - } - else - { - return false; - } - } - - public void Dispose() - { - _innerEnumerator.Dispose(); - } +using System.Runtime.CompilerServices; + +namespace Migration.Toolkit.Common.Helpers; + +public class DeferrableItemEnumerableWrapper(IEnumerable innerEnumerable, int maxRecurrenceLimit = 5) : IDisposable +{ + private readonly IEnumerator _innerEnumerator = innerEnumerable.GetEnumerator(); + + public record DeferrableItem(int Recurrence, T Item); + + private readonly Queue _deferredItems = new(); + + public bool GetNext(out DeferrableItem item) + { + if (_innerEnumerator.MoveNext()) + { + item = new DeferrableItem(0, _innerEnumerator.Current); + return true; + } + + if (_deferredItems.TryDequeue(out var deferred)) + { + item = deferred with + { + Recurrence = deferred.Recurrence + 1 + }; + return true; + } + + Unsafe.SkipInit(out item); + return false; + } + + public bool TryDeferItem(DeferrableItem item) + { + if (item.Recurrence < maxRecurrenceLimit) + { + _deferredItems.Enqueue(item); + return true; + } + else + { + return false; + } + } + + public void Dispose() + { + _innerEnumerator.Dispose(); + } } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Helpers/UniqueTreePathProvider.cs b/Migration.Toolkit.Common/Helpers/UniqueTreePathProvider.cs index 22edc53b..0d953423 100644 --- a/Migration.Toolkit.Common/Helpers/UniqueTreePathProvider.cs +++ b/Migration.Toolkit.Common/Helpers/UniqueTreePathProvider.cs @@ -1,78 +1,78 @@ -namespace Migration.Toolkit.Common.Helpers; - -using CMS.ContentEngine.Internal; -using CMS.Websites.Internal; - -/// -/// Provides unique tree path. -/// -internal class UniqueTreePathProvider : UniqueStringValueProviderBase -{ - private readonly int websiteChannelId; - private readonly ITreePathValidator treePathValidator; - private readonly int maxTreePathSegmentLength; - - - /// - /// Creates a new instance of . - /// - /// Website channel ID. - /// Tree path validator. - /// Maximum length of whole tree path. Default to . - /// Maximum length of a tree path segment without '/'. Defaults to . - public UniqueTreePathProvider(int websiteChannelId, ITreePathValidator treePathValidator, int maxTreePathLength = TreePathConstants.MAX_PATH_LENGTH, - int maxTreePathSegmentLength = TreePathConstants.MAX_SLUG_LENGTH) - : base(maxTreePathLength) - { - this.websiteChannelId = websiteChannelId; - this.treePathValidator = treePathValidator; - this.maxTreePathSegmentLength = maxTreePathSegmentLength; - } - - - /// - protected override Task IsValueUnique(string value) - { - return treePathValidator.IsUnique(websiteChannelId, value); - } - - - /// - protected override string AddRandomSuffix(string source, string randomSuffix) - { - var lastSegment = TreePathUtils.GetLastPathSegment(source); - var lastSegmentWithSuffix = $"{lastSegment}{randomSuffix}"; - - var modifiedPath = $"{source}{randomSuffix}"; - - if (lastSegmentWithSuffix.Length > maxTreePathSegmentLength) - { - var pathWithoutLastSegment = TreePathUtils.RemoveLastPathSegment(source); - - var availableLastSegmentLength = maxTreePathSegmentLength - randomSuffix.Length; - - if (availableLastSegmentLength <= 0) - { - modifiedPath = $"{pathWithoutLastSegment}/{randomSuffix[1..maxTreePathSegmentLength]}"; - } - else - { - var modifiedLastSegment = (lastSegment.Length > availableLastSegmentLength) ? lastSegment[..availableLastSegmentLength] : lastSegment; - - modifiedPath = $"{pathWithoutLastSegment}/{modifiedLastSegment}{randomSuffix}"; - } - } - - return EnsureMaxTreePathLength(modifiedPath); - } - - - /// - /// Ensures path with random suffix does not exceeds tree path length limit. - /// - /// Path. - private string EnsureMaxTreePathLength(string path) - { - return path.Length > MaxLength ? path[..MaxLength] : path; - } +namespace Migration.Toolkit.Common.Helpers; + +using CMS.ContentEngine.Internal; +using CMS.Websites.Internal; + +/// +/// Provides unique tree path. +/// +internal class UniqueTreePathProvider : UniqueStringValueProviderBase +{ + private readonly int websiteChannelId; + private readonly ITreePathValidator treePathValidator; + private readonly int maxTreePathSegmentLength; + + + /// + /// Creates a new instance of . + /// + /// Website channel ID. + /// Tree path validator. + /// Maximum length of whole tree path. Default to . + /// Maximum length of a tree path segment without '/'. Defaults to . + public UniqueTreePathProvider(int websiteChannelId, ITreePathValidator treePathValidator, int maxTreePathLength = TreePathConstants.MAX_PATH_LENGTH, + int maxTreePathSegmentLength = TreePathConstants.MAX_SLUG_LENGTH) + : base(maxTreePathLength) + { + this.websiteChannelId = websiteChannelId; + this.treePathValidator = treePathValidator; + this.maxTreePathSegmentLength = maxTreePathSegmentLength; + } + + + /// + protected override Task IsValueUnique(string value) + { + return treePathValidator.IsUnique(websiteChannelId, value); + } + + + /// + protected override string AddRandomSuffix(string source, string randomSuffix) + { + var lastSegment = TreePathUtils.GetLastPathSegment(source); + var lastSegmentWithSuffix = $"{lastSegment}{randomSuffix}"; + + var modifiedPath = $"{source}{randomSuffix}"; + + if (lastSegmentWithSuffix.Length > maxTreePathSegmentLength) + { + var pathWithoutLastSegment = TreePathUtils.RemoveLastPathSegment(source); + + var availableLastSegmentLength = maxTreePathSegmentLength - randomSuffix.Length; + + if (availableLastSegmentLength <= 0) + { + modifiedPath = $"{pathWithoutLastSegment}/{randomSuffix[1..maxTreePathSegmentLength]}"; + } + else + { + var modifiedLastSegment = (lastSegment.Length > availableLastSegmentLength) ? lastSegment[..availableLastSegmentLength] : lastSegment; + + modifiedPath = $"{pathWithoutLastSegment}/{modifiedLastSegment}{randomSuffix}"; + } + } + + return EnsureMaxTreePathLength(modifiedPath); + } + + + /// + /// Ensures path with random suffix does not exceeds tree path length limit. + /// + /// Path. + private string EnsureMaxTreePathLength(string path) + { + return path.Length > MaxLength ? path[..MaxLength] : path; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Helpers/VersionHelper.cs b/Migration.Toolkit.Common/Helpers/VersionHelper.cs index b6516a3b..2d1f519e 100644 --- a/Migration.Toolkit.Common/Helpers/VersionHelper.cs +++ b/Migration.Toolkit.Common/Helpers/VersionHelper.cs @@ -1,17 +1,17 @@ -namespace Migration.Toolkit.Common.Helpers; - -using Microsoft.Data.SqlClient; - -public static class VersionHelper -{ - public static SemanticVersion? GetInstanceVersion(SqlConnection connection) - { - using var cmd = connection.CreateCommand(); - cmd.CommandText = "SELECT KeyValue FROM CMS_SettingsKey WHERE KeyName = N'CMSDBVersion'"; - var result = cmd.ExecuteScalar() as string; - - return SemanticVersion.TryParse(result, out var semanticVersion) - ? semanticVersion - : null; - } +namespace Migration.Toolkit.Common.Helpers; + +using Microsoft.Data.SqlClient; + +public static class VersionHelper +{ + public static SemanticVersion? GetInstanceVersion(SqlConnection connection) + { + using var cmd = connection.CreateCommand(); + cmd.CommandText = "SELECT KeyValue FROM CMS_SettingsKey WHERE KeyName = N'CMSDBVersion'"; + var result = cmd.ExecuteScalar() as string; + + return SemanticVersion.TryParse(result, out var semanticVersion) + ? semanticVersion + : null; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Common/OptInFeatures.cs b/Migration.Toolkit.Common/OptInFeatures.cs index 681fba87..881ad941 100644 --- a/Migration.Toolkit.Common/OptInFeatures.cs +++ b/Migration.Toolkit.Common/OptInFeatures.cs @@ -1,57 +1,57 @@ -namespace Migration.Toolkit.Common; - -using System.Text.Json.Serialization; -using Microsoft.Extensions.Configuration; - -// ReSharper disable once ClassNeverInstantiated.Global -public class OptInFeatures -{ - [ConfigurationKeyName(ConfigurationNames.QuerySourceInstanceApi)] - public AdvancedFeatureQuerySourceInstanceApi? QuerySourceInstanceApi { get; set; } - - [ConfigurationKeyName(ConfigurationNames.CustomMigration)] - public CustomMigrationModel? CustomMigration { get; set; } -} - -// ReSharper disable once ClassNeverInstantiated.Global -public class AdvancedFeatureQuerySourceInstanceApi -{ - [ConfigurationKeyName(ConfigurationNames.Enabled)] - public bool Enabled { get; set; } = false; - - [ConfigurationKeyName(ConfigurationNames.Connections)] - public List Connections { get; set; } = new(); -} - -// ReSharper disable once ClassNeverInstantiated.Global -public class SourceInstanceInfo -{ - [ConfigurationKeyName(ConfigurationNames.SourceInstanceUri)] - public Uri? SourceInstanceUri { get; set; } = null!; - - [ConfigurationKeyName(ConfigurationNames.Secret)] - public string Secret { get; set; } = null!; -} - -// ReSharper disable once ClassNeverInstantiated.Global -public class FieldMigrationSerializable -{ - [ConfigurationKeyName(ConfigurationNames.SourceDataType)] - public string? SourceDataType { get; set; } - [ConfigurationKeyName(ConfigurationNames.TargetDataType)] - public string? TargetDataType { get; set; } - [ConfigurationKeyName(ConfigurationNames.SourceFormControl)] - public string? SourceFormControl { get; set; } - [ConfigurationKeyName(ConfigurationNames.TargetFormComponent)] - public string? TargetFormComponent { get; set; } - [ConfigurationKeyName(ConfigurationNames.Actions)] - public string[]? Actions { get; set; } - [ConfigurationKeyName(ConfigurationNames.FieldNameRegex)] - public string? FieldNameRegex { get; set; } -} - -// ReSharper disable once ClassNeverInstantiated.Global -public class CustomMigrationModel -{ - public FieldMigrationSerializable[]? FieldMigrations { get; set; } +namespace Migration.Toolkit.Common; + +using System.Text.Json.Serialization; +using Microsoft.Extensions.Configuration; + +// ReSharper disable once ClassNeverInstantiated.Global +public class OptInFeatures +{ + [ConfigurationKeyName(ConfigurationNames.QuerySourceInstanceApi)] + public AdvancedFeatureQuerySourceInstanceApi? QuerySourceInstanceApi { get; set; } + + [ConfigurationKeyName(ConfigurationNames.CustomMigration)] + public CustomMigrationModel? CustomMigration { get; set; } +} + +// ReSharper disable once ClassNeverInstantiated.Global +public class AdvancedFeatureQuerySourceInstanceApi +{ + [ConfigurationKeyName(ConfigurationNames.Enabled)] + public bool Enabled { get; set; } = false; + + [ConfigurationKeyName(ConfigurationNames.Connections)] + public List Connections { get; set; } = new(); +} + +// ReSharper disable once ClassNeverInstantiated.Global +public class SourceInstanceInfo +{ + [ConfigurationKeyName(ConfigurationNames.SourceInstanceUri)] + public Uri? SourceInstanceUri { get; set; } = null!; + + [ConfigurationKeyName(ConfigurationNames.Secret)] + public string Secret { get; set; } = null!; +} + +// ReSharper disable once ClassNeverInstantiated.Global +public class FieldMigrationSerializable +{ + [ConfigurationKeyName(ConfigurationNames.SourceDataType)] + public string? SourceDataType { get; set; } + [ConfigurationKeyName(ConfigurationNames.TargetDataType)] + public string? TargetDataType { get; set; } + [ConfigurationKeyName(ConfigurationNames.SourceFormControl)] + public string? SourceFormControl { get; set; } + [ConfigurationKeyName(ConfigurationNames.TargetFormComponent)] + public string? TargetFormComponent { get; set; } + [ConfigurationKeyName(ConfigurationNames.Actions)] + public string[]? Actions { get; set; } + [ConfigurationKeyName(ConfigurationNames.FieldNameRegex)] + public string? FieldNameRegex { get; set; } +} + +// ReSharper disable once ClassNeverInstantiated.Global +public class CustomMigrationModel +{ + public FieldMigrationSerializable[]? FieldMigrations { get; set; } } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Services/BulkCopy/FilteredDbDataReader.cs b/Migration.Toolkit.Common/Services/BulkCopy/FilteredDbDataReader.cs index e21cc266..d1ac02c8 100644 --- a/Migration.Toolkit.Common/Services/BulkCopy/FilteredDbDataReader.cs +++ b/Migration.Toolkit.Common/Services/BulkCopy/FilteredDbDataReader.cs @@ -1,30 +1,30 @@ -namespace Migration.Toolkit.Common.Services.BulkCopy; - -using System.Data; - -public class FilteredDbDataReader(IDataReader innerReader, Func includePredicate) : DataReaderProxyBase(innerReader) - where TReader : IDataReader -{ - public int TotalItems { get; private set; } = 0; - public int TotalNonFiltered { get; private set; } = 0; - - public override bool Read() - { - while (true) - { - if (base.Read()) - { - TotalItems++; - if (!includePredicate(_innerReader)) - { - continue; - } - - TotalNonFiltered++; - return true; - } - - return false; - } - } +namespace Migration.Toolkit.Common.Services.BulkCopy; + +using System.Data; + +public class FilteredDbDataReader(IDataReader innerReader, Func includePredicate) : DataReaderProxyBase(innerReader) + where TReader : IDataReader +{ + public int TotalItems { get; private set; } = 0; + public int TotalNonFiltered { get; private set; } = 0; + + public override bool Read() + { + while (true) + { + if (base.Read()) + { + TotalItems++; + if (!includePredicate(_innerReader)) + { + continue; + } + + TotalNonFiltered++; + return true; + } + + return false; + } + } } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Services/ICommandParser.cs b/Migration.Toolkit.Common/Services/ICommandParser.cs index f98f2a55..d436763d 100644 --- a/Migration.Toolkit.Common/Services/ICommandParser.cs +++ b/Migration.Toolkit.Common/Services/ICommandParser.cs @@ -1,8 +1,8 @@ -namespace Migration.Toolkit.Common.Services; - -using Migration.Toolkit.Common.Abstractions; - -public interface ICommandParser -{ - List Parse(Queue args, ref bool bypassDependencyCheck, bool firstHaveToBeMigrate = true); +namespace Migration.Toolkit.Common.Services; + +using Migration.Toolkit.Common.Abstractions; + +public interface ICommandParser +{ + List Parse(Queue args, ref bool bypassDependencyCheck, bool firstHaveToBeMigrate = true); } \ No newline at end of file diff --git a/Migration.Toolkit.Common/Services/IPrintService.cs b/Migration.Toolkit.Common/Services/IPrintService.cs index bc5ed1ac..a84d783b 100644 --- a/Migration.Toolkit.Common/Services/IPrintService.cs +++ b/Migration.Toolkit.Common/Services/IPrintService.cs @@ -1,9 +1,9 @@ -namespace Migration.Toolkit.Common.Services; - -public interface IPrintService -{ - string PrintKxpModelInfo(T model); - string GetEntityIdentityPrint(T model, bool printType = true); - string GetEntityIdentityPrints(IEnumerable models, string separator = "|"); - string PrintEnumValues(string separator) where TEnum : struct, Enum; +namespace Migration.Toolkit.Common.Services; + +public interface IPrintService +{ + string PrintKxpModelInfo(T model); + string GetEntityIdentityPrint(T model, bool printType = true); + string GetEntityIdentityPrints(IEnumerable models, string separator = "|"); + string PrintEnumValues(string separator) where TEnum : struct, Enum; } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Exceptions.cs b/Migration.Toolkit.Core.K11/Exceptions.cs index 6be5fb37..8e272ff5 100644 --- a/Migration.Toolkit.Core.K11/Exceptions.cs +++ b/Migration.Toolkit.Core.K11/Exceptions.cs @@ -1,7 +1,7 @@ -namespace Migration.Toolkit.Core.K11; - -public class MappingFailureException(string keyName, string reason) : InvalidOperationException($"Key '{keyName}' mapping failed: {reason}") -{ - public string KeyName { get; } = keyName; - public string Reason { get; } = reason; +namespace Migration.Toolkit.Core.K11; + +public class MappingFailureException(string keyName, string reason) : InvalidOperationException($"Key '{keyName}' mapping failed: {reason}") +{ + public string KeyName { get; } = keyName; + public string Reason { get; } = reason; } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/GlobalUsings.cs b/Migration.Toolkit.Core.K11/GlobalUsings.cs index 459e2d71..1d1f2495 100644 --- a/Migration.Toolkit.Core.K11/GlobalUsings.cs +++ b/Migration.Toolkit.Core.K11/GlobalUsings.cs @@ -1,2 +1,2 @@ -global using System; +global using System; global using Migration.Toolkit; \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Helpers/PrintHelper.cs b/Migration.Toolkit.Core.K11/Helpers/PrintHelper.cs index 4ede1909..481f631b 100644 --- a/Migration.Toolkit.Core.K11/Helpers/PrintHelper.cs +++ b/Migration.Toolkit.Core.K11/Helpers/PrintHelper.cs @@ -1,7 +1,7 @@ -namespace Migration.Toolkit.Core.K11.Helpers; - -public static class PrintHelper -{ - public static string PrintDictionary(Dictionary dictionary) => - string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); +namespace Migration.Toolkit.Core.K11.Helpers; + +public static class PrintHelper +{ + public static string PrintDictionary(Dictionary dictionary) => + string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Mappers/AlternativeFormMapper.cs b/Migration.Toolkit.Core.K11/Mappers/AlternativeFormMapper.cs index 6914eff8..15f9c7ef 100644 --- a/Migration.Toolkit.Core.K11/Mappers/AlternativeFormMapper.cs +++ b/Migration.Toolkit.Core.K11/Mappers/AlternativeFormMapper.cs @@ -1,89 +1,89 @@ -namespace Migration.Toolkit.Core.K11.Mappers; - -using CMS.DataEngine; -using CMS.FormEngine; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.Enumerations; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.Core.K11.Services; -using Migration.Toolkit.K11.Models; -using Migration.Toolkit.KXP.Api.Services.CmsClass; - -public record AlternativeFormMapperSource(CmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); - -public class AlternativeFormMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol, FieldMigrationService fieldMigrationService) - : EntityMapperBase(logger, pkContext, protocol) -{ - protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) - => AlternativeFormInfo.New(); - - protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - var (source, xbkFormClass) = sourceObj; - - target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormClassId, out var classId) - ? classId ?? 0 - : 0; - target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormCoupledClassId, out var coupledClassId) - ? coupledClassId ?? 0 - : 0; - - var coupledClassIsDeprecated = - source.FormCoupledClass?.ClassName is { } coupledClassName && - K12SystemClass.NoLongerSupported.Contains(coupledClassName); - - var classIsSysInternal = K12SystemClass.All.Contains(source.FormClass.ClassName); - - var mergedDefinition = source.FormClass.ClassFormDefinition; - if (source.FormCoupledClass != null) - { - logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", source.FormCoupledClass.ClassName, source.FormClass.ClassName); - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormCoupledClass.ClassFormDefinition); - } - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); - - var patcher = new FormDefinitionPatcher( - logger, - mergedDefinition, - fieldMigrationService, - source.FormClass.ClassIsForm.GetValueOrDefault(false), - source.FormClass.ClassIsDocumentType, - false, - !classIsSysInternal, - true - ); - - var fieldNames = patcher.GetFieldNames().ToList(); - logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); - - patcher.PatchFields(); - - var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); - logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); - - if (coupledClassIsDeprecated && source.FormCoupledClass != null) - { - logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", source.FormCoupledClass.ClassName); - patcher.RemoveFields(source.FormCoupledClass.ClassFormDefinition); - - var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); - logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); - } - - var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); - - var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); - - target.FormDefinition = formDefinitionDifference; - - target.FormDisplayName = source.FormDisplayName; - target.FormGUID = source.FormGuid; - target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); - target.FormLastModified = source.FormLastModified; - target.FormName = source.FormName; - - return target; - } +namespace Migration.Toolkit.Core.K11.Mappers; + +using CMS.DataEngine; +using CMS.FormEngine; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.Enumerations; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.Core.K11.Services; +using Migration.Toolkit.K11.Models; +using Migration.Toolkit.KXP.Api.Services.CmsClass; + +public record AlternativeFormMapperSource(CmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); + +public class AlternativeFormMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol, FieldMigrationService fieldMigrationService) + : EntityMapperBase(logger, pkContext, protocol) +{ + protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) + => AlternativeFormInfo.New(); + + protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + var (source, xbkFormClass) = sourceObj; + + target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormClassId, out var classId) + ? classId ?? 0 + : 0; + target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormCoupledClassId, out var coupledClassId) + ? coupledClassId ?? 0 + : 0; + + var coupledClassIsDeprecated = + source.FormCoupledClass?.ClassName is { } coupledClassName && + K12SystemClass.NoLongerSupported.Contains(coupledClassName); + + var classIsSysInternal = K12SystemClass.All.Contains(source.FormClass.ClassName); + + var mergedDefinition = source.FormClass.ClassFormDefinition; + if (source.FormCoupledClass != null) + { + logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", source.FormCoupledClass.ClassName, source.FormClass.ClassName); + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormCoupledClass.ClassFormDefinition); + } + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); + + var patcher = new FormDefinitionPatcher( + logger, + mergedDefinition, + fieldMigrationService, + source.FormClass.ClassIsForm.GetValueOrDefault(false), + source.FormClass.ClassIsDocumentType, + false, + !classIsSysInternal, + true + ); + + var fieldNames = patcher.GetFieldNames().ToList(); + logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); + + patcher.PatchFields(); + + var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); + logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); + + if (coupledClassIsDeprecated && source.FormCoupledClass != null) + { + logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", source.FormCoupledClass.ClassName); + patcher.RemoveFields(source.FormCoupledClass.ClassFormDefinition); + + var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); + logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); + } + + var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); + + var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); + + target.FormDefinition = formDefinitionDifference; + + target.FormDisplayName = source.FormDisplayName; + target.FormGUID = source.FormGuid; + target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); + target.FormLastModified = source.FormLastModified; + target.FormName = source.FormName; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Mappers/CmsAttachmentMapper.cs b/Migration.Toolkit.Core.K11/Mappers/CmsAttachmentMapper.cs index 966126a4..802ef8d2 100644 --- a/Migration.Toolkit.Core.K11/Mappers/CmsAttachmentMapper.cs +++ b/Migration.Toolkit.Core.K11/Mappers/CmsAttachmentMapper.cs @@ -1,55 +1,55 @@ -namespace Migration.Toolkit.Core.K11.Mappers; - -using CMS.Base; -using CMS.MediaLibrary; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.Core.K11.Helpers; -using Migration.Toolkit.K11.Models; - -public record CmsAttachmentMapperSource(CmsAttachment Attachment, int TargetLibraryId, IUploadedFile File, string LibrarySubFolder, - CmsDocument? AttachmentDocument); - -public class CmsAttachmentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) -{ - private const string LegacyOriginalPath = "__LegacyOriginalPath"; - - protected override MediaFileInfo? CreateNewInstance(CmsAttachmentMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) - { - // library name is generated with site name in it - return new MediaFileInfo(source.File, source.TargetLibraryId, source.LibrarySubFolder, 0, 0, 0); - } - - protected override MediaFileInfo MapInternal(CmsAttachmentMapperSource args, MediaFileInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - var (cmsAttachment, targetLibraryId, _, _, attachmentDocument) = args; - - target.FileName = Path.GetFileNameWithoutExtension(cmsAttachment.AttachmentName); - target.FileTitle = cmsAttachment.AttachmentTitle ?? cmsAttachment.AttachmentName; - target.FileDescription = cmsAttachment.AttachmentDescription ?? string.Empty; - target.FileExtension = cmsAttachment.AttachmentExtension; - target.FileMimeType = cmsAttachment.AttachmentMimeType; - target.FileSize = cmsAttachment.AttachmentSize; - target.FileImageWidth = cmsAttachment.AttachmentImageWidth ?? 0; - target.FileImageHeight = cmsAttachment.AttachmentImageHeight ?? 0; - target.FileGUID = cmsAttachment.AttachmentGuid; - target.FileLibraryID = targetLibraryId; - - // target.FileCreatedByUserID = cmsAttachment.?; - // target.FileModifiedByUserID = cmsAttachment.?; - // target.FileCreatedWhen = cmsAttachment.?; - - target.FileModifiedWhen = cmsAttachment.AttachmentLastModified; - - KenticoHelper.CopyCustomData(target.FileCustomData, cmsAttachment.AttachmentCustomData); - - if (attachmentDocument != null) - { - target.FileCustomData.SetValue(LegacyOriginalPath, attachmentDocument.DocumentNode.NodeAliasPath); - } - - return target; - } +namespace Migration.Toolkit.Core.K11.Mappers; + +using CMS.Base; +using CMS.MediaLibrary; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.Core.K11.Helpers; +using Migration.Toolkit.K11.Models; + +public record CmsAttachmentMapperSource(CmsAttachment Attachment, int TargetLibraryId, IUploadedFile File, string LibrarySubFolder, + CmsDocument? AttachmentDocument); + +public class CmsAttachmentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) +{ + private const string LEGACY_ORIGINAL_PATH = "__LegacyOriginalPath"; + + protected override MediaFileInfo? CreateNewInstance(CmsAttachmentMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) + { + // library name is generated with site name in it + return new MediaFileInfo(source.File, source.TargetLibraryId, source.LibrarySubFolder, 0, 0, 0); + } + + protected override MediaFileInfo MapInternal(CmsAttachmentMapperSource args, MediaFileInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + var (cmsAttachment, targetLibraryId, _, _, attachmentDocument) = args; + + target.FileName = Path.GetFileNameWithoutExtension(cmsAttachment.AttachmentName); + target.FileTitle = cmsAttachment.AttachmentTitle ?? cmsAttachment.AttachmentName; + target.FileDescription = cmsAttachment.AttachmentDescription ?? string.Empty; + target.FileExtension = cmsAttachment.AttachmentExtension; + target.FileMimeType = cmsAttachment.AttachmentMimeType; + target.FileSize = cmsAttachment.AttachmentSize; + target.FileImageWidth = cmsAttachment.AttachmentImageWidth ?? 0; + target.FileImageHeight = cmsAttachment.AttachmentImageHeight ?? 0; + target.FileGUID = cmsAttachment.AttachmentGuid; + target.FileLibraryID = targetLibraryId; + + // target.FileCreatedByUserID = cmsAttachment.?; + // target.FileModifiedByUserID = cmsAttachment.?; + // target.FileCreatedWhen = cmsAttachment.?; + + target.FileModifiedWhen = cmsAttachment.AttachmentLastModified; + + KenticoHelper.CopyCustomData(target.FileCustomData, cmsAttachment.AttachmentCustomData); + + if (attachmentDocument != null) + { + target.FileCustomData.SetValue(LEGACY_ORIGINAL_PATH, attachmentDocument.DocumentNode.NodeAliasPath); + } + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Mappers/CountryInfoMapper.cs b/Migration.Toolkit.Core.K11/Mappers/CountryInfoMapper.cs index 22c1cbd2..73405d49 100644 --- a/Migration.Toolkit.Core.K11/Mappers/CountryInfoMapper.cs +++ b/Migration.Toolkit.Core.K11/Mappers/CountryInfoMapper.cs @@ -1,25 +1,25 @@ -namespace Migration.Toolkit.Core.K11.Mappers; - -using CMS.Globalization; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.K11.Models; - -public class CountryInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) -{ - protected override CountryInfo? CreateNewInstance(CmsCountry source, MappingHelper mappingHelper, AddFailure addFailure) - => CountryInfo.New(); - - protected override CountryInfo MapInternal(CmsCountry source, CountryInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.CountryName = source.CountryName; - target.CountryDisplayName = source.CountryDisplayName; - target.CountryGUID = source.CountryGuid; - target.CountryLastModified = source.CountryLastModified; - target.CountryThreeLetterCode = source.CountryThreeLetterCode; - target.CountryTwoLetterCode = source.CountryTwoLetterCode; - return target; - } +namespace Migration.Toolkit.Core.K11.Mappers; + +using CMS.Globalization; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.K11.Models; + +public class CountryInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) +{ + protected override CountryInfo? CreateNewInstance(CmsCountry source, MappingHelper mappingHelper, AddFailure addFailure) + => CountryInfo.New(); + + protected override CountryInfo MapInternal(CmsCountry source, CountryInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + target.CountryName = source.CountryName; + target.CountryDisplayName = source.CountryDisplayName; + target.CountryGUID = source.CountryGuid; + target.CountryLastModified = source.CountryLastModified; + target.CountryThreeLetterCode = source.CountryThreeLetterCode; + target.CountryTwoLetterCode = source.CountryTwoLetterCode; + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Mappers/OmContactGroupMapper.cs b/Migration.Toolkit.Core.K11/Mappers/OmContactGroupMapper.cs index c1c0afe6..bb9f8927 100644 --- a/Migration.Toolkit.Core.K11/Mappers/OmContactGroupMapper.cs +++ b/Migration.Toolkit.Core.K11/Mappers/OmContactGroupMapper.cs @@ -1,30 +1,30 @@ -namespace Migration.Toolkit.Core.K11.Mappers; - -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.KXP.Models; - -public class OmContactGroupMapper(ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) -{ - protected override OmContactGroup? CreateNewInstance(Toolkit.K11.Models.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override OmContactGroup MapInternal(Toolkit.K11.Models.OmContactGroup source, OmContactGroup target, bool newInstance, - MappingHelper mappingHelper, AddFailure addFailure) - { - target.ContactGroupName = source.ContactGroupName; - target.ContactGroupDisplayName = source.ContactGroupDisplayName; - target.ContactGroupDescription = source.ContactGroupDescription; - target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; - target.ContactGroupEnabled = source.ContactGroupEnabled; - target.ContactGroupLastModified = source.ContactGroupLastModified; - target.ContactGroupGuid = source.ContactGroupGuid; - target.ContactGroupStatus = source.ContactGroupStatus; - - return target; - } +namespace Migration.Toolkit.Core.K11.Mappers; + +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.KXP.Models; + +public class OmContactGroupMapper(ILogger logger, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol) + : EntityMapperBase(logger, primaryKeyMappingContext, protocol) +{ + protected override OmContactGroup? CreateNewInstance(Toolkit.K11.Models.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); + + protected override OmContactGroup MapInternal(Toolkit.K11.Models.OmContactGroup source, OmContactGroup target, bool newInstance, + MappingHelper mappingHelper, AddFailure addFailure) + { + target.ContactGroupName = source.ContactGroupName; + target.ContactGroupDisplayName = source.ContactGroupDisplayName; + target.ContactGroupDescription = source.ContactGroupDescription; + target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; + target.ContactGroupEnabled = source.ContactGroupEnabled; + target.ContactGroupLastModified = source.ContactGroupLastModified; + target.ContactGroupGuid = source.ContactGroupGuid; + target.ContactGroupStatus = source.ContactGroupStatus; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Mappers/OmContactStatusMapper.cs b/Migration.Toolkit.Core.K11/Mappers/OmContactStatusMapper.cs index 0d74aeb2..68f46d59 100644 --- a/Migration.Toolkit.Core.K11/Mappers/OmContactStatusMapper.cs +++ b/Migration.Toolkit.Core.K11/Mappers/OmContactStatusMapper.cs @@ -1,26 +1,26 @@ -namespace Migration.Toolkit.Core.K11.Mappers; - -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.KXP.Models; - -public class OmContactStatusMapper(ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) -{ - protected override OmContactStatus? CreateNewInstance(Toolkit.K11.Models.OmContactStatus tSourceEntity, MappingHelper mappingHelper, - AddFailure addFailure) => new(); - - protected override OmContactStatus MapInternal(Toolkit.K11.Models.OmContactStatus source, OmContactStatus target, bool newInstance, - MappingHelper mappingHelper, AddFailure addFailure) - { - target.ContactStatusName = source.ContactStatusName; - target.ContactStatusDisplayName = source.ContactStatusDisplayName; - target.ContactStatusDescription = source.ContactStatusDescription; - - return target; - } +namespace Migration.Toolkit.Core.K11.Mappers; + +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.KXP.Models; + +public class OmContactStatusMapper(ILogger logger, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol) + : EntityMapperBase(logger, primaryKeyMappingContext, protocol) +{ + protected override OmContactStatus? CreateNewInstance(Toolkit.K11.Models.OmContactStatus tSourceEntity, MappingHelper mappingHelper, + AddFailure addFailure) => new(); + + protected override OmContactStatus MapInternal(Toolkit.K11.Models.OmContactStatus source, OmContactStatus target, bool newInstance, + MappingHelper mappingHelper, AddFailure addFailure) + { + target.ContactStatusName = source.ContactStatusName; + target.ContactStatusDisplayName = source.ContactStatusDisplayName; + target.ContactStatusDescription = source.ContactStatusDescription; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Mappers/StateInfoMapper.cs b/Migration.Toolkit.Core.K11/Mappers/StateInfoMapper.cs index 3cfcb914..9aadaebb 100644 --- a/Migration.Toolkit.Core.K11/Mappers/StateInfoMapper.cs +++ b/Migration.Toolkit.Core.K11/Mappers/StateInfoMapper.cs @@ -1,30 +1,30 @@ -namespace Migration.Toolkit.Core.K11.Mappers; - -using CMS.Globalization; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.K11.Models; - -public class StateInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) -{ - protected override StateInfo? CreateNewInstance(CmsState source, MappingHelper mappingHelper, AddFailure addFailure) - => StateInfo.New(); - - protected override StateInfo MapInternal(CmsState source, StateInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.StateName = source.StateName; - target.StateDisplayName = source.StateDisplayName; - target.StateLastModified = source.StateLastModified; - target.StateGUID = source.StateGuid; - target.StateCode = source.StateCode; - - if (mappingHelper.TranslateRequiredId(k => k.CountryId, source.CountryId, out var countryId)) - { - target.CountryID = countryId; - } - - return target; - } +namespace Migration.Toolkit.Core.K11.Mappers; + +using CMS.Globalization; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.K11.Models; + +public class StateInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) +{ + protected override StateInfo? CreateNewInstance(CmsState source, MappingHelper mappingHelper, AddFailure addFailure) + => StateInfo.New(); + + protected override StateInfo MapInternal(CmsState source, StateInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + target.StateName = source.StateName; + target.StateDisplayName = source.StateDisplayName; + target.StateLastModified = source.StateLastModified; + target.StateGUID = source.StateGuid; + target.StateCode = source.StateCode; + + if (mappingHelper.TranslateRequiredId(k => k.CountryId, source.CountryId, out var countryId)) + { + target.CountryID = countryId; + } + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Mappers/UserRoleInfoMapper.cs b/Migration.Toolkit.Core.K11/Mappers/UserRoleInfoMapper.cs index f9622023..bbad5140 100644 --- a/Migration.Toolkit.Core.K11/Mappers/UserRoleInfoMapper.cs +++ b/Migration.Toolkit.Core.K11/Mappers/UserRoleInfoMapper.cs @@ -1,29 +1,29 @@ -namespace Migration.Toolkit.Core.K11.Mappers; - -using CMS.Membership; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.K11.Models; - -public class UserRoleInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) -{ - protected override UserRoleInfo? CreateNewInstance(CmsUserRole source, MappingHelper mappingHelper, AddFailure addFailure) - => UserRoleInfo.New(); - - protected override UserRoleInfo MapInternal(CmsUserRole source, UserRoleInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - if (mappingHelper.TranslateRequiredId(r => r.RoleId, source.RoleId, out var xbkRoleId)) - { - target.RoleID = xbkRoleId; - } - - if (mappingHelper.TranslateRequiredId(r => r.UserId, source.UserId, out var xbkUserId)) - { - target.UserID = xbkUserId; - } - - return target; - } +namespace Migration.Toolkit.Core.K11.Mappers; + +using CMS.Membership; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.K11.Models; + +public class UserRoleInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) +{ + protected override UserRoleInfo? CreateNewInstance(CmsUserRole source, MappingHelper mappingHelper, AddFailure addFailure) + => UserRoleInfo.New(); + + protected override UserRoleInfo MapInternal(CmsUserRole source, UserRoleInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + if (mappingHelper.TranslateRequiredId(r => r.RoleId, source.RoleId, out var xbkRoleId)) + { + target.RoleID = xbkRoleId; + } + + if (mappingHelper.TranslateRequiredId(r => r.UserId, source.UserId, out var xbkUserId)) + { + target.UserID = xbkUserId; + } + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Providers/ContentItemNameValidator.cs b/Migration.Toolkit.Core.K11/Providers/ContentItemNameValidator.cs index b43429d2..36b8cfcb 100644 --- a/Migration.Toolkit.Core.K11/Providers/ContentItemNameValidator.cs +++ b/Migration.Toolkit.Core.K11/Providers/ContentItemNameValidator.cs @@ -1,25 +1,25 @@ -namespace Migration.Toolkit.Core.K11.Providers; - -using CMS.ContentEngine.Internal; - -internal class ContentItemNameValidator : IContentItemNameValidator -{ - /// - public bool IsUnique(string name) - { - return IsUnique(0, name); - } - - - /// - public bool IsUnique(int id, string name) - { - var contentItemInfo = new ContentItemInfo() - { - ContentItemID = id, - ContentItemName = name, - }; - - return contentItemInfo.CheckUniqueCodeName(); - } +namespace Migration.Toolkit.Core.K11.Providers; + +using CMS.ContentEngine.Internal; + +internal class ContentItemNameValidator : IContentItemNameValidator +{ + /// + public bool IsUnique(string name) + { + return IsUnique(0, name); + } + + + /// + public bool IsUnique(int id, string name) + { + var contentItemInfo = new ContentItemInfo() + { + ContentItemID = id, + ContentItemName = name, + }; + + return contentItemInfo.CheckUniqueCodeName(); + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Providers/UniqueContentItemNameProvider.cs b/Migration.Toolkit.Core.K11/Providers/UniqueContentItemNameProvider.cs index d79d925d..c7a968f3 100644 --- a/Migration.Toolkit.Core.K11/Providers/UniqueContentItemNameProvider.cs +++ b/Migration.Toolkit.Core.K11/Providers/UniqueContentItemNameProvider.cs @@ -1,48 +1,48 @@ -namespace Migration.Toolkit.Core.K11.Providers; - -using System.Threading.Tasks; -using CMS.Base; -using CMS.ContentEngine.Internal; - -internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase -{ - private readonly IContentItemNameValidator codeNameValidator; - - - /// - /// Creates a new instance of . - /// - public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) - : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) - { - this.codeNameValidator = codeNameValidator; - } - - public override Task GetUniqueValue(string inputValue) - { - return base.GetUniqueValue(AddSuffix(inputValue)); - } - - - private string AddSuffix(string codeName) - { - var randomSuffix = GetRandomSuffix(); - var codeNameWithSuffix = codeName += randomSuffix; - - if (codeNameWithSuffix.Length > MaxLength) - { - var availableLength = MaxLength - randomSuffix.Length; - - codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; - } - - return codeNameWithSuffix; - } - - - /// - protected override Task IsValueUnique(string value) - { - return Task.FromResult(codeNameValidator.IsUnique(value)); - } +namespace Migration.Toolkit.Core.K11.Providers; + +using System.Threading.Tasks; +using CMS.Base; +using CMS.ContentEngine.Internal; + +internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase +{ + private readonly IContentItemNameValidator codeNameValidator; + + + /// + /// Creates a new instance of . + /// + public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) + : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) + { + this.codeNameValidator = codeNameValidator; + } + + public override Task GetUniqueValue(string inputValue) + { + return base.GetUniqueValue(AddSuffix(inputValue)); + } + + + private string AddSuffix(string codeName) + { + var randomSuffix = GetRandomSuffix(); + var codeNameWithSuffix = codeName += randomSuffix; + + if (codeNameWithSuffix.Length > MaxLength) + { + var availableLength = MaxLength - randomSuffix.Length; + + codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; + } + + return codeNameWithSuffix; + } + + + /// + protected override Task IsValueUnique(string value) + { + return Task.FromResult(codeNameValidator.IsUnique(value)); + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Services/CmsClass/AttachmentSelectorItem.cs b/Migration.Toolkit.Core.K11/Services/CmsClass/AttachmentSelectorItem.cs index ac02088e..4f03240e 100644 --- a/Migration.Toolkit.Core.K11/Services/CmsClass/AttachmentSelectorItem.cs +++ b/Migration.Toolkit.Core.K11/Services/CmsClass/AttachmentSelectorItem.cs @@ -1,11 +1,11 @@ -namespace Migration.Toolkit.Core.K11.Services.CmsClass; - -using Newtonsoft.Json; - -/// Represents an item for the attachment selector. -public class AttachmentSelectorItem -{ - /// Attachment GUID. - [JsonProperty("fileGuid")] - public Guid FileGuid { get; set; } +namespace Migration.Toolkit.Core.K11.Services.CmsClass; + +using Newtonsoft.Json; + +/// Represents an item for the attachment selector. +public class AttachmentSelectorItem +{ + /// Attachment GUID. + [JsonProperty("fileGuid")] + public Guid FileGuid { get; set; } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.K11/Services/CountryMigrator.cs b/Migration.Toolkit.Core.K11/Services/CountryMigrator.cs index 9021b053..bf2126db 100644 --- a/Migration.Toolkit.Core.K11/Services/CountryMigrator.cs +++ b/Migration.Toolkit.Core.K11/Services/CountryMigrator.cs @@ -1,102 +1,102 @@ -namespace Migration.Toolkit.Core.K11.Services; - -using CMS.Globalization; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.K11.Contexts; -using Migration.Toolkit.K11; -using Migration.Toolkit.K11.Models; -using Migration.Toolkit.KXP.Api; - -public class CountryMigrator(ILogger logger, - IDbContextFactory k11ContextFactory, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol, - IEntityMapper countryMapper, - IEntityMapper stateMapper, - KxpApiInitializer kxpApiInitializer) -{ - public void MigrateCountriesAndStates() - { - if (!kxpApiInitializer.EnsureApiIsInitialized()) - { - throw new InvalidOperationException($"Falied to initialize kentico API. Please check configuration."); - } - - var k11Context = k11ContextFactory.CreateDbContext(); - - var k11Countries = k11Context.CmsCountries.AsNoTracking(); - foreach (var k11CmsCountry in k11Countries) - { - var kxpCountryInfo = CountryInfoProvider.ProviderObject.Get(k11CmsCountry.CountryName); - - if (kxpCountryInfo != null) // do not update when exists - { - continue; - } - - var mapped = countryMapper.Map(k11CmsCountry, null); - protocol.MappedTarget(mapped); - - if (mapped is (var countryInfo, var newInstance) { Success: true }) - { - try - { - CountryInfoProvider.ProviderObject.Set(countryInfo); - - protocol.Success(k11CmsCountry, countryInfo, mapped); - logger.LogEntitySetAction(newInstance, countryInfo); - - primaryKeyMappingContext.SetMapping(r => r.CountryId, k11CmsCountry.CountryId, countryInfo.CountryID); - } - catch (Exception exception) - { - logger.LogEntitySetError(exception, newInstance, countryInfo); - protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) - .NeedsManualAction() - .WithIdentityPrint(countryInfo) - ); - } - } - } - - - var k11States = k11Context.CmsStates.AsNoTracking(); - foreach (var k11CmsState in k11States) - { - var kxpStateInfo = StateInfoProvider.ProviderObject.Get(k11CmsState.StateName); - - if (kxpStateInfo != null) // do not update when exists - { - continue; - } - - var mapped = stateMapper.Map(k11CmsState, null); - protocol.MappedTarget(mapped); - - if (mapped is (var stateInfo, var newInstance) { Success: true }) - { - try - { - StateInfoProvider.ProviderObject.Set(stateInfo); - - protocol.Success(k11CmsState, stateInfo, mapped); - logger.LogEntitySetAction(newInstance, stateInfo); - - primaryKeyMappingContext.SetMapping(r => r.StateId, k11CmsState.StateId, stateInfo.StateID); - } - catch (Exception exception) - { - logger.LogEntitySetError(exception, newInstance, stateInfo); - protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) - .NeedsManualAction() - .WithIdentityPrint(stateInfo) - ); - } - } - } - } +namespace Migration.Toolkit.Core.K11.Services; + +using CMS.Globalization; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.K11.Contexts; +using Migration.Toolkit.K11; +using Migration.Toolkit.K11.Models; +using Migration.Toolkit.KXP.Api; + +public class CountryMigrator(ILogger logger, + IDbContextFactory k11ContextFactory, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol, + IEntityMapper countryMapper, + IEntityMapper stateMapper, + KxpApiInitializer kxpApiInitializer) +{ + public void MigrateCountriesAndStates() + { + if (!kxpApiInitializer.EnsureApiIsInitialized()) + { + throw new InvalidOperationException($"Falied to initialize kentico API. Please check configuration."); + } + + var k11Context = k11ContextFactory.CreateDbContext(); + + var k11Countries = k11Context.CmsCountries.AsNoTracking(); + foreach (var k11CmsCountry in k11Countries) + { + var kxpCountryInfo = CountryInfoProvider.ProviderObject.Get(k11CmsCountry.CountryName); + + if (kxpCountryInfo != null) // do not update when exists + { + continue; + } + + var mapped = countryMapper.Map(k11CmsCountry, null); + protocol.MappedTarget(mapped); + + if (mapped is (var countryInfo, var newInstance) { Success: true }) + { + try + { + CountryInfoProvider.ProviderObject.Set(countryInfo); + + protocol.Success(k11CmsCountry, countryInfo, mapped); + logger.LogEntitySetAction(newInstance, countryInfo); + + primaryKeyMappingContext.SetMapping(r => r.CountryId, k11CmsCountry.CountryId, countryInfo.CountryID); + } + catch (Exception exception) + { + logger.LogEntitySetError(exception, newInstance, countryInfo); + protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) + .NeedsManualAction() + .WithIdentityPrint(countryInfo) + ); + } + } + } + + + var k11States = k11Context.CmsStates.AsNoTracking(); + foreach (var k11CmsState in k11States) + { + var kxpStateInfo = StateInfoProvider.ProviderObject.Get(k11CmsState.StateName); + + if (kxpStateInfo != null) // do not update when exists + { + continue; + } + + var mapped = stateMapper.Map(k11CmsState, null); + protocol.MappedTarget(mapped); + + if (mapped is (var stateInfo, var newInstance) { Success: true }) + { + try + { + StateInfoProvider.ProviderObject.Set(stateInfo); + + protocol.Success(k11CmsState, stateInfo, mapped); + logger.LogEntitySetAction(newInstance, stateInfo); + + primaryKeyMappingContext.SetMapping(r => r.StateId, k11CmsState.StateId, stateInfo.StateID); + } + catch (Exception exception) + { + logger.LogEntitySetError(exception, newInstance, stateInfo); + protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) + .NeedsManualAction() + .WithIdentityPrint(stateInfo) + ); + } + } + } + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/GlobalUsings.cs b/Migration.Toolkit.Core.KX12/GlobalUsings.cs index a60b2bf2..f262502b 100644 --- a/Migration.Toolkit.Core.KX12/GlobalUsings.cs +++ b/Migration.Toolkit.Core.KX12/GlobalUsings.cs @@ -1,3 +1,3 @@ -global using System; -global using KX12M = Migration.Toolkit.KX12.Models; +global using System; +global using KX12M = Migration.Toolkit.KX12.Models; global using Migration.Toolkit; \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Helpers/PrintHelper.cs b/Migration.Toolkit.Core.KX12/Helpers/PrintHelper.cs index 001ed032..8374b51b 100644 --- a/Migration.Toolkit.Core.KX12/Helpers/PrintHelper.cs +++ b/Migration.Toolkit.Core.KX12/Helpers/PrintHelper.cs @@ -1,7 +1,7 @@ -namespace Migration.Toolkit.Core.KX12.Helpers; - -public static class PrintHelper -{ - public static string PrintDictionary(Dictionary dictionary) => - string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); +namespace Migration.Toolkit.Core.KX12.Helpers; + +public static class PrintHelper +{ + public static string PrintDictionary(Dictionary dictionary) => + string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Mappers/AlternativeFormMapper.cs b/Migration.Toolkit.Core.KX12/Mappers/AlternativeFormMapper.cs index 19e4dde1..c5fd14a5 100644 --- a/Migration.Toolkit.Core.KX12/Mappers/AlternativeFormMapper.cs +++ b/Migration.Toolkit.Core.KX12/Mappers/AlternativeFormMapper.cs @@ -1,96 +1,96 @@ -namespace Migration.Toolkit.Core.KX12.Mappers; - -using CMS.DataEngine; -using CMS.FormEngine; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.Enumerations; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX12.Contexts; -using Migration.Toolkit.Core.KX12.Services; -using Migration.Toolkit.KXP.Api.Services.CmsClass; - -public record AlternativeFormMapperSource(KX12M.CmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); - -public class AlternativeFormMapper : EntityMapperBase -{ - private readonly ILogger _logger; - private readonly FieldMigrationService _fieldMigrationService; - - public AlternativeFormMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol, FieldMigrationService fieldMigrationService) : base(logger, pkContext, protocol) - { - _logger = logger; - _fieldMigrationService = fieldMigrationService; - } - - protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) - => AlternativeFormInfo.New(); - - protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - var (source, xbkFormClass) = sourceObj; - - target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormClassId, out var classId) - ? classId ?? 0 - : 0; - target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormCoupledClassId, out var coupledClassId) - ? coupledClassId ?? 0 - : 0; - - var coupledClassIsDeprecated = - source.FormCoupledClass?.ClassName is { } coupledClassName && - K12SystemClass.NoLongerSupported.Contains(coupledClassName); - - var classIsSysInternal = K12SystemClass.All.Contains(source.FormClass.ClassName); - - var mergedDefinition = source.FormClass.ClassFormDefinition; - if (source.FormCoupledClass != null) - { - _logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", source.FormCoupledClass.ClassName, source.FormClass.ClassName); - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormCoupledClass.ClassFormDefinition); - } - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); - - var patcher = new FormDefinitionPatcher( - _logger, - mergedDefinition, - _fieldMigrationService, - source.FormClass.ClassIsForm.GetValueOrDefault(false), - source.FormClass.ClassIsDocumentType, - false, - !classIsSysInternal, - true - ); - - var fieldNames = patcher.GetFieldNames().ToList(); - _logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); - - patcher.PatchFields(); - - var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); - _logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); - - if (coupledClassIsDeprecated && source.FormCoupledClass != null) - { - _logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", source.FormCoupledClass.ClassName); - patcher.RemoveFields(source.FormCoupledClass.ClassFormDefinition); - - var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); - _logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); - } - - var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); - - var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); - - target.FormDefinition = formDefinitionDifference; - - target.FormDisplayName = source.FormDisplayName; - target.FormGUID = source.FormGuid; - target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); - target.FormLastModified = source.FormLastModified; - target.FormName = source.FormName; - - return target; - } +namespace Migration.Toolkit.Core.KX12.Mappers; + +using CMS.DataEngine; +using CMS.FormEngine; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.Enumerations; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX12.Contexts; +using Migration.Toolkit.Core.KX12.Services; +using Migration.Toolkit.KXP.Api.Services.CmsClass; + +public record AlternativeFormMapperSource(KX12M.CmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); + +public class AlternativeFormMapper : EntityMapperBase +{ + private readonly ILogger _logger; + private readonly FieldMigrationService _fieldMigrationService; + + public AlternativeFormMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol, FieldMigrationService fieldMigrationService) : base(logger, pkContext, protocol) + { + _logger = logger; + _fieldMigrationService = fieldMigrationService; + } + + protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) + => AlternativeFormInfo.New(); + + protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + var (source, xbkFormClass) = sourceObj; + + target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormClassId, out var classId) + ? classId ?? 0 + : 0; + target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormCoupledClassId, out var coupledClassId) + ? coupledClassId ?? 0 + : 0; + + var coupledClassIsDeprecated = + source.FormCoupledClass?.ClassName is { } coupledClassName && + K12SystemClass.NoLongerSupported.Contains(coupledClassName); + + var classIsSysInternal = K12SystemClass.All.Contains(source.FormClass.ClassName); + + var mergedDefinition = source.FormClass.ClassFormDefinition; + if (source.FormCoupledClass != null) + { + _logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", source.FormCoupledClass.ClassName, source.FormClass.ClassName); + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormCoupledClass.ClassFormDefinition); + } + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); + + var patcher = new FormDefinitionPatcher( + _logger, + mergedDefinition, + _fieldMigrationService, + source.FormClass.ClassIsForm.GetValueOrDefault(false), + source.FormClass.ClassIsDocumentType, + false, + !classIsSysInternal, + true + ); + + var fieldNames = patcher.GetFieldNames().ToList(); + _logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); + + patcher.PatchFields(); + + var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); + _logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); + + if (coupledClassIsDeprecated && source.FormCoupledClass != null) + { + _logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", source.FormCoupledClass.ClassName); + patcher.RemoveFields(source.FormCoupledClass.ClassFormDefinition); + + var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); + _logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); + } + + var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); + + var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); + + target.FormDefinition = formDefinitionDifference; + + target.FormDisplayName = source.FormDisplayName; + target.FormGUID = source.FormGuid; + target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); + target.FormLastModified = source.FormLastModified; + target.FormName = source.FormName; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Mappers/CmsAttachmentMapper.cs b/Migration.Toolkit.Core.KX12/Mappers/CmsAttachmentMapper.cs index 632888df..011c4fa1 100644 --- a/Migration.Toolkit.Core.KX12/Mappers/CmsAttachmentMapper.cs +++ b/Migration.Toolkit.Core.KX12/Mappers/CmsAttachmentMapper.cs @@ -14,7 +14,7 @@ public record CmsAttachmentMapperSource(CmsAttachment Attachment, int TargetLibr public class CmsAttachmentMapper : EntityMapperBase { - private const string LegacyOriginalPath = "__LegacyOriginalPath"; + private const string LEGACY_ORIGINAL_PATH = "__LegacyOriginalPath"; public CmsAttachmentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) { @@ -51,7 +51,7 @@ protected override MediaFileInfo MapInternal(CmsAttachmentMapperSource args, Med if (attachmentDocument != null) { - target.FileCustomData.SetValue(LegacyOriginalPath, attachmentDocument.DocumentNode.NodeAliasPath); + target.FileCustomData.SetValue(LEGACY_ORIGINAL_PATH, attachmentDocument.DocumentNode.NodeAliasPath); } return target; diff --git a/Migration.Toolkit.Core.KX12/Mappers/CountryInfoMapper.cs b/Migration.Toolkit.Core.KX12/Mappers/CountryInfoMapper.cs index cd183447..834b430e 100644 --- a/Migration.Toolkit.Core.KX12/Mappers/CountryInfoMapper.cs +++ b/Migration.Toolkit.Core.KX12/Mappers/CountryInfoMapper.cs @@ -1,29 +1,29 @@ -namespace Migration.Toolkit.Core.KX12.Mappers; - -using CMS.Globalization; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX12.Contexts; -using Migration.Toolkit.KX12.Models; - -public class CountryInfoMapper : EntityMapperBase -{ - public CountryInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) - { - } - - protected override CountryInfo? CreateNewInstance(CmsCountry source, MappingHelper mappingHelper, AddFailure addFailure) - => CountryInfo.New(); - - protected override CountryInfo MapInternal(CmsCountry source, CountryInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.CountryName = source.CountryName; - target.CountryDisplayName = source.CountryDisplayName; - target.CountryGUID = source.CountryGuid; - target.CountryLastModified = source.CountryLastModified; - target.CountryThreeLetterCode = source.CountryThreeLetterCode; - target.CountryTwoLetterCode = source.CountryTwoLetterCode; - return target; - } +namespace Migration.Toolkit.Core.KX12.Mappers; + +using CMS.Globalization; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX12.Contexts; +using Migration.Toolkit.KX12.Models; + +public class CountryInfoMapper : EntityMapperBase +{ + public CountryInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) + { + } + + protected override CountryInfo? CreateNewInstance(CmsCountry source, MappingHelper mappingHelper, AddFailure addFailure) + => CountryInfo.New(); + + protected override CountryInfo MapInternal(CmsCountry source, CountryInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + target.CountryName = source.CountryName; + target.CountryDisplayName = source.CountryDisplayName; + target.CountryGUID = source.CountryGuid; + target.CountryLastModified = source.CountryLastModified; + target.CountryThreeLetterCode = source.CountryThreeLetterCode; + target.CountryTwoLetterCode = source.CountryTwoLetterCode; + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Mappers/OmContactGroupMapper.cs b/Migration.Toolkit.Core.KX12/Mappers/OmContactGroupMapper.cs index efc25246..66b4cd48 100644 --- a/Migration.Toolkit.Core.KX12/Mappers/OmContactGroupMapper.cs +++ b/Migration.Toolkit.Core.KX12/Mappers/OmContactGroupMapper.cs @@ -1,35 +1,35 @@ -namespace Migration.Toolkit.Core.KX12.Mappers; - -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX12.Contexts; -using Migration.Toolkit.KXP.Models; - -public class OmContactGroupMapper : EntityMapperBase -{ - public OmContactGroupMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol - ) : base(logger, primaryKeyMappingContext, protocol) - { - } - - protected override OmContactGroup? CreateNewInstance(KX12M.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override OmContactGroup MapInternal(KX12M.OmContactGroup source, OmContactGroup target, bool newInstance, - MappingHelper mappingHelper, AddFailure addFailure) - { - target.ContactGroupName = source.ContactGroupName; - target.ContactGroupDisplayName = source.ContactGroupDisplayName; - target.ContactGroupDescription = source.ContactGroupDescription; - target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; - target.ContactGroupEnabled = source.ContactGroupEnabled; - target.ContactGroupLastModified = source.ContactGroupLastModified; - target.ContactGroupGuid = source.ContactGroupGuid; - target.ContactGroupStatus = source.ContactGroupStatus; - - return target; - } +namespace Migration.Toolkit.Core.KX12.Mappers; + +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX12.Contexts; +using Migration.Toolkit.KXP.Models; + +public class OmContactGroupMapper : EntityMapperBase +{ + public OmContactGroupMapper( + ILogger logger, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol + ) : base(logger, primaryKeyMappingContext, protocol) + { + } + + protected override OmContactGroup? CreateNewInstance(KX12M.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); + + protected override OmContactGroup MapInternal(KX12M.OmContactGroup source, OmContactGroup target, bool newInstance, + MappingHelper mappingHelper, AddFailure addFailure) + { + target.ContactGroupName = source.ContactGroupName; + target.ContactGroupDisplayName = source.ContactGroupDisplayName; + target.ContactGroupDescription = source.ContactGroupDescription; + target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; + target.ContactGroupEnabled = source.ContactGroupEnabled; + target.ContactGroupLastModified = source.ContactGroupLastModified; + target.ContactGroupGuid = source.ContactGroupGuid; + target.ContactGroupStatus = source.ContactGroupStatus; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Mappers/OmContactStatusMapper.cs b/Migration.Toolkit.Core.KX12/Mappers/OmContactStatusMapper.cs index 0fae331d..8ab2ce85 100644 --- a/Migration.Toolkit.Core.KX12/Mappers/OmContactStatusMapper.cs +++ b/Migration.Toolkit.Core.KX12/Mappers/OmContactStatusMapper.cs @@ -1,31 +1,31 @@ -namespace Migration.Toolkit.Core.KX12.Mappers; - -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX12.Contexts; -using Migration.Toolkit.KXP.Models; - -public class OmContactStatusMapper : EntityMapperBase -{ - public OmContactStatusMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol - ) : base(logger, primaryKeyMappingContext, protocol) - { - } - - protected override OmContactStatus? CreateNewInstance(KX12M.OmContactStatus tSourceEntity, MappingHelper mappingHelper, - AddFailure addFailure) => new(); - - protected override OmContactStatus MapInternal(KX12M.OmContactStatus source, OmContactStatus target, bool newInstance, - MappingHelper mappingHelper, AddFailure addFailure) - { - target.ContactStatusName = source.ContactStatusName; - target.ContactStatusDisplayName = source.ContactStatusDisplayName; - target.ContactStatusDescription = source.ContactStatusDescription; - - return target; - } +namespace Migration.Toolkit.Core.KX12.Mappers; + +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX12.Contexts; +using Migration.Toolkit.KXP.Models; + +public class OmContactStatusMapper : EntityMapperBase +{ + public OmContactStatusMapper( + ILogger logger, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol + ) : base(logger, primaryKeyMappingContext, protocol) + { + } + + protected override OmContactStatus? CreateNewInstance(KX12M.OmContactStatus tSourceEntity, MappingHelper mappingHelper, + AddFailure addFailure) => new(); + + protected override OmContactStatus MapInternal(KX12M.OmContactStatus source, OmContactStatus target, bool newInstance, + MappingHelper mappingHelper, AddFailure addFailure) + { + target.ContactStatusName = source.ContactStatusName; + target.ContactStatusDisplayName = source.ContactStatusDisplayName; + target.ContactStatusDescription = source.ContactStatusDescription; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Mappers/StateInfoMapper.cs b/Migration.Toolkit.Core.KX12/Mappers/StateInfoMapper.cs index a9a046e0..bb948da0 100644 --- a/Migration.Toolkit.Core.KX12/Mappers/StateInfoMapper.cs +++ b/Migration.Toolkit.Core.KX12/Mappers/StateInfoMapper.cs @@ -1,34 +1,34 @@ -namespace Migration.Toolkit.Core.KX12.Mappers; - -using CMS.Globalization; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX12.Contexts; -using Migration.Toolkit.KX12.Models; - -public class StateInfoMapper : EntityMapperBase -{ - public StateInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) - { - } - - protected override StateInfo? CreateNewInstance(CmsState source, MappingHelper mappingHelper, AddFailure addFailure) - => StateInfo.New(); - - protected override StateInfo MapInternal(CmsState source, StateInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.StateName = source.StateName; - target.StateDisplayName = source.StateDisplayName; - target.StateLastModified = source.StateLastModified; - target.StateGUID = source.StateGuid; - target.StateCode = source.StateCode; - - if (mappingHelper.TranslateRequiredId(k => k.CountryId, source.CountryId, out var countryId)) - { - target.CountryID = countryId; - } - - return target; - } +namespace Migration.Toolkit.Core.KX12.Mappers; + +using CMS.Globalization; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX12.Contexts; +using Migration.Toolkit.KX12.Models; + +public class StateInfoMapper : EntityMapperBase +{ + public StateInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) + { + } + + protected override StateInfo? CreateNewInstance(CmsState source, MappingHelper mappingHelper, AddFailure addFailure) + => StateInfo.New(); + + protected override StateInfo MapInternal(CmsState source, StateInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + target.StateName = source.StateName; + target.StateDisplayName = source.StateDisplayName; + target.StateLastModified = source.StateLastModified; + target.StateGUID = source.StateGuid; + target.StateCode = source.StateCode; + + if (mappingHelper.TranslateRequiredId(k => k.CountryId, source.CountryId, out var countryId)) + { + target.CountryID = countryId; + } + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Providers/ContentItemNameValidator.cs b/Migration.Toolkit.Core.KX12/Providers/ContentItemNameValidator.cs index 67274a06..bccb5914 100644 --- a/Migration.Toolkit.Core.KX12/Providers/ContentItemNameValidator.cs +++ b/Migration.Toolkit.Core.KX12/Providers/ContentItemNameValidator.cs @@ -1,25 +1,25 @@ -namespace Migration.Toolkit.Core.KX12.Providers; - -using CMS.ContentEngine.Internal; - -internal class ContentItemNameValidator : IContentItemNameValidator -{ - /// - public bool IsUnique(string name) - { - return IsUnique(0, name); - } - - - /// - public bool IsUnique(int id, string name) - { - var contentItemInfo = new ContentItemInfo() - { - ContentItemID = id, - ContentItemName = name, - }; - - return contentItemInfo.CheckUniqueCodeName(); - } +namespace Migration.Toolkit.Core.KX12.Providers; + +using CMS.ContentEngine.Internal; + +internal class ContentItemNameValidator : IContentItemNameValidator +{ + /// + public bool IsUnique(string name) + { + return IsUnique(0, name); + } + + + /// + public bool IsUnique(int id, string name) + { + var contentItemInfo = new ContentItemInfo() + { + ContentItemID = id, + ContentItemName = name, + }; + + return contentItemInfo.CheckUniqueCodeName(); + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Providers/UniqueContentItemNameProvider.cs b/Migration.Toolkit.Core.KX12/Providers/UniqueContentItemNameProvider.cs index cb183552..4a7affe3 100644 --- a/Migration.Toolkit.Core.KX12/Providers/UniqueContentItemNameProvider.cs +++ b/Migration.Toolkit.Core.KX12/Providers/UniqueContentItemNameProvider.cs @@ -1,48 +1,48 @@ -namespace Migration.Toolkit.Core.KX12.Providers; - -using System.Threading.Tasks; -using CMS.Base; -using CMS.ContentEngine.Internal; - -internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase -{ - private readonly IContentItemNameValidator codeNameValidator; - - - /// - /// Creates a new instance of . - /// - public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) - : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) - { - this.codeNameValidator = codeNameValidator; - } - - public override Task GetUniqueValue(string inputValue) - { - return base.GetUniqueValue(AddSuffix(inputValue)); - } - - - private string AddSuffix(string codeName) - { - var randomSuffix = GetRandomSuffix(); - var codeNameWithSuffix = codeName += randomSuffix; - - if (codeNameWithSuffix.Length > MaxLength) - { - var availableLength = MaxLength - randomSuffix.Length; - - codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; - } - - return codeNameWithSuffix; - } - - - /// - protected override Task IsValueUnique(string value) - { - return Task.FromResult(codeNameValidator.IsUnique(value)); - } +namespace Migration.Toolkit.Core.KX12.Providers; + +using System.Threading.Tasks; +using CMS.Base; +using CMS.ContentEngine.Internal; + +internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase +{ + private readonly IContentItemNameValidator codeNameValidator; + + + /// + /// Creates a new instance of . + /// + public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) + : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) + { + this.codeNameValidator = codeNameValidator; + } + + public override Task GetUniqueValue(string inputValue) + { + return base.GetUniqueValue(AddSuffix(inputValue)); + } + + + private string AddSuffix(string codeName) + { + var randomSuffix = GetRandomSuffix(); + var codeNameWithSuffix = codeName += randomSuffix; + + if (codeNameWithSuffix.Length > MaxLength) + { + var availableLength = MaxLength - randomSuffix.Length; + + codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; + } + + return codeNameWithSuffix; + } + + + /// + protected override Task IsValueUnique(string value) + { + return Task.FromResult(codeNameValidator.IsUnique(value)); + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Services/CmsClass/AttachmentSelectorItem.cs b/Migration.Toolkit.Core.KX12/Services/CmsClass/AttachmentSelectorItem.cs index d4442a8f..6e1f0286 100644 --- a/Migration.Toolkit.Core.KX12/Services/CmsClass/AttachmentSelectorItem.cs +++ b/Migration.Toolkit.Core.KX12/Services/CmsClass/AttachmentSelectorItem.cs @@ -1,11 +1,11 @@ -namespace Migration.Toolkit.Core.KX12.Services.CmsClass; - -using Newtonsoft.Json; - -/// Represents an item for the attachment selector. -public class AttachmentSelectorItem -{ - /// Attachment GUID. - [JsonProperty("fileGuid")] - public Guid FileGuid { get; set; } +namespace Migration.Toolkit.Core.KX12.Services.CmsClass; + +using Newtonsoft.Json; + +/// Represents an item for the attachment selector. +public class AttachmentSelectorItem +{ + /// Attachment GUID. + [JsonProperty("fileGuid")] + public Guid FileGuid { get; set; } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX12/Services/CountryMigrator.cs b/Migration.Toolkit.Core.KX12/Services/CountryMigrator.cs index 8164ba92..043db008 100644 --- a/Migration.Toolkit.Core.KX12/Services/CountryMigrator.cs +++ b/Migration.Toolkit.Core.KX12/Services/CountryMigrator.cs @@ -1,123 +1,123 @@ -namespace Migration.Toolkit.Core.KX12.Services; - -using CMS.Globalization; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX12.Contexts; -using Migration.Toolkit.KX12.Context; -using Migration.Toolkit.KX12.Models; -using Migration.Toolkit.KXP.Api; - -public class CountryMigrator -{ - private readonly ILogger _logger; - private readonly IDbContextFactory _kx12ContextFactory; - private readonly PrimaryKeyMappingContext _primaryKeyMappingContext; - private readonly IProtocol _protocol; - private readonly IEntityMapper _countryMapper; - private readonly IEntityMapper _stateMapper; - private readonly KxpApiInitializer _kxpApiInitializer; - - public CountryMigrator( - ILogger logger, - IDbContextFactory kx12ContextFactory, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol, - IEntityMapper countryMapper, - IEntityMapper stateMapper, - KxpApiInitializer kxpApiInitializer - ) - { - _logger = logger; - _kx12ContextFactory = kx12ContextFactory; - _primaryKeyMappingContext = primaryKeyMappingContext; - _protocol = protocol; - _countryMapper = countryMapper; - _stateMapper = stateMapper; - _kxpApiInitializer = kxpApiInitializer; - } - - public void MigrateCountriesAndStates() - { - if (!_kxpApiInitializer.EnsureApiIsInitialized()) - { - throw new InvalidOperationException($"Falied to initialize kentico API. Please check configuration."); - } - - var kx12Context = _kx12ContextFactory.CreateDbContext(); - - var k12Countries = kx12Context.CmsCountries.AsNoTracking(); - foreach (var k12CmsCountry in k12Countries) - { - var kxpCountryInfo = CountryInfoProvider.ProviderObject.Get(k12CmsCountry.CountryName); - - if (kxpCountryInfo != null) // do not update when exists - { - continue; - } - - var mapped = _countryMapper.Map(k12CmsCountry, null); - _protocol.MappedTarget(mapped); - - if (mapped is (var countryInfo, var newInstance) { Success: true }) - { - try - { - CountryInfoProvider.ProviderObject.Set(countryInfo); - - _protocol.Success(k12CmsCountry, countryInfo, mapped); - _logger.LogEntitySetAction(newInstance, countryInfo); - - _primaryKeyMappingContext.SetMapping(r => r.CountryId, k12CmsCountry.CountryId, countryInfo.CountryID); - } - catch (Exception exception) - { - _logger.LogEntitySetError(exception, newInstance, countryInfo); - _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) - .NeedsManualAction() - .WithIdentityPrint(countryInfo) - ); - } - } - } - - - var k12States = kx12Context.CmsStates.AsNoTracking(); - foreach (var k12CmsState in k12States) - { - var kxpStateInfo = StateInfoProvider.ProviderObject.Get(k12CmsState.StateName); - - if (kxpStateInfo != null) // do not update when exists - { - continue; - } - - var mapped = _stateMapper.Map(k12CmsState, null); - _protocol.MappedTarget(mapped); - - if (mapped is (var stateInfo, var newInstance) { Success: true }) - { - try - { - StateInfoProvider.ProviderObject.Set(stateInfo); - - _protocol.Success(k12CmsState, stateInfo, mapped); - _logger.LogEntitySetAction(newInstance, stateInfo); - - _primaryKeyMappingContext.SetMapping(r => r.StateId, k12CmsState.StateId, stateInfo.StateID); - } - catch (Exception exception) - { - _logger.LogEntitySetError(exception, newInstance, stateInfo); - _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) - .NeedsManualAction() - .WithIdentityPrint(stateInfo) - ); - } - } - } - } +namespace Migration.Toolkit.Core.KX12.Services; + +using CMS.Globalization; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX12.Contexts; +using Migration.Toolkit.KX12.Context; +using Migration.Toolkit.KX12.Models; +using Migration.Toolkit.KXP.Api; + +public class CountryMigrator +{ + private readonly ILogger _logger; + private readonly IDbContextFactory _kx12ContextFactory; + private readonly PrimaryKeyMappingContext _primaryKeyMappingContext; + private readonly IProtocol _protocol; + private readonly IEntityMapper _countryMapper; + private readonly IEntityMapper _stateMapper; + private readonly KxpApiInitializer _kxpApiInitializer; + + public CountryMigrator( + ILogger logger, + IDbContextFactory kx12ContextFactory, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol, + IEntityMapper countryMapper, + IEntityMapper stateMapper, + KxpApiInitializer kxpApiInitializer + ) + { + _logger = logger; + _kx12ContextFactory = kx12ContextFactory; + _primaryKeyMappingContext = primaryKeyMappingContext; + _protocol = protocol; + _countryMapper = countryMapper; + _stateMapper = stateMapper; + _kxpApiInitializer = kxpApiInitializer; + } + + public void MigrateCountriesAndStates() + { + if (!_kxpApiInitializer.EnsureApiIsInitialized()) + { + throw new InvalidOperationException($"Falied to initialize kentico API. Please check configuration."); + } + + var kx12Context = _kx12ContextFactory.CreateDbContext(); + + var k12Countries = kx12Context.CmsCountries.AsNoTracking(); + foreach (var k12CmsCountry in k12Countries) + { + var kxpCountryInfo = CountryInfoProvider.ProviderObject.Get(k12CmsCountry.CountryName); + + if (kxpCountryInfo != null) // do not update when exists + { + continue; + } + + var mapped = _countryMapper.Map(k12CmsCountry, null); + _protocol.MappedTarget(mapped); + + if (mapped is (var countryInfo, var newInstance) { Success: true }) + { + try + { + CountryInfoProvider.ProviderObject.Set(countryInfo); + + _protocol.Success(k12CmsCountry, countryInfo, mapped); + _logger.LogEntitySetAction(newInstance, countryInfo); + + _primaryKeyMappingContext.SetMapping(r => r.CountryId, k12CmsCountry.CountryId, countryInfo.CountryID); + } + catch (Exception exception) + { + _logger.LogEntitySetError(exception, newInstance, countryInfo); + _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) + .NeedsManualAction() + .WithIdentityPrint(countryInfo) + ); + } + } + } + + + var k12States = kx12Context.CmsStates.AsNoTracking(); + foreach (var k12CmsState in k12States) + { + var kxpStateInfo = StateInfoProvider.ProviderObject.Get(k12CmsState.StateName); + + if (kxpStateInfo != null) // do not update when exists + { + continue; + } + + var mapped = _stateMapper.Map(k12CmsState, null); + _protocol.MappedTarget(mapped); + + if (mapped is (var stateInfo, var newInstance) { Success: true }) + { + try + { + StateInfoProvider.ProviderObject.Set(stateInfo); + + _protocol.Success(k12CmsState, stateInfo, mapped); + _logger.LogEntitySetAction(newInstance, stateInfo); + + _primaryKeyMappingContext.SetMapping(r => r.StateId, k12CmsState.StateId, stateInfo.StateID); + } + catch (Exception exception) + { + _logger.LogEntitySetError(exception, newInstance, stateInfo); + _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) + .NeedsManualAction() + .WithIdentityPrint(stateInfo) + ); + } + } + } + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/GlobalUsings.cs b/Migration.Toolkit.Core.KX13/GlobalUsings.cs index 53b21d35..f177493b 100644 --- a/Migration.Toolkit.Core.KX13/GlobalUsings.cs +++ b/Migration.Toolkit.Core.KX13/GlobalUsings.cs @@ -1,2 +1,2 @@ -global using System; +global using System; global using KX13M = Migration.Toolkit.KX13.Models; \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs b/Migration.Toolkit.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs index 9ec4c3c5..82227da9 100644 --- a/Migration.Toolkit.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs +++ b/Migration.Toolkit.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs @@ -310,7 +310,6 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin case AutofixEnum.Error: default: //error protocol.Append(HandbookReferences - .MissingRequiredDependency(columnName, value) .WithData(currentRow) ); return ValueInterceptorResult.SkipRow; diff --git a/Migration.Toolkit.Core.KX13/Helpers/PrintHelper.cs b/Migration.Toolkit.Core.KX13/Helpers/PrintHelper.cs index c63e9e26..95b4e30c 100644 --- a/Migration.Toolkit.Core.KX13/Helpers/PrintHelper.cs +++ b/Migration.Toolkit.Core.KX13/Helpers/PrintHelper.cs @@ -1,7 +1,7 @@ -namespace Migration.Toolkit.Core.KX13.Helpers; - -public static class PrintHelper -{ - public static string PrintDictionary(Dictionary dictionary) => - string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); +namespace Migration.Toolkit.Core.KX13.Helpers; + +public static class PrintHelper +{ + public static string PrintDictionary(Dictionary dictionary) => + string.Join(", ", dictionary.Select(x => $"{x.Key}:{x.Value ?? ""}")); } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Mappers/AlternativeFormMapper.cs b/Migration.Toolkit.Core.KX13/Mappers/AlternativeFormMapper.cs index 80880262..542e4c22 100644 --- a/Migration.Toolkit.Core.KX13/Mappers/AlternativeFormMapper.cs +++ b/Migration.Toolkit.Core.KX13/Mappers/AlternativeFormMapper.cs @@ -1,96 +1,96 @@ -namespace Migration.Toolkit.Core.KX13.Mappers; - -using CMS.DataEngine; -using CMS.FormEngine; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.Enumerations; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX13.Contexts; -using Migration.Toolkit.Core.KX13.Services; -using Migration.Toolkit.KXP.Api.Services.CmsClass; - -public record AlternativeFormMapperSource(KX13M.CmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); - -public class AlternativeFormMapper : EntityMapperBase -{ - private readonly ILogger _logger; - private readonly FieldMigrationService _fieldMigrationService; - - public AlternativeFormMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol, FieldMigrationService fieldMigrationService) : base(logger, pkContext, protocol) - { - _logger = logger; - _fieldMigrationService = fieldMigrationService; - } - - protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) - => AlternativeFormInfo.New(); - - protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - var (source, xbkFormClass) = sourceObj; - - target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormClassId, out var classId) - ? classId ?? 0 - : 0; - target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormCoupledClassId, out var coupledClassId) - ? coupledClassId ?? 0 - : 0; - - var coupledClassIsDeprecated = - source.FormCoupledClass?.ClassName is { } coupledClassName && - Kx13SystemClass.NoLongerSupported.Contains(coupledClassName); - - var classIsSysInternal = Kx13SystemClass.All.Contains(source.FormClass.ClassName); - - var mergedDefinition = source.FormClass.ClassFormDefinition; - if (source.FormCoupledClass != null) - { - _logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", source.FormCoupledClass.ClassName, source.FormClass.ClassName); - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormCoupledClass.ClassFormDefinition); - } - mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); - - var patcher = new FormDefinitionPatcher( - _logger, - mergedDefinition, - _fieldMigrationService, - source.FormClass.ClassIsForm.GetValueOrDefault(false), - source.FormClass.ClassIsDocumentType, - false, - !classIsSysInternal, - true - ); - - var fieldNames = patcher.GetFieldNames().ToList(); - _logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); - - patcher.PatchFields(); - - var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); - _logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); - - if (coupledClassIsDeprecated && source.FormCoupledClass != null) - { - _logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", source.FormCoupledClass.ClassName); - patcher.RemoveFields(source.FormCoupledClass.ClassFormDefinition); - - var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); - _logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); - } - - var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); - - var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); - - target.FormDefinition = formDefinitionDifference; - - target.FormDisplayName = source.FormDisplayName; - target.FormGUID = source.FormGuid; - target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); - target.FormLastModified = source.FormLastModified; - target.FormName = source.FormName; - - return target; - } +namespace Migration.Toolkit.Core.KX13.Mappers; + +using CMS.DataEngine; +using CMS.FormEngine; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.Enumerations; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX13.Contexts; +using Migration.Toolkit.Core.KX13.Services; +using Migration.Toolkit.KXP.Api.Services.CmsClass; + +public record AlternativeFormMapperSource(KX13M.CmsAlternativeForm AlternativeForm, DataClassInfo XbkFormClass); + +public class AlternativeFormMapper : EntityMapperBase +{ + private readonly ILogger _logger; + private readonly FieldMigrationService _fieldMigrationService; + + public AlternativeFormMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol, FieldMigrationService fieldMigrationService) : base(logger, pkContext, protocol) + { + _logger = logger; + _fieldMigrationService = fieldMigrationService; + } + + protected override AlternativeFormInfo? CreateNewInstance(AlternativeFormMapperSource source, MappingHelper mappingHelper, AddFailure addFailure) + => AlternativeFormInfo.New(); + + protected override AlternativeFormInfo MapInternal(AlternativeFormMapperSource sourceObj, AlternativeFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + var (source, xbkFormClass) = sourceObj; + + target.FormClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormClassId, out var classId) + ? classId ?? 0 + : 0; + target.FormCoupledClassID = mappingHelper.TranslateIdAllowNulls(c => c.ClassId, source.FormCoupledClassId, out var coupledClassId) + ? coupledClassId ?? 0 + : 0; + + var coupledClassIsDeprecated = + source.FormCoupledClass?.ClassName is { } coupledClassName && + Kx13SystemClass.NoLongerSupported.Contains(coupledClassName); + + var classIsSysInternal = Kx13SystemClass.All.Contains(source.FormClass.ClassName); + + var mergedDefinition = source.FormClass.ClassFormDefinition; + if (source.FormCoupledClass != null) + { + _logger.LogDebug("Merging coupled class ('{FormCoupledClassName}') form definition with form definition ('{FormClassName}')", source.FormCoupledClass.ClassName, source.FormClass.ClassName); + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormCoupledClass.ClassFormDefinition); + } + mergedDefinition = FormHelper.MergeFormDefinitions(mergedDefinition, source.FormDefinition); + + var patcher = new FormDefinitionPatcher( + _logger, + mergedDefinition, + _fieldMigrationService, + source.FormClass.ClassIsForm.GetValueOrDefault(false), + source.FormClass.ClassIsDocumentType, + false, + !classIsSysInternal, + true + ); + + var fieldNames = patcher.GetFieldNames().ToList(); + _logger.LogDebug("Fields ({Count}) before patch: {Fields}", fieldNames.Count, string.Join(",", fieldNames)); + + patcher.PatchFields(); + + var fieldNamesAfterPatch = patcher.GetFieldNames().ToList(); + _logger.LogDebug("Fields ({Count}) after patch: {Fields}", fieldNamesAfterPatch.Count, string.Join(",", fieldNamesAfterPatch)); + + if (coupledClassIsDeprecated && source.FormCoupledClass != null) + { + _logger.LogDebug("Form coupled class ('{FormCoupledClassName}') is deprecated, removing fields", source.FormCoupledClass.ClassName); + patcher.RemoveFields(source.FormCoupledClass.ClassFormDefinition); + + var fileNamesAfterDeprecatedRemoval = patcher.GetFieldNames().ToList(); + _logger.LogDebug("Fields ({Count}) after deprecated removal: {Fields}", fileNamesAfterDeprecatedRemoval.Count, string.Join(",", fileNamesAfterDeprecatedRemoval)); + } + + var result = new FormInfo(patcher.GetPatched()).GetXmlDefinition(); + + var formDefinitionDifference = FormHelper.GetFormDefinitionDifference(xbkFormClass.ClassFormDefinition, result, true); + + target.FormDefinition = formDefinitionDifference; + + target.FormDisplayName = source.FormDisplayName; + target.FormGUID = source.FormGuid; + target.FormIsCustom = source.FormIsCustom.GetValueOrDefault(false); + target.FormLastModified = source.FormLastModified; + target.FormName = source.FormName; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Mappers/CmsAttachmentMapper.cs b/Migration.Toolkit.Core.KX13/Mappers/CmsAttachmentMapper.cs index e62ca549..ad4d5157 100644 --- a/Migration.Toolkit.Core.KX13/Mappers/CmsAttachmentMapper.cs +++ b/Migration.Toolkit.Core.KX13/Mappers/CmsAttachmentMapper.cs @@ -14,7 +14,7 @@ public record CmsAttachmentMapperSource(CmsAttachment Attachment, int TargetLibr public class CmsAttachmentMapper : EntityMapperBase { - private const string LegacyOriginalPath = "__LegacyOriginalPath"; + private const string LEGACY_ORIGINAL_PATH = "__LegacyOriginalPath"; public CmsAttachmentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) { @@ -51,7 +51,7 @@ protected override MediaFileInfo MapInternal(CmsAttachmentMapperSource args, Med if (attachmentDocument != null) { - target.FileCustomData.SetValue(LegacyOriginalPath, attachmentDocument.DocumentNode.NodeAliasPath); + target.FileCustomData.SetValue(LEGACY_ORIGINAL_PATH, attachmentDocument.DocumentNode.NodeAliasPath); } return target; diff --git a/Migration.Toolkit.Core.KX13/Mappers/CountryInfoMapper.cs b/Migration.Toolkit.Core.KX13/Mappers/CountryInfoMapper.cs index 40a12068..adee6bd2 100644 --- a/Migration.Toolkit.Core.KX13/Mappers/CountryInfoMapper.cs +++ b/Migration.Toolkit.Core.KX13/Mappers/CountryInfoMapper.cs @@ -1,29 +1,29 @@ -namespace Migration.Toolkit.Core.KX13.Mappers; - -using CMS.Globalization; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX13.Contexts; -using Migration.Toolkit.KX13.Models; - -public class CountryInfoMapper : EntityMapperBase -{ - public CountryInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) - { - } - - protected override CountryInfo? CreateNewInstance(CmsCountry source, MappingHelper mappingHelper, AddFailure addFailure) - => CountryInfo.New(); - - protected override CountryInfo MapInternal(CmsCountry source, CountryInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.CountryName = source.CountryName; - target.CountryDisplayName = source.CountryDisplayName; - target.CountryGUID = source.CountryGuid; - target.CountryLastModified = source.CountryLastModified; - target.CountryThreeLetterCode = source.CountryThreeLetterCode; - target.CountryTwoLetterCode = source.CountryTwoLetterCode; - return target; - } +namespace Migration.Toolkit.Core.KX13.Mappers; + +using CMS.Globalization; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX13.Contexts; +using Migration.Toolkit.KX13.Models; + +public class CountryInfoMapper : EntityMapperBase +{ + public CountryInfoMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) + { + } + + protected override CountryInfo? CreateNewInstance(CmsCountry source, MappingHelper mappingHelper, AddFailure addFailure) + => CountryInfo.New(); + + protected override CountryInfo MapInternal(CmsCountry source, CountryInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + { + target.CountryName = source.CountryName; + target.CountryDisplayName = source.CountryDisplayName; + target.CountryGUID = source.CountryGuid; + target.CountryLastModified = source.CountryLastModified; + target.CountryThreeLetterCode = source.CountryThreeLetterCode; + target.CountryTwoLetterCode = source.CountryTwoLetterCode; + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Mappers/OmContactGroupMapper.cs b/Migration.Toolkit.Core.KX13/Mappers/OmContactGroupMapper.cs index f410c816..214737cd 100644 --- a/Migration.Toolkit.Core.KX13/Mappers/OmContactGroupMapper.cs +++ b/Migration.Toolkit.Core.KX13/Mappers/OmContactGroupMapper.cs @@ -1,35 +1,35 @@ -namespace Migration.Toolkit.Core.KX13.Mappers; - -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX13.Contexts; -using Migration.Toolkit.KXP.Models; - -public class OmContactGroupMapper : EntityMapperBase -{ - public OmContactGroupMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol - ) : base(logger, primaryKeyMappingContext, protocol) - { - } - - protected override OmContactGroup? CreateNewInstance(Toolkit.KX13.Models.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override OmContactGroup MapInternal(Toolkit.KX13.Models.OmContactGroup source, OmContactGroup target, bool newInstance, - MappingHelper mappingHelper, AddFailure addFailure) - { - target.ContactGroupName = source.ContactGroupName; - target.ContactGroupDisplayName = source.ContactGroupDisplayName; - target.ContactGroupDescription = source.ContactGroupDescription; - target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; - target.ContactGroupEnabled = source.ContactGroupEnabled; - target.ContactGroupLastModified = source.ContactGroupLastModified; - target.ContactGroupGuid = source.ContactGroupGuid; - target.ContactGroupStatus = source.ContactGroupStatus; - - return target; - } +namespace Migration.Toolkit.Core.KX13.Mappers; + +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX13.Contexts; +using Migration.Toolkit.KXP.Models; + +public class OmContactGroupMapper : EntityMapperBase +{ + public OmContactGroupMapper( + ILogger logger, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol + ) : base(logger, primaryKeyMappingContext, protocol) + { + } + + protected override OmContactGroup? CreateNewInstance(Toolkit.KX13.Models.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); + + protected override OmContactGroup MapInternal(Toolkit.KX13.Models.OmContactGroup source, OmContactGroup target, bool newInstance, + MappingHelper mappingHelper, AddFailure addFailure) + { + target.ContactGroupName = source.ContactGroupName; + target.ContactGroupDisplayName = source.ContactGroupDisplayName; + target.ContactGroupDescription = source.ContactGroupDescription; + target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; + target.ContactGroupEnabled = source.ContactGroupEnabled; + target.ContactGroupLastModified = source.ContactGroupLastModified; + target.ContactGroupGuid = source.ContactGroupGuid; + target.ContactGroupStatus = source.ContactGroupStatus; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Mappers/OmContactStatusMapper.cs b/Migration.Toolkit.Core.KX13/Mappers/OmContactStatusMapper.cs index 8ceb83fa..bbd2076c 100644 --- a/Migration.Toolkit.Core.KX13/Mappers/OmContactStatusMapper.cs +++ b/Migration.Toolkit.Core.KX13/Mappers/OmContactStatusMapper.cs @@ -1,31 +1,31 @@ -namespace Migration.Toolkit.Core.KX13.Mappers; - -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX13.Contexts; -using Migration.Toolkit.KXP.Models; - -public class OmContactStatusMapper : EntityMapperBase -{ - public OmContactStatusMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol - ) : base(logger, primaryKeyMappingContext, protocol) - { - } - - protected override OmContactStatus? CreateNewInstance(Toolkit.KX13.Models.OmContactStatus tSourceEntity, MappingHelper mappingHelper, - AddFailure addFailure) => new(); - - protected override OmContactStatus MapInternal(Toolkit.KX13.Models.OmContactStatus source, OmContactStatus target, bool newInstance, - MappingHelper mappingHelper, AddFailure addFailure) - { - target.ContactStatusName = source.ContactStatusName; - target.ContactStatusDisplayName = source.ContactStatusDisplayName; - target.ContactStatusDescription = source.ContactStatusDescription; - - return target; - } +namespace Migration.Toolkit.Core.KX13.Mappers; + +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX13.Contexts; +using Migration.Toolkit.KXP.Models; + +public class OmContactStatusMapper : EntityMapperBase +{ + public OmContactStatusMapper( + ILogger logger, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol + ) : base(logger, primaryKeyMappingContext, protocol) + { + } + + protected override OmContactStatus? CreateNewInstance(Toolkit.KX13.Models.OmContactStatus tSourceEntity, MappingHelper mappingHelper, + AddFailure addFailure) => new(); + + protected override OmContactStatus MapInternal(Toolkit.KX13.Models.OmContactStatus source, OmContactStatus target, bool newInstance, + MappingHelper mappingHelper, AddFailure addFailure) + { + target.ContactStatusName = source.ContactStatusName; + target.ContactStatusDisplayName = source.ContactStatusDisplayName; + target.ContactStatusDescription = source.ContactStatusDescription; + + return target; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Providers/ContentItemNameValidator.cs b/Migration.Toolkit.Core.KX13/Providers/ContentItemNameValidator.cs index d0c58ac2..01c80a2d 100644 --- a/Migration.Toolkit.Core.KX13/Providers/ContentItemNameValidator.cs +++ b/Migration.Toolkit.Core.KX13/Providers/ContentItemNameValidator.cs @@ -1,25 +1,25 @@ -namespace Migration.Toolkit.Core.KX13.Providers; - -using CMS.ContentEngine.Internal; - -internal class ContentItemNameValidator : IContentItemNameValidator -{ - /// - public bool IsUnique(string name) - { - return IsUnique(0, name); - } - - - /// - public bool IsUnique(int id, string name) - { - var contentItemInfo = new ContentItemInfo() - { - ContentItemID = id, - ContentItemName = name, - }; - - return contentItemInfo.CheckUniqueCodeName(); - } +namespace Migration.Toolkit.Core.KX13.Providers; + +using CMS.ContentEngine.Internal; + +internal class ContentItemNameValidator : IContentItemNameValidator +{ + /// + public bool IsUnique(string name) + { + return IsUnique(0, name); + } + + + /// + public bool IsUnique(int id, string name) + { + var contentItemInfo = new ContentItemInfo() + { + ContentItemID = id, + ContentItemName = name, + }; + + return contentItemInfo.CheckUniqueCodeName(); + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Providers/UniqueContentItemNameProvider.cs b/Migration.Toolkit.Core.KX13/Providers/UniqueContentItemNameProvider.cs index ee76a608..aa814050 100644 --- a/Migration.Toolkit.Core.KX13/Providers/UniqueContentItemNameProvider.cs +++ b/Migration.Toolkit.Core.KX13/Providers/UniqueContentItemNameProvider.cs @@ -1,48 +1,48 @@ -namespace Migration.Toolkit.Core.KX13.Providers; - -using System.Threading.Tasks; -using CMS.Base; -using CMS.ContentEngine.Internal; - -internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase -{ - private readonly IContentItemNameValidator codeNameValidator; - - - /// - /// Creates a new instance of . - /// - public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) - : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) - { - this.codeNameValidator = codeNameValidator; - } - - public override Task GetUniqueValue(string inputValue) - { - return base.GetUniqueValue(AddSuffix(inputValue)); - } - - - private string AddSuffix(string codeName) - { - var randomSuffix = GetRandomSuffix(); - var codeNameWithSuffix = codeName += randomSuffix; - - if (codeNameWithSuffix.Length > MaxLength) - { - var availableLength = MaxLength - randomSuffix.Length; - - codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; - } - - return codeNameWithSuffix; - } - - - /// - protected override Task IsValueUnique(string value) - { - return Task.FromResult(codeNameValidator.IsUnique(value)); - } +namespace Migration.Toolkit.Core.KX13.Providers; + +using System.Threading.Tasks; +using CMS.Base; +using CMS.ContentEngine.Internal; + +internal class UniqueContentItemNameProvider : UniqueStringValueProviderBase +{ + private readonly IContentItemNameValidator codeNameValidator; + + + /// + /// Creates a new instance of . + /// + public UniqueContentItemNameProvider(IContentItemNameValidator codeNameValidator) + : base(TypeHelper.GetMaxCodeNameLength(ContentItemInfo.TYPEINFO.MaxCodeNameLength)) + { + this.codeNameValidator = codeNameValidator; + } + + public override Task GetUniqueValue(string inputValue) + { + return base.GetUniqueValue(AddSuffix(inputValue)); + } + + + private string AddSuffix(string codeName) + { + var randomSuffix = GetRandomSuffix(); + var codeNameWithSuffix = codeName += randomSuffix; + + if (codeNameWithSuffix.Length > MaxLength) + { + var availableLength = MaxLength - randomSuffix.Length; + + codeNameWithSuffix = $"{codeName[..availableLength]}{randomSuffix}"; + } + + return codeNameWithSuffix; + } + + + /// + protected override Task IsValueUnique(string value) + { + return Task.FromResult(codeNameValidator.IsUnique(value)); + } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Services/CmsClass/AttachmentSelectorItem.cs b/Migration.Toolkit.Core.KX13/Services/CmsClass/AttachmentSelectorItem.cs index 0bc3a300..c1a00a2d 100644 --- a/Migration.Toolkit.Core.KX13/Services/CmsClass/AttachmentSelectorItem.cs +++ b/Migration.Toolkit.Core.KX13/Services/CmsClass/AttachmentSelectorItem.cs @@ -1,11 +1,11 @@ -namespace Migration.Toolkit.Core.KX13.Services.CmsClass; - -using Newtonsoft.Json; - -/// Represents an item for the attachment selector. -public class AttachmentSelectorItem -{ - /// Attachment GUID. - [JsonProperty("fileGuid")] - public Guid FileGuid { get; set; } +namespace Migration.Toolkit.Core.KX13.Services.CmsClass; + +using Newtonsoft.Json; + +/// Represents an item for the attachment selector. +public class AttachmentSelectorItem +{ + /// Attachment GUID. + [JsonProperty("fileGuid")] + public Guid FileGuid { get; set; } } \ No newline at end of file diff --git a/Migration.Toolkit.Core.KX13/Services/CountryMigrator.cs b/Migration.Toolkit.Core.KX13/Services/CountryMigrator.cs index 3132a2e6..5815c15f 100644 --- a/Migration.Toolkit.Core.KX13/Services/CountryMigrator.cs +++ b/Migration.Toolkit.Core.KX13/Services/CountryMigrator.cs @@ -1,124 +1,124 @@ -namespace Migration.Toolkit.Core.KX13.Services; - -using CMS.Globalization; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common; -using Migration.Toolkit.Common.Abstractions; -using Migration.Toolkit.Common.MigrationProtocol; -using Migration.Toolkit.Core.KX13.Contexts; -using Migration.Toolkit.KX13.Context; -using Migration.Toolkit.KX13.Models; -using Migration.Toolkit.KXP.Api; - -public class CountryMigrator -{ - private readonly ILogger _logger; - private readonly IDbContextFactory _kx13ContextFactory; - private readonly PrimaryKeyMappingContext _primaryKeyMappingContext; - private readonly IProtocol _protocol; - private readonly IEntityMapper _countryMapper; - private readonly IEntityMapper _stateMapper; - private readonly KxpApiInitializer _kxpApiInitializer; - - public CountryMigrator( - ILogger logger, - IDbContextFactory kx13ContextFactory, - ToolkitConfiguration toolkitConfiguration, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol, - IEntityMapper countryMapper, - IEntityMapper stateMapper, - KxpApiInitializer kxpApiInitializer - ) - { - _logger = logger; - _kx13ContextFactory = kx13ContextFactory; - _primaryKeyMappingContext = primaryKeyMappingContext; - _protocol = protocol; - _countryMapper = countryMapper; - _stateMapper = stateMapper; - _kxpApiInitializer = kxpApiInitializer; - } - - public void MigrateCountriesAndStates() - { - if (!_kxpApiInitializer.EnsureApiIsInitialized()) - { - throw new InvalidOperationException($"Falied to initialize kentico API. Please check configuration."); - } - - var kx13Context = _kx13ContextFactory.CreateDbContext(); - - var kx13Countries = kx13Context.CmsCountries.AsNoTracking(); - foreach (var kx13CmsCountry in kx13Countries) - { - var kxpCountryInfo = CountryInfoProvider.ProviderObject.Get(kx13CmsCountry.CountryName); - - if (kxpCountryInfo != null) // do not update when exists - { - continue; - } - - var mapped = _countryMapper.Map(kx13CmsCountry, null); - _protocol.MappedTarget(mapped); - - if (mapped is (var countryInfo, var newInstance) { Success: true }) - { - try - { - CountryInfoProvider.ProviderObject.Set(countryInfo); - - _protocol.Success(kx13CmsCountry, countryInfo, mapped); - _logger.LogEntitySetAction(newInstance, countryInfo); - - _primaryKeyMappingContext.SetMapping(r => r.CountryId, kx13CmsCountry.CountryId, countryInfo.CountryID); - } - catch (Exception exception) - { - _logger.LogEntitySetError(exception, newInstance, countryInfo); - _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) - .NeedsManualAction() - .WithIdentityPrint(countryInfo) - ); - } - } - } - - - var kx13States = kx13Context.CmsStates.AsNoTracking(); - foreach (var kx13CmsState in kx13States) - { - var kxpStateInfo = StateInfoProvider.ProviderObject.Get(kx13CmsState.StateName); - - if (kxpStateInfo != null) // do not update when exists - { - continue; - } - - var mapped = _stateMapper.Map(kx13CmsState, null); - _protocol.MappedTarget(mapped); - - if (mapped is (var stateInfo, var newInstance) { Success: true }) - { - try - { - StateInfoProvider.ProviderObject.Set(stateInfo); - - _protocol.Success(kx13CmsState, stateInfo, mapped); - _logger.LogEntitySetAction(newInstance, stateInfo); - - _primaryKeyMappingContext.SetMapping(r => r.StateId, kx13CmsState.StateId, stateInfo.StateID); - } - catch (Exception exception) - { - _logger.LogEntitySetError(exception, newInstance, stateInfo); - _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) - .NeedsManualAction() - .WithIdentityPrint(stateInfo) - ); - } - } - } - } +namespace Migration.Toolkit.Core.KX13.Services; + +using CMS.Globalization; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common; +using Migration.Toolkit.Common.Abstractions; +using Migration.Toolkit.Common.MigrationProtocol; +using Migration.Toolkit.Core.KX13.Contexts; +using Migration.Toolkit.KX13.Context; +using Migration.Toolkit.KX13.Models; +using Migration.Toolkit.KXP.Api; + +public class CountryMigrator +{ + private readonly ILogger _logger; + private readonly IDbContextFactory _kx13ContextFactory; + private readonly PrimaryKeyMappingContext _primaryKeyMappingContext; + private readonly IProtocol _protocol; + private readonly IEntityMapper _countryMapper; + private readonly IEntityMapper _stateMapper; + private readonly KxpApiInitializer _kxpApiInitializer; + + public CountryMigrator( + ILogger logger, + IDbContextFactory kx13ContextFactory, + ToolkitConfiguration toolkitConfiguration, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol, + IEntityMapper countryMapper, + IEntityMapper stateMapper, + KxpApiInitializer kxpApiInitializer + ) + { + _logger = logger; + _kx13ContextFactory = kx13ContextFactory; + _primaryKeyMappingContext = primaryKeyMappingContext; + _protocol = protocol; + _countryMapper = countryMapper; + _stateMapper = stateMapper; + _kxpApiInitializer = kxpApiInitializer; + } + + public void MigrateCountriesAndStates() + { + if (!_kxpApiInitializer.EnsureApiIsInitialized()) + { + throw new InvalidOperationException($"Falied to initialize kentico API. Please check configuration."); + } + + var kx13Context = _kx13ContextFactory.CreateDbContext(); + + var kx13Countries = kx13Context.CmsCountries.AsNoTracking(); + foreach (var kx13CmsCountry in kx13Countries) + { + var kxpCountryInfo = CountryInfoProvider.ProviderObject.Get(kx13CmsCountry.CountryName); + + if (kxpCountryInfo != null) // do not update when exists + { + continue; + } + + var mapped = _countryMapper.Map(kx13CmsCountry, null); + _protocol.MappedTarget(mapped); + + if (mapped is (var countryInfo, var newInstance) { Success: true }) + { + try + { + CountryInfoProvider.ProviderObject.Set(countryInfo); + + _protocol.Success(kx13CmsCountry, countryInfo, mapped); + _logger.LogEntitySetAction(newInstance, countryInfo); + + _primaryKeyMappingContext.SetMapping(r => r.CountryId, kx13CmsCountry.CountryId, countryInfo.CountryID); + } + catch (Exception exception) + { + _logger.LogEntitySetError(exception, newInstance, countryInfo); + _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) + .NeedsManualAction() + .WithIdentityPrint(countryInfo) + ); + } + } + } + + + var kx13States = kx13Context.CmsStates.AsNoTracking(); + foreach (var kx13CmsState in kx13States) + { + var kxpStateInfo = StateInfoProvider.ProviderObject.Get(kx13CmsState.StateName); + + if (kxpStateInfo != null) // do not update when exists + { + continue; + } + + var mapped = _stateMapper.Map(kx13CmsState, null); + _protocol.MappedTarget(mapped); + + if (mapped is (var stateInfo, var newInstance) { Success: true }) + { + try + { + StateInfoProvider.ProviderObject.Set(stateInfo); + + _protocol.Success(kx13CmsState, stateInfo, mapped); + _logger.LogEntitySetAction(newInstance, stateInfo); + + _primaryKeyMappingContext.SetMapping(r => r.StateId, kx13CmsState.StateId, stateInfo.StateID); + } + catch (Exception exception) + { + _logger.LogEntitySetError(exception, newInstance, stateInfo); + _protocol.Append(HandbookReferences.ErrorCreatingTargetInstance(exception) + .NeedsManualAction() + .WithIdentityPrint(stateInfo) + ); + } + } + } + } } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Auxiliary/Kx13FormControls.cs b/Migration.Toolkit.K11/Auxiliary/Kx13FormControls.cs index 723a7c70..a6c6af79 100644 --- a/Migration.Toolkit.K11/Auxiliary/Kx13FormControls.cs +++ b/Migration.Toolkit.K11/Auxiliary/Kx13FormControls.cs @@ -1,233 +1,233 @@ -// ReSharper disable InconsistentNaming -namespace Migration.Toolkit.K11.Auxiliary; - -public class Kx12FormControls -{ - public class UserControlForText - { - public const string AbTestConversionTypeSelector = "ABTestConversionTypeSelector"; - public const string ActivityTypeSelector = "ActivityTypeSelector"; - public const string AllowedExtensionsSelector = "AllowedExtensionsSelector"; - public const string Selectalternativeform = "selectalternativeform"; - public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; - public const string AssemblyClassSelector = "AssemblyClassSelector"; - public const string Fieldselector = "fieldselector"; - public const string BizFormSelector = "BizFormSelector"; - public const string BundleInventoryTypeSelector = "BundleInventoryTypeSelector"; - public const string CampaignSelector = "CampaignSelector"; - public const string CategorySelector = "CategorySelector"; - public const string ClassFieldSelector = "ClassFieldSelector"; - public const string ClassFields = "Class_fields"; - public const string CodeName = "CodeName"; - public const string CodeNameWithPrefix = "CodeNameWithPrefix"; - public const string Selectcolor = "selectcolor"; - public const string Columns = "Columns"; - public const string ConnectionStringSelector = "Connection_string_selector"; - public const string ContactClassFields = "Contact_class_fields"; - public const string CountrySelector = "countrySelector"; - public const string CssStylesEditor = "CSS_Styles_Editor"; - public const string Selectculture = "selectculture"; - public const string CultureSelectorForSettings = "CultureSelectorForSettings"; - public const string CurrencySelector = "currencySelector"; - public const string CustomTableItemSelector = "CustomTableItemSelector"; - public const string CustomTableSelector = "CustomTableSelector"; - public const string Selectcolumns = "selectcolumns"; - public const string DepartmentSelector = "DepartmentSelector"; - public const string DropDownListControl = "DropDownListControl"; - public const string DueDateSelector = "Due_date_selector"; - public const string Emailinput = "emailinput"; - public const string EmailTemplateSelector = "Email_template_selector"; - public const string EmailTemplateTypeSelector = "Email_template_type_selector"; - public const string EncodingTextBox = "EncodingTextBox"; - public const string EncryptedPassword = "EncryptedPassword"; - public const string EnumSelector = "EnumSelector"; - public const string EventLogTypeSelector = "EventLogTypeSelector"; - public const string FacebookAutoPost = "Facebook_auto_post"; - public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; - public const string FileSystemSelector = "FileSystemSelector"; - public const string FontIconSelector = "FontIconSelector"; - public const string FormFieldSelector = "FormFieldSelector"; - public const string FormPassword = "FormPassword"; - public const string FullMediaLibrarySelector = "FullMediaLibrarySelector"; - public const string GetGoogleTranslatorApiKey = "Get_Google_Translator_API_key"; - public const string GetMsTranslatorTextApiKey = "GetMSTranslatorTextAPIKey"; - public const string GoToExternalUrl = "Go_to_external_URL"; - public const string GoogleAnalyticsParameterSelector = "Google_Analytics_parameter_selector"; - public const string Html5Input = "HTML5Input"; - public const string IconSelector = "IconSelector"; - public const string InternalStatusSelector = "InternalStatusSelector"; - public const string Internationalphone = "internationalphone"; - public const string LabelControl = "LabelControl"; - public const string LargeTextArea = "LargeTextArea"; - public const string LicenseSelector = "LicenseSelector"; - public const string LinkedInAutoPost = "LinkedInAutoPost"; - public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; - public const string ListBoxControl = "ListBoxControl"; - public const string LocalizableTextArea = "LocalizableTextArea"; - public const string LocalizableTextBox = "LocalizableTextBox"; - public const string MacroAnyAllBoolSelector = "Macro_any-all_bool_selector"; - public const string MacroAnyAllSelector = "MacroAnyAllSelector"; - public const string MacroDateOperator = "Macro_date_operator"; - public const string MacroEditor = "MacroEditor"; - public const string MacroEqualityOperator = "MacroEqualityOperator"; - public const string MacroNegationOperator = "MacroNegationOperator"; - public const string MacroNumericOperator = "Macro_numeric_operator"; - public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; - public const string MacroTextOperator = "Macro_text_operator"; - public const string MacroType = "MacroType"; - public const string ManufacturerSelector = "ManufacturerSelector"; - public const string MediaLibrarySelector = "MediaLibrarySelector"; - public const string MediaSelectionControl = "MediaSelectionControl"; - public const string MembershipSelector = "MembershipSelector"; - public const string MetafileUploaderControl = "MetafileUploaderControl"; - public const string ModuleSelector = "ModuleSelector"; - public const string MultipleCategoriesSelector = "MultipleCategoriesSelector"; - public const string MultipleChoiceControl = "MultipleChoiceControl"; - public const string RoleCheckboxSelector = "RoleCheckboxSelector"; - public const string SimpleCheckboxRoleSelector = "SimpleCheckboxRoleSelector"; - public const string SimpleCheckboxSiteSelector = "SimpleCheckboxSiteSelector"; - public const string MultipleUserSelector = "MultipleUserSelector"; - public const string NewsletterSelector = "NewsletterSelector"; - public const string NewsletterSelectorSimple = "NewsletterSelectorSimple"; - public const string NumericUpDown = "NumericUpDown"; - public const string ObjectColumnSelector = "ObjectColumnSelector"; - public const string ObjectSelector = "ObjectSelector"; - public const string ObjectTransformation = "ObjectTransformation"; - public const string ObjectTypeBinSelector = "ObjectTypeBinSelector"; - public const string ObjectTypeSelector = "ObjectTypeSelector"; - public const string OptionCategoryProductOptionSelector = "OptionCategoryProductOptionSelector"; - public const string OptionCategorySelectionTypeSelector = "OptionCategorySelectionTypeSelector"; - public const string OrderBy = "OrderBy"; - public const string OrderStatusSelector = "OrderStatusSelector"; - public const string DocumentCultureFilter = "DocumentCultureFilter"; - public const string PageLayoutCode = "Page_layout_code"; - public const string Selectdocument = "selectdocument"; - public const string PageTemplateLevels = "PageTemplateLevels"; - public const string Selectpagetemplate = "selectpagetemplate"; - public const string DocumentTypeIconSelector = "DocumentTypeIconSelector"; - public const string Selectclassnames = "selectclassnames"; - public const string Password = "Password"; - public const string PasswordStrength = "PasswordStrength"; - public const string PasswordConfirmator = "PasswordConfirmator"; - public const string Selectpath = "selectpath"; - public const string PaymentSelector = "paymentSelector"; - public const string ProductImageSelector = "ProductImageSelector"; - public const string ProductRelationshipNameSelector = "ProductRelationshipNameSelector"; - public const string ProductSectionsSelector = "ProductSectionsSelector"; - public const string ProductTypeSelector = "ProductTypeSelector"; - public const string PublicStatusSelector = "PublicStatusSelector"; - public const string Selectquery = "selectquery"; - public const string RadioButtonsControl = "RadioButtonsControl"; - public const string AgeRangeSelector = "AgeRangeSelector"; - public const string RelatedDocuments = "RelatedDocuments"; - public const string Relationshipconfiguration = "relationshipconfiguration"; - public const string SelectRelationshipName = "SelectRelationshipName"; - public const string ReportSelectorDropDown = "ReportSelectorDropDown"; - public const string RoleSelector = "RoleSelector"; - public const string SearchClassNameSelector = "SearchClassNameSelector"; - public const string SearchIndexSelector = "SearchIndexSelector"; - public const string SearchIndexTypeSelector = "SearchIndexTypeSelector"; - public const string SelectCmsVersion = "SelectCMSVersion"; - public const string SettingsKeyControlSelector = "SettingsKeyControlSelector"; - public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; - public const string SharePointListSelector = "SharePointListSelector"; - public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; - public const string ShippingSelector = "shippingSelector"; - public const string ShippingServiceSelector = "ShippingServiceSelector"; - public const string Selectsinglepath = "selectsinglepath"; - public const string SinglePathSelectorWithPermissions = "SinglePathSelectorWithPermissions"; - public const string SiteContentCulture = "SiteContentCulture"; - public const string SiteCultureSelector = "SiteCultureSelector"; - public const string SiteCultureSelectorAll = "SiteCultureSelectorAll"; - public const string Selectsite = "selectsite"; - public const string SiteSelectorWithAllFieldForGlobalAdmin = "SiteSelectorWithAllFieldForGlobalAdmin"; - public const string SkuSelector = "SKUSelector"; - public const string StopWordsSelector = "StopWordsSelector"; - public const string SupplierSelector = "SupplierSelector"; - public const string SupportedCultureSelector = "SupportedCultureSelector"; - public const string TableConversionSettings = "TableConversionSettings"; - public const string TagGroupSelector = "TagGroupSelector"; - public const string TagSelector = "TagSelector"; - public const string TaxAddressTypeSelector = "TaxAddressTypeSelector"; - public const string TextAreaControl = "TextAreaControl"; - public const string TextBoxControl = "TextBoxControl"; - public const string TextFilter = "TextFilter"; - public const string TextboxDefaultValueFromSetting = "Textbox_default_value_from_setting"; - public const string TextboxDoubleValidator = "Textbox_double_validator"; - public const string TimeZoneSelector = "TimeZoneSelector"; - public const string TimeZoneTypeSelector = "TimeZoneTypeSelector"; - public const string ToggleButton = "ToggleButton"; - public const string Selecttransformation = "selecttransformation"; - public const string TranslationServiceSelector = "Translation_service_selector"; - public const string TwitterAutoPost = "Twitter_auto_post"; - public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; - public const string Usphone = "usphone"; - public const string Uszipcode = "uszipcode"; - public const string UiCultureSelector = "UICultureSelector"; - public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; - public const string UniSelector = "Uni_selector"; - public const string UrlChecker = "UrlChecker"; - public const string UrlSelector = "URLSelector"; - public const string SmurlShortenerSelector = "SMURLShortenerSelector"; - public const string UserName = "UserName"; - public const string UserNameSelector = "UserNameSelector"; - public const string UserSelector = "UserSelector"; - public const string ValiditySelector = "ValiditySelector"; - public const string ViewSecureText = "ViewSecureText"; - public const string WhereCondition = "WhereCondition"; - public const string WorkflowScopeDefinition = "WorkflowScopeDefinition"; - } - - public class UserControlForLongText - { - public const string AbTestConversionSelector = "ABTestConversionSelector"; - public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; - public const string BbEditorControl = "BBEditorControl"; - public const string CacheDependencies = "CacheDependencies"; - public const string ClassFields = "Class_fields"; - public const string Columns = "Columns"; - public const string ConditionBuilder = "ConditionBuilder"; - public const string ContactClassFields = "Contact_class_fields"; - public const string CssStylesEditor = "CSS_Styles_Editor"; - public const string Selectcolumns = "selectcolumns"; - public const string DropDownListControl = "DropDownListControl"; - public const string FacebookAutoPost = "Facebook_auto_post"; - public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; - public const string FileSystemSelector = "FileSystemSelector"; - public const string Html5Input = "HTML5Input"; - public const string AutoResizeConfiguration = "AutoResizeConfiguration"; - public const string LabelControl = "LabelControl"; - public const string LargeTextArea = "LargeTextArea"; - public const string LinkedInAutoPost = "LinkedInAutoPost"; - public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; - public const string LocalizableTextArea = "LocalizableTextArea"; - public const string LocalizableTextBox = "LocalizableTextBox"; - public const string MacroEditor = "MacroEditor"; - public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; - public const string MultipleObjectBindingControl = "MultipleObjectBindingControl"; - public const string ObjectTypeSelector = "ObjectTypeSelector"; - public const string OptionsSelector = "OptionsSelector"; - public const string OrderBy = "OrderBy"; - public const string PageLayoutCode = "Page_layout_code"; - public const string ProductSectionsSelector = "ProductSectionsSelector"; - public const string RelatedDocuments = "RelatedDocuments"; - public const string ReportGraphSelector = "ReportGraphSelector"; - public const string ReportTableSelector = "ReportTableSelector"; - public const string ReportValueSelector = "ReportValueSelector"; - public const string HtmlAreaControl = "HtmlAreaControl"; - public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; - public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; - public const string TagSelector = "TagSelector"; - public const string TextAreaControl = "TextAreaControl"; - public const string TextBoxControl = "TextBoxControl"; - public const string TextFilter = "TextFilter"; - public const string TranslationServiceSelector = "Translation_service_selector"; - public const string TwitterAutoPost = "Twitter_auto_post"; - public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; - public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; - public const string UniSelector = "Uni_selector"; - public const string SmurlShortenerSelector = "SMURLShortenerSelector"; - public const string ViewSecureText = "ViewSecureText"; - public const string WhereCondition = "WhereCondition"; - } +// ReSharper disable InconsistentNaming +namespace Migration.Toolkit.K11.Auxiliary; + +public class Kx12FormControls +{ + public class UserControlForText + { + public const string AbTestConversionTypeSelector = "ABTestConversionTypeSelector"; + public const string ActivityTypeSelector = "ActivityTypeSelector"; + public const string AllowedExtensionsSelector = "AllowedExtensionsSelector"; + public const string Selectalternativeform = "selectalternativeform"; + public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; + public const string AssemblyClassSelector = "AssemblyClassSelector"; + public const string Fieldselector = "fieldselector"; + public const string BizFormSelector = "BizFormSelector"; + public const string BundleInventoryTypeSelector = "BundleInventoryTypeSelector"; + public const string CampaignSelector = "CampaignSelector"; + public const string CategorySelector = "CategorySelector"; + public const string ClassFieldSelector = "ClassFieldSelector"; + public const string ClassFields = "Class_fields"; + public const string CodeName = "CodeName"; + public const string CodeNameWithPrefix = "CodeNameWithPrefix"; + public const string Selectcolor = "selectcolor"; + public const string Columns = "Columns"; + public const string ConnectionStringSelector = "Connection_string_selector"; + public const string ContactClassFields = "Contact_class_fields"; + public const string CountrySelector = "countrySelector"; + public const string CssStylesEditor = "CSS_Styles_Editor"; + public const string Selectculture = "selectculture"; + public const string CultureSelectorForSettings = "CultureSelectorForSettings"; + public const string CurrencySelector = "currencySelector"; + public const string CustomTableItemSelector = "CustomTableItemSelector"; + public const string CustomTableSelector = "CustomTableSelector"; + public const string Selectcolumns = "selectcolumns"; + public const string DepartmentSelector = "DepartmentSelector"; + public const string DropDownListControl = "DropDownListControl"; + public const string DueDateSelector = "Due_date_selector"; + public const string Emailinput = "emailinput"; + public const string EmailTemplateSelector = "Email_template_selector"; + public const string EmailTemplateTypeSelector = "Email_template_type_selector"; + public const string EncodingTextBox = "EncodingTextBox"; + public const string EncryptedPassword = "EncryptedPassword"; + public const string EnumSelector = "EnumSelector"; + public const string EventLogTypeSelector = "EventLogTypeSelector"; + public const string FacebookAutoPost = "Facebook_auto_post"; + public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; + public const string FileSystemSelector = "FileSystemSelector"; + public const string FontIconSelector = "FontIconSelector"; + public const string FormFieldSelector = "FormFieldSelector"; + public const string FormPassword = "FormPassword"; + public const string FullMediaLibrarySelector = "FullMediaLibrarySelector"; + public const string GetGoogleTranslatorApiKey = "Get_Google_Translator_API_key"; + public const string GetMsTranslatorTextApiKey = "GetMSTranslatorTextAPIKey"; + public const string GoToExternalUrl = "Go_to_external_URL"; + public const string GoogleAnalyticsParameterSelector = "Google_Analytics_parameter_selector"; + public const string Html5Input = "HTML5Input"; + public const string IconSelector = "IconSelector"; + public const string InternalStatusSelector = "InternalStatusSelector"; + public const string Internationalphone = "internationalphone"; + public const string LabelControl = "LabelControl"; + public const string LargeTextArea = "LargeTextArea"; + public const string LicenseSelector = "LicenseSelector"; + public const string LinkedInAutoPost = "LinkedInAutoPost"; + public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; + public const string ListBoxControl = "ListBoxControl"; + public const string LocalizableTextArea = "LocalizableTextArea"; + public const string LocalizableTextBox = "LocalizableTextBox"; + public const string MacroAnyAllBoolSelector = "Macro_any-all_bool_selector"; + public const string MacroAnyAllSelector = "MacroAnyAllSelector"; + public const string MacroDateOperator = "Macro_date_operator"; + public const string MacroEditor = "MacroEditor"; + public const string MacroEqualityOperator = "MacroEqualityOperator"; + public const string MacroNegationOperator = "MacroNegationOperator"; + public const string MacroNumericOperator = "Macro_numeric_operator"; + public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; + public const string MacroTextOperator = "Macro_text_operator"; + public const string MacroType = "MacroType"; + public const string ManufacturerSelector = "ManufacturerSelector"; + public const string MediaLibrarySelector = "MediaLibrarySelector"; + public const string MediaSelectionControl = "MediaSelectionControl"; + public const string MembershipSelector = "MembershipSelector"; + public const string MetafileUploaderControl = "MetafileUploaderControl"; + public const string ModuleSelector = "ModuleSelector"; + public const string MultipleCategoriesSelector = "MultipleCategoriesSelector"; + public const string MultipleChoiceControl = "MultipleChoiceControl"; + public const string RoleCheckboxSelector = "RoleCheckboxSelector"; + public const string SimpleCheckboxRoleSelector = "SimpleCheckboxRoleSelector"; + public const string SimpleCheckboxSiteSelector = "SimpleCheckboxSiteSelector"; + public const string MultipleUserSelector = "MultipleUserSelector"; + public const string NewsletterSelector = "NewsletterSelector"; + public const string NewsletterSelectorSimple = "NewsletterSelectorSimple"; + public const string NumericUpDown = "NumericUpDown"; + public const string ObjectColumnSelector = "ObjectColumnSelector"; + public const string ObjectSelector = "ObjectSelector"; + public const string ObjectTransformation = "ObjectTransformation"; + public const string ObjectTypeBinSelector = "ObjectTypeBinSelector"; + public const string ObjectTypeSelector = "ObjectTypeSelector"; + public const string OptionCategoryProductOptionSelector = "OptionCategoryProductOptionSelector"; + public const string OptionCategorySelectionTypeSelector = "OptionCategorySelectionTypeSelector"; + public const string OrderBy = "OrderBy"; + public const string OrderStatusSelector = "OrderStatusSelector"; + public const string DocumentCultureFilter = "DocumentCultureFilter"; + public const string PageLayoutCode = "Page_layout_code"; + public const string Selectdocument = "selectdocument"; + public const string PageTemplateLevels = "PageTemplateLevels"; + public const string Selectpagetemplate = "selectpagetemplate"; + public const string DocumentTypeIconSelector = "DocumentTypeIconSelector"; + public const string Selectclassnames = "selectclassnames"; + public const string Password = "Password"; + public const string PasswordStrength = "PasswordStrength"; + public const string PasswordConfirmator = "PasswordConfirmator"; + public const string Selectpath = "selectpath"; + public const string PaymentSelector = "paymentSelector"; + public const string ProductImageSelector = "ProductImageSelector"; + public const string ProductRelationshipNameSelector = "ProductRelationshipNameSelector"; + public const string ProductSectionsSelector = "ProductSectionsSelector"; + public const string ProductTypeSelector = "ProductTypeSelector"; + public const string PublicStatusSelector = "PublicStatusSelector"; + public const string Selectquery = "selectquery"; + public const string RadioButtonsControl = "RadioButtonsControl"; + public const string AgeRangeSelector = "AgeRangeSelector"; + public const string RelatedDocuments = "RelatedDocuments"; + public const string Relationshipconfiguration = "relationshipconfiguration"; + public const string SelectRelationshipName = "SelectRelationshipName"; + public const string ReportSelectorDropDown = "ReportSelectorDropDown"; + public const string RoleSelector = "RoleSelector"; + public const string SearchClassNameSelector = "SearchClassNameSelector"; + public const string SearchIndexSelector = "SearchIndexSelector"; + public const string SearchIndexTypeSelector = "SearchIndexTypeSelector"; + public const string SelectCmsVersion = "SelectCMSVersion"; + public const string SettingsKeyControlSelector = "SettingsKeyControlSelector"; + public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; + public const string SharePointListSelector = "SharePointListSelector"; + public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; + public const string ShippingSelector = "shippingSelector"; + public const string ShippingServiceSelector = "ShippingServiceSelector"; + public const string Selectsinglepath = "selectsinglepath"; + public const string SinglePathSelectorWithPermissions = "SinglePathSelectorWithPermissions"; + public const string SiteContentCulture = "SiteContentCulture"; + public const string SiteCultureSelector = "SiteCultureSelector"; + public const string SiteCultureSelectorAll = "SiteCultureSelectorAll"; + public const string Selectsite = "selectsite"; + public const string SiteSelectorWithAllFieldForGlobalAdmin = "SiteSelectorWithAllFieldForGlobalAdmin"; + public const string SkuSelector = "SKUSelector"; + public const string StopWordsSelector = "StopWordsSelector"; + public const string SupplierSelector = "SupplierSelector"; + public const string SupportedCultureSelector = "SupportedCultureSelector"; + public const string TableConversionSettings = "TableConversionSettings"; + public const string TagGroupSelector = "TagGroupSelector"; + public const string TagSelector = "TagSelector"; + public const string TaxAddressTypeSelector = "TaxAddressTypeSelector"; + public const string TextAreaControl = "TextAreaControl"; + public const string TextBoxControl = "TextBoxControl"; + public const string TextFilter = "TextFilter"; + public const string TextboxDefaultValueFromSetting = "Textbox_default_value_from_setting"; + public const string TextboxDoubleValidator = "Textbox_double_validator"; + public const string TimeZoneSelector = "TimeZoneSelector"; + public const string TimeZoneTypeSelector = "TimeZoneTypeSelector"; + public const string ToggleButton = "ToggleButton"; + public const string Selecttransformation = "selecttransformation"; + public const string TranslationServiceSelector = "Translation_service_selector"; + public const string TwitterAutoPost = "Twitter_auto_post"; + public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; + public const string Usphone = "usphone"; + public const string Uszipcode = "uszipcode"; + public const string UiCultureSelector = "UICultureSelector"; + public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; + public const string UniSelector = "Uni_selector"; + public const string UrlChecker = "UrlChecker"; + public const string UrlSelector = "URLSelector"; + public const string SmurlShortenerSelector = "SMURLShortenerSelector"; + public const string UserName = "UserName"; + public const string UserNameSelector = "UserNameSelector"; + public const string UserSelector = "UserSelector"; + public const string ValiditySelector = "ValiditySelector"; + public const string ViewSecureText = "ViewSecureText"; + public const string WhereCondition = "WhereCondition"; + public const string WorkflowScopeDefinition = "WorkflowScopeDefinition"; + } + + public class UserControlForLongText + { + public const string AbTestConversionSelector = "ABTestConversionSelector"; + public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; + public const string BbEditorControl = "BBEditorControl"; + public const string CacheDependencies = "CacheDependencies"; + public const string ClassFields = "Class_fields"; + public const string Columns = "Columns"; + public const string ConditionBuilder = "ConditionBuilder"; + public const string ContactClassFields = "Contact_class_fields"; + public const string CssStylesEditor = "CSS_Styles_Editor"; + public const string Selectcolumns = "selectcolumns"; + public const string DropDownListControl = "DropDownListControl"; + public const string FacebookAutoPost = "Facebook_auto_post"; + public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; + public const string FileSystemSelector = "FileSystemSelector"; + public const string Html5Input = "HTML5Input"; + public const string AutoResizeConfiguration = "AutoResizeConfiguration"; + public const string LabelControl = "LabelControl"; + public const string LargeTextArea = "LargeTextArea"; + public const string LinkedInAutoPost = "LinkedInAutoPost"; + public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; + public const string LocalizableTextArea = "LocalizableTextArea"; + public const string LocalizableTextBox = "LocalizableTextBox"; + public const string MacroEditor = "MacroEditor"; + public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; + public const string MultipleObjectBindingControl = "MultipleObjectBindingControl"; + public const string ObjectTypeSelector = "ObjectTypeSelector"; + public const string OptionsSelector = "OptionsSelector"; + public const string OrderBy = "OrderBy"; + public const string PageLayoutCode = "Page_layout_code"; + public const string ProductSectionsSelector = "ProductSectionsSelector"; + public const string RelatedDocuments = "RelatedDocuments"; + public const string ReportGraphSelector = "ReportGraphSelector"; + public const string ReportTableSelector = "ReportTableSelector"; + public const string ReportValueSelector = "ReportValueSelector"; + public const string HtmlAreaControl = "HtmlAreaControl"; + public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; + public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; + public const string TagSelector = "TagSelector"; + public const string TextAreaControl = "TextAreaControl"; + public const string TextBoxControl = "TextBoxControl"; + public const string TextFilter = "TextFilter"; + public const string TranslationServiceSelector = "Translation_service_selector"; + public const string TwitterAutoPost = "Twitter_auto_post"; + public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; + public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; + public const string UniSelector = "Uni_selector"; + public const string SmurlShortenerSelector = "SMURLShortenerSelector"; + public const string ViewSecureText = "ViewSecureText"; + public const string WhereCondition = "WhereCondition"; + } } \ No newline at end of file diff --git a/Migration.Toolkit.K11/ContextCustomizations.cs b/Migration.Toolkit.K11/ContextCustomizations.cs index ddfed0eb..4aedb9eb 100644 --- a/Migration.Toolkit.K11/ContextCustomizations.cs +++ b/Migration.Toolkit.K11/ContextCustomizations.cs @@ -1,14 +1,14 @@ -namespace Migration.Toolkit.K11; - -using Microsoft.EntityFrameworkCore; - -public partial class K11Context -{ - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - optionsBuilder - .EnableDetailedErrors() - .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); - base.OnConfiguring(optionsBuilder); - } +namespace Migration.Toolkit.K11; + +using Microsoft.EntityFrameworkCore; + +public partial class K11Context +{ + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder + .EnableDetailedErrors() + .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); + base.OnConfiguring(optionsBuilder); + } } \ No newline at end of file diff --git a/Migration.Toolkit.K11/DependencyInjectionExtensions.cs b/Migration.Toolkit.K11/DependencyInjectionExtensions.cs index 93753b61..787ccdff 100644 --- a/Migration.Toolkit.K11/DependencyInjectionExtensions.cs +++ b/Migration.Toolkit.K11/DependencyInjectionExtensions.cs @@ -1,14 +1,14 @@ -namespace Migration.Toolkit.K11; - -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Migration.Toolkit.Common; - -public static class DependencyInjectionExtensions -{ - public static IServiceCollection UseK11DbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) - { - services.AddDbContextFactory(options => options.UseSqlServer(toolkitConfiguration.KxConnectionString)); - return services; - } +namespace Migration.Toolkit.K11; + +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Migration.Toolkit.Common; + +public static class DependencyInjectionExtensions +{ + public static IServiceCollection UseK11DbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) + { + services.AddDbContextFactory(options => options.UseSqlServer(toolkitConfiguration.KxConnectionString)); + return services; + } } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsExternalLogin.cs b/Migration.Toolkit.K11/Models/CmsExternalLogin.cs index 0b3ed3cc..bf59ba7c 100644 --- a/Migration.Toolkit.K11/Models/CmsExternalLogin.cs +++ b/Migration.Toolkit.K11/Models/CmsExternalLogin.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -26,4 +27,34 @@ public partial class CmsExternalLogin [ForeignKey("UserId")] [InverseProperty("CmsExternalLogins")] public virtual CmsUser User { get; set; } = null!; +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_ExternalLogin")] +[Index("UserId", Name = "IX_CMS_ExternalLogin_UserID")] +public partial class CmsExternalLogin +{ + [Key] + [Column("ExternalLoginID")] + public int ExternalLoginId { get; set; } + + [Column("UserID")] + public int UserId { get; set; } + + [StringLength(200)] + public string? LoginProvider { get; set; } + + [StringLength(200)] + public string? IdentityKey { get; set; } + + [ForeignKey("UserId")] + [InverseProperty("CmsExternalLogins")] + public virtual CmsUser User { get; set; } = null!; +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsForm.cs b/Migration.Toolkit.K11/Models/CmsForm.cs index d8960d78..7ffcf35c 100644 --- a/Migration.Toolkit.K11/Models/CmsForm.cs +++ b/Migration.Toolkit.K11/Models/CmsForm.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -88,4 +89,96 @@ public partial class CmsForm [ForeignKey("FormId")] [InverseProperty("Forms")] public virtual ICollection Roles { get; set; } = new List(); +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_Form")] +[Index("FormClassId", Name = "IX_CMS_Form_FormClassID")] +[Index("FormSiteId", Name = "IX_CMS_Form_FormSiteID")] +public partial class CmsForm +{ + [Key] + [Column("FormID")] + public int FormId { get; set; } + + [StringLength(100)] + public string FormDisplayName { get; set; } = null!; + + [StringLength(100)] + public string FormName { get; set; } = null!; + + [StringLength(998)] + public string? FormSendToEmail { get; set; } + + [StringLength(254)] + public string? FormSendFromEmail { get; set; } + + [StringLength(250)] + public string? FormEmailSubject { get; set; } + + public string? FormEmailTemplate { get; set; } + + public bool? FormEmailAttachUploadedDocs { get; set; } + + [Column("FormClassID")] + public int FormClassId { get; set; } + + public int FormItems { get; set; } + + public string? FormReportFields { get; set; } + + [StringLength(400)] + public string? FormRedirectToUrl { get; set; } + + public string? FormDisplayText { get; set; } + + public bool FormClearAfterSave { get; set; } + + [StringLength(400)] + public string? FormSubmitButtonText { get; set; } + + [Column("FormSiteID")] + public int FormSiteId { get; set; } + + [StringLength(254)] + public string? FormConfirmationEmailField { get; set; } + + public string? FormConfirmationTemplate { get; set; } + + [StringLength(254)] + public string? FormConfirmationSendFromEmail { get; set; } + + [StringLength(250)] + public string? FormConfirmationEmailSubject { get; set; } + + public int? FormAccess { get; set; } + + [StringLength(255)] + public string? FormSubmitButtonImage { get; set; } + + [Column("FormGUID")] + public Guid FormGuid { get; set; } + + public DateTime FormLastModified { get; set; } + + public bool? FormLogActivity { get; set; } + + [ForeignKey("FormClassId")] + [InverseProperty("CmsForms")] + public virtual CmsClass FormClass { get; set; } = null!; + + [ForeignKey("FormSiteId")] + [InverseProperty("CmsForms")] + public virtual CmsSite FormSite { get; set; } = null!; + + [ForeignKey("FormId")] + [InverseProperty("Forms")] + public virtual ICollection Roles { get; set; } = new List(); +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsFormUserControl.cs b/Migration.Toolkit.K11/Models/CmsFormUserControl.cs index 94140bb7..a3389140 100644 --- a/Migration.Toolkit.K11/Models/CmsFormUserControl.cs +++ b/Migration.Toolkit.K11/Models/CmsFormUserControl.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -106,4 +107,114 @@ public partial class CmsFormUserControl [ForeignKey("UserControlResourceId")] [InverseProperty("CmsFormUserControls")] public virtual CmsResource? UserControlResource { get; set; } +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_FormUserControl")] +[Index("UserControlCodeName", Name = "IX_CMS_FormUserControl_UserControlCodeName", IsUnique = true)] +[Index("UserControlParentId", Name = "IX_CMS_FormUserControl_UserControlParentID")] +[Index("UserControlResourceId", Name = "IX_CMS_FormUserControl_UserControlResourceID")] +public partial class CmsFormUserControl +{ + [Key] + [Column("UserControlID")] + public int UserControlId { get; set; } + + [StringLength(200)] + public string UserControlDisplayName { get; set; } = null!; + + [StringLength(200)] + public string UserControlCodeName { get; set; } = null!; + + [StringLength(400)] + public string UserControlFileName { get; set; } = null!; + + public bool UserControlForText { get; set; } + + public bool UserControlForLongText { get; set; } + + public bool UserControlForInteger { get; set; } + + public bool UserControlForDecimal { get; set; } + + public bool UserControlForDateTime { get; set; } + + public bool UserControlForBoolean { get; set; } + + public bool UserControlForFile { get; set; } + + public bool UserControlShowInBizForms { get; set; } + + [StringLength(50)] + public string UserControlDefaultDataType { get; set; } = null!; + + public int? UserControlDefaultDataTypeSize { get; set; } + + public bool? UserControlShowInDocumentTypes { get; set; } + + public bool? UserControlShowInSystemTables { get; set; } + + public bool? UserControlShowInWebParts { get; set; } + + public bool? UserControlShowInReports { get; set; } + + [Column("UserControlGUID")] + public Guid UserControlGuid { get; set; } + + public DateTime UserControlLastModified { get; set; } + + public bool UserControlForGuid { get; set; } + + public bool? UserControlShowInCustomTables { get; set; } + + public bool UserControlForVisibility { get; set; } + + public string? UserControlParameters { get; set; } + + public bool UserControlForDocAttachments { get; set; } + + [Column("UserControlResourceID")] + public int? UserControlResourceId { get; set; } + + public int? UserControlType { get; set; } + + [Column("UserControlParentID")] + public int? UserControlParentId { get; set; } + + public string? UserControlDescription { get; set; } + + [Column("UserControlThumbnailGUID")] + public Guid? UserControlThumbnailGuid { get; set; } + + public int? UserControlPriority { get; set; } + + public bool? UserControlIsSystem { get; set; } + + public bool UserControlForBinary { get; set; } + + public bool UserControlForDocRelationships { get; set; } + + [StringLength(200)] + public string? UserControlAssemblyName { get; set; } + + [StringLength(200)] + public string? UserControlClassName { get; set; } + + [InverseProperty("UserControlParent")] + public virtual ICollection InverseUserControlParent { get; set; } = new List(); + + [ForeignKey("UserControlParentId")] + [InverseProperty("InverseUserControlParent")] + public virtual CmsFormUserControl? UserControlParent { get; set; } + + [ForeignKey("UserControlResourceId")] + [InverseProperty("CmsFormUserControls")] + public virtual CmsResource? UserControlResource { get; set; } +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsHelpTopic.cs b/Migration.Toolkit.K11/Models/CmsHelpTopic.cs index 3854d6b9..ff7f5ebc 100644 --- a/Migration.Toolkit.K11/Models/CmsHelpTopic.cs +++ b/Migration.Toolkit.K11/Models/CmsHelpTopic.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -33,4 +34,41 @@ public partial class CmsHelpTopic [ForeignKey("HelpTopicUielementId")] [InverseProperty("CmsHelpTopics")] public virtual CmsUielement HelpTopicUielement { get; set; } = null!; +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_HelpTopic")] +[Index("HelpTopicUielementId", Name = "IX_CMS_HelpTopic_HelpTopicUIElementID")] +public partial class CmsHelpTopic +{ + [Key] + [Column("HelpTopicID")] + public int HelpTopicId { get; set; } + + [Column("HelpTopicUIElementID")] + public int HelpTopicUielementId { get; set; } + + [StringLength(200)] + public string HelpTopicName { get; set; } = null!; + + [StringLength(1023)] + public string HelpTopicLink { get; set; } = null!; + + public DateTime HelpTopicLastModified { get; set; } + + [Column("HelpTopicGUID")] + public Guid HelpTopicGuid { get; set; } + + public int? HelpTopicOrder { get; set; } + + [ForeignKey("HelpTopicUielementId")] + [InverseProperty("CmsHelpTopics")] + public virtual CmsUielement HelpTopicUielement { get; set; } = null!; +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsLayout.cs b/Migration.Toolkit.K11/Models/CmsLayout.cs index eafdaa94..a521fa55 100644 --- a/Migration.Toolkit.K11/Models/CmsLayout.cs +++ b/Migration.Toolkit.K11/Models/CmsLayout.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -60,4 +61,68 @@ public partial class CmsLayout [InverseProperty("Layout")] public virtual ICollection CmsTemplateDeviceLayouts { get; set; } = new List(); +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_Layout")] +[Index("LayoutDisplayName", Name = "IX_CMS_Layout_LayoutDisplayName")] +public partial class CmsLayout +{ + [Key] + [Column("LayoutID")] + public int LayoutId { get; set; } + + [StringLength(100)] + public string LayoutCodeName { get; set; } = null!; + + [StringLength(200)] + public string LayoutDisplayName { get; set; } = null!; + + public string? LayoutDescription { get; set; } + + public string LayoutCode { get; set; } = null!; + + [Column("LayoutVersionGUID")] + [StringLength(50)] + public string? LayoutVersionGuid { get; set; } + + [Column("LayoutGUID")] + public Guid LayoutGuid { get; set; } + + public DateTime LayoutLastModified { get; set; } + + [StringLength(50)] + public string? LayoutType { get; set; } + + [Column("LayoutCSS")] + public string? LayoutCss { get; set; } + + [Column("LayoutThumbnailGUID")] + public Guid? LayoutThumbnailGuid { get; set; } + + public int? LayoutZoneCount { get; set; } + + public bool? LayoutIsConvertible { get; set; } + + [StringLength(200)] + public string? LayoutIconClass { get; set; } + + [InverseProperty("SourceLayout")] + public virtual ICollection CmsDeviceProfileLayoutSourceLayouts { get; set; } = new List(); + + [InverseProperty("TargetLayout")] + public virtual ICollection CmsDeviceProfileLayoutTargetLayouts { get; set; } = new List(); + + [InverseProperty("PageTemplateLayoutNavigation")] + public virtual ICollection CmsPageTemplates { get; set; } = new List(); + + [InverseProperty("Layout")] + public virtual ICollection CmsTemplateDeviceLayouts { get; set; } = new List(); +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsLicenseKey.cs b/Migration.Toolkit.K11/Models/CmsLicenseKey.cs index 52c593de..825cb482 100644 --- a/Migration.Toolkit.K11/Models/CmsLicenseKey.cs +++ b/Migration.Toolkit.K11/Models/CmsLicenseKey.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -25,4 +26,33 @@ public partial class CmsLicenseKey public string? LicenseExpiration { get; set; } public int? LicenseServers { get; set; } +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_LicenseKey")] +public partial class CmsLicenseKey +{ + [Key] + [Column("LicenseKeyID")] + public int LicenseKeyId { get; set; } + + [StringLength(255)] + public string? LicenseDomain { get; set; } + + public string? LicenseKey { get; set; } + + [StringLength(200)] + public string? LicenseEdition { get; set; } + + [StringLength(200)] + public string? LicenseExpiration { get; set; } + + public int? LicenseServers { get; set; } +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsMacroIdentity.cs b/Migration.Toolkit.K11/Models/CmsMacroIdentity.cs index 25752f8b..efff36ef 100644 --- a/Migration.Toolkit.K11/Models/CmsMacroIdentity.cs +++ b/Migration.Toolkit.K11/Models/CmsMacroIdentity.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -30,4 +31,38 @@ public partial class CmsMacroIdentity [ForeignKey("MacroIdentityEffectiveUserId")] [InverseProperty("CmsMacroIdentities")] public virtual CmsUser? MacroIdentityEffectiveUser { get; set; } +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_MacroIdentity")] +[Index("MacroIdentityEffectiveUserId", Name = "IX_CMS_MacroIdentity_MacroIdentityEffectiveUserID")] +public partial class CmsMacroIdentity +{ + [Key] + [Column("MacroIdentityID")] + public int MacroIdentityId { get; set; } + + public Guid MacroIdentityGuid { get; set; } + + public DateTime MacroIdentityLastModified { get; set; } + + [StringLength(200)] + public string MacroIdentityName { get; set; } = null!; + + [Column("MacroIdentityEffectiveUserID")] + public int? MacroIdentityEffectiveUserId { get; set; } + + [InverseProperty("UserMacroIdentityMacroIdentity")] + public virtual ICollection CmsUserMacroIdentities { get; set; } = new List(); + + [ForeignKey("MacroIdentityEffectiveUserId")] + [InverseProperty("CmsMacroIdentities")] + public virtual CmsUser? MacroIdentityEffectiveUser { get; set; } +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsMacroRule.cs b/Migration.Toolkit.K11/Models/CmsMacroRule.cs index 708c31f8..e84d4253 100644 --- a/Migration.Toolkit.K11/Models/CmsMacroRule.cs +++ b/Migration.Toolkit.K11/Models/CmsMacroRule.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -45,4 +46,53 @@ public partial class CmsMacroRule public string? MacroRuleRequiredData { get; set; } public bool? MacroRuleEnabled { get; set; } +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_MacroRule")] +public partial class CmsMacroRule +{ + [Key] + [Column("MacroRuleID")] + public int MacroRuleId { get; set; } + + [StringLength(200)] + public string MacroRuleName { get; set; } = null!; + + [StringLength(1000)] + public string MacroRuleText { get; set; } = null!; + + public string? MacroRuleParameters { get; set; } + + [StringLength(100)] + public string? MacroRuleResourceName { get; set; } + + public DateTime MacroRuleLastModified { get; set; } + + [Column("MacroRuleGUID")] + public Guid MacroRuleGuid { get; set; } + + public string MacroRuleCondition { get; set; } = null!; + + [StringLength(500)] + public string MacroRuleDisplayName { get; set; } = null!; + + public bool? MacroRuleIsCustom { get; set; } + + public bool MacroRuleRequiresContext { get; set; } + + [StringLength(450)] + public string? MacroRuleDescription { get; set; } + + [StringLength(2500)] + public string? MacroRuleRequiredData { get; set; } + + public bool? MacroRuleEnabled { get; set; } +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsMembership.cs b/Migration.Toolkit.K11/Models/CmsMembership.cs index a24f1fa8..975567b9 100644 --- a/Migration.Toolkit.K11/Models/CmsMembership.cs +++ b/Migration.Toolkit.K11/Models/CmsMembership.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -40,4 +41,48 @@ public partial class CmsMembership [ForeignKey("MembershipId")] [InverseProperty("Memberships")] public virtual ICollection Roles { get; set; } = new List(); +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_Membership")] +[Index("MembershipSiteId", Name = "IX_CMS_Membership_MembershipSiteID")] +public partial class CmsMembership +{ + [Key] + [Column("MembershipID")] + public int MembershipId { get; set; } + + [StringLength(200)] + public string MembershipName { get; set; } = null!; + + [StringLength(200)] + public string MembershipDisplayName { get; set; } = null!; + + public string? MembershipDescription { get; set; } + + public DateTime MembershipLastModified { get; set; } + + [Column("MembershipGUID")] + public Guid MembershipGuid { get; set; } + + [Column("MembershipSiteID")] + public int? MembershipSiteId { get; set; } + + [InverseProperty("Membership")] + public virtual ICollection CmsMembershipUsers { get; set; } = new List(); + + [ForeignKey("MembershipSiteId")] + [InverseProperty("CmsMemberships")] + public virtual CmsSite? MembershipSite { get; set; } + + [ForeignKey("MembershipId")] + [InverseProperty("Memberships")] + public virtual ICollection Roles { get; set; } = new List(); +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsMembershipUser.cs b/Migration.Toolkit.K11/Models/CmsMembershipUser.cs index cfec8e03..06f42062 100644 --- a/Migration.Toolkit.K11/Models/CmsMembershipUser.cs +++ b/Migration.Toolkit.K11/Models/CmsMembershipUser.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -32,4 +33,40 @@ public partial class CmsMembershipUser [ForeignKey("UserId")] [InverseProperty("CmsMembershipUsers")] public virtual CmsUser User { get; set; } = null!; +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_MembershipUser")] +[Index("MembershipId", "UserId", Name = "IX_CMS_MembershipUser_MembershipID_UserID", IsUnique = true)] +[Index("UserId", Name = "IX_CMS_MembershipUser_UserID")] +public partial class CmsMembershipUser +{ + [Key] + [Column("MembershipUserID")] + public int MembershipUserId { get; set; } + + [Column("MembershipID")] + public int MembershipId { get; set; } + + [Column("UserID")] + public int UserId { get; set; } + + public DateTime? ValidTo { get; set; } + + public bool? SendNotification { get; set; } + + [ForeignKey("MembershipId")] + [InverseProperty("CmsMembershipUsers")] + public virtual CmsMembership Membership { get; set; } = null!; + + [ForeignKey("UserId")] + [InverseProperty("CmsMembershipUsers")] + public virtual CmsUser User { get; set; } = null!; +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.K11/Models/CmsMetaFile.cs b/Migration.Toolkit.K11/Models/CmsMetaFile.cs index 0eac2f52..2526898a 100644 --- a/Migration.Toolkit.K11/Models/CmsMetaFile.cs +++ b/Migration.Toolkit.K11/Models/CmsMetaFile.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -59,4 +60,67 @@ public partial class CmsMetaFile [ForeignKey("MetaFileSiteId")] [InverseProperty("CmsMetaFiles")] public virtual CmsSite? MetaFileSite { get; set; } +======= +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Migration.Toolkit.K11.Models; + +[Table("CMS_MetaFile")] +[Index("MetaFileGuid", "MetaFileSiteId", "MetaFileObjectType", "MetaFileObjectId", "MetaFileGroupName", Name = "IX_CMS_MetaFile_MetaFileGUID_MetaFileSiteID_MetaFileObjectType_MetaFileObjectID_MetaFileGroupName")] +[Index("MetaFileSiteId", Name = "IX_CMS_MetaFile_MetaFileSiteID")] +public partial class CmsMetaFile +{ + [Key] + [Column("MetaFileID")] + public int MetaFileId { get; set; } + + [Column("MetaFileObjectID")] + public int MetaFileObjectId { get; set; } + + [StringLength(100)] + public string MetaFileObjectType { get; set; } = null!; + + [StringLength(100)] + public string? MetaFileGroupName { get; set; } + + [StringLength(250)] + public string MetaFileName { get; set; } = null!; + + [StringLength(50)] + public string MetaFileExtension { get; set; } = null!; + + public int MetaFileSize { get; set; } + + [StringLength(100)] + public string MetaFileMimeType { get; set; } = null!; + + public byte[]? MetaFileBinary { get; set; } + + public int? MetaFileImageWidth { get; set; } + + public int? MetaFileImageHeight { get; set; } + + [Column("MetaFileGUID")] + public Guid MetaFileGuid { get; set; } + + public DateTime MetaFileLastModified { get; set; } + + [Column("MetaFileSiteID")] + public int? MetaFileSiteId { get; set; } + + [StringLength(250)] + public string? MetaFileTitle { get; set; } + + public string? MetaFileDescription { get; set; } + + public string? MetaFileCustomData { get; set; } + + [ForeignKey("MetaFileSiteId")] + [InverseProperty("CmsMetaFiles")] + public virtual CmsSite? MetaFileSite { get; set; } +>>>>>>> master } \ No newline at end of file diff --git a/Migration.Toolkit.KX12/Auxiliary/Kx13FormControls.cs b/Migration.Toolkit.KX12/Auxiliary/Kx13FormControls.cs index 5a046cd0..9e2f05fa 100644 --- a/Migration.Toolkit.KX12/Auxiliary/Kx13FormControls.cs +++ b/Migration.Toolkit.KX12/Auxiliary/Kx13FormControls.cs @@ -1,233 +1,233 @@ -// ReSharper disable InconsistentNaming -namespace Migration.Toolkit.KX12.Auxiliary; - -public class Kx12FormControls -{ - public class UserControlForText - { - public const string AbTestConversionTypeSelector = "ABTestConversionTypeSelector"; - public const string ActivityTypeSelector = "ActivityTypeSelector"; - public const string AllowedExtensionsSelector = "AllowedExtensionsSelector"; - public const string Selectalternativeform = "selectalternativeform"; - public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; - public const string AssemblyClassSelector = "AssemblyClassSelector"; - public const string Fieldselector = "fieldselector"; - public const string BizFormSelector = "BizFormSelector"; - public const string BundleInventoryTypeSelector = "BundleInventoryTypeSelector"; - public const string CampaignSelector = "CampaignSelector"; - public const string CategorySelector = "CategorySelector"; - public const string ClassFieldSelector = "ClassFieldSelector"; - public const string ClassFields = "Class_fields"; - public const string CodeName = "CodeName"; - public const string CodeNameWithPrefix = "CodeNameWithPrefix"; - public const string Selectcolor = "selectcolor"; - public const string Columns = "Columns"; - public const string ConnectionStringSelector = "Connection_string_selector"; - public const string ContactClassFields = "Contact_class_fields"; - public const string CountrySelector = "countrySelector"; - public const string CssStylesEditor = "CSS_Styles_Editor"; - public const string Selectculture = "selectculture"; - public const string CultureSelectorForSettings = "CultureSelectorForSettings"; - public const string CurrencySelector = "currencySelector"; - public const string CustomTableItemSelector = "CustomTableItemSelector"; - public const string CustomTableSelector = "CustomTableSelector"; - public const string Selectcolumns = "selectcolumns"; - public const string DepartmentSelector = "DepartmentSelector"; - public const string DropDownListControl = "DropDownListControl"; - public const string DueDateSelector = "Due_date_selector"; - public const string Emailinput = "emailinput"; - public const string EmailTemplateSelector = "Email_template_selector"; - public const string EmailTemplateTypeSelector = "Email_template_type_selector"; - public const string EncodingTextBox = "EncodingTextBox"; - public const string EncryptedPassword = "EncryptedPassword"; - public const string EnumSelector = "EnumSelector"; - public const string EventLogTypeSelector = "EventLogTypeSelector"; - public const string FacebookAutoPost = "Facebook_auto_post"; - public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; - public const string FileSystemSelector = "FileSystemSelector"; - public const string FontIconSelector = "FontIconSelector"; - public const string FormFieldSelector = "FormFieldSelector"; - public const string FormPassword = "FormPassword"; - public const string FullMediaLibrarySelector = "FullMediaLibrarySelector"; - public const string GetGoogleTranslatorApiKey = "Get_Google_Translator_API_key"; - public const string GetMsTranslatorTextApiKey = "GetMSTranslatorTextAPIKey"; - public const string GoToExternalUrl = "Go_to_external_URL"; - public const string GoogleAnalyticsParameterSelector = "Google_Analytics_parameter_selector"; - public const string Html5Input = "HTML5Input"; - public const string IconSelector = "IconSelector"; - public const string InternalStatusSelector = "InternalStatusSelector"; - public const string Internationalphone = "internationalphone"; - public const string LabelControl = "LabelControl"; - public const string LargeTextArea = "LargeTextArea"; - public const string LicenseSelector = "LicenseSelector"; - public const string LinkedInAutoPost = "LinkedInAutoPost"; - public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; - public const string ListBoxControl = "ListBoxControl"; - public const string LocalizableTextArea = "LocalizableTextArea"; - public const string LocalizableTextBox = "LocalizableTextBox"; - public const string MacroAnyAllBoolSelector = "Macro_any-all_bool_selector"; - public const string MacroAnyAllSelector = "MacroAnyAllSelector"; - public const string MacroDateOperator = "Macro_date_operator"; - public const string MacroEditor = "MacroEditor"; - public const string MacroEqualityOperator = "MacroEqualityOperator"; - public const string MacroNegationOperator = "MacroNegationOperator"; - public const string MacroNumericOperator = "Macro_numeric_operator"; - public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; - public const string MacroTextOperator = "Macro_text_operator"; - public const string MacroType = "MacroType"; - public const string ManufacturerSelector = "ManufacturerSelector"; - public const string MediaLibrarySelector = "MediaLibrarySelector"; - public const string MediaSelectionControl = "MediaSelectionControl"; - public const string MembershipSelector = "MembershipSelector"; - public const string MetafileUploaderControl = "MetafileUploaderControl"; - public const string ModuleSelector = "ModuleSelector"; - public const string MultipleCategoriesSelector = "MultipleCategoriesSelector"; - public const string MultipleChoiceControl = "MultipleChoiceControl"; - public const string RoleCheckboxSelector = "RoleCheckboxSelector"; - public const string SimpleCheckboxRoleSelector = "SimpleCheckboxRoleSelector"; - public const string SimpleCheckboxSiteSelector = "SimpleCheckboxSiteSelector"; - public const string MultipleUserSelector = "MultipleUserSelector"; - public const string NewsletterSelector = "NewsletterSelector"; - public const string NewsletterSelectorSimple = "NewsletterSelectorSimple"; - public const string NumericUpDown = "NumericUpDown"; - public const string ObjectColumnSelector = "ObjectColumnSelector"; - public const string ObjectSelector = "ObjectSelector"; - public const string ObjectTransformation = "ObjectTransformation"; - public const string ObjectTypeBinSelector = "ObjectTypeBinSelector"; - public const string ObjectTypeSelector = "ObjectTypeSelector"; - public const string OptionCategoryProductOptionSelector = "OptionCategoryProductOptionSelector"; - public const string OptionCategorySelectionTypeSelector = "OptionCategorySelectionTypeSelector"; - public const string OrderBy = "OrderBy"; - public const string OrderStatusSelector = "OrderStatusSelector"; - public const string DocumentCultureFilter = "DocumentCultureFilter"; - public const string PageLayoutCode = "Page_layout_code"; - public const string Selectdocument = "selectdocument"; - public const string PageTemplateLevels = "PageTemplateLevels"; - public const string Selectpagetemplate = "selectpagetemplate"; - public const string DocumentTypeIconSelector = "DocumentTypeIconSelector"; - public const string Selectclassnames = "selectclassnames"; - public const string Password = "Password"; - public const string PasswordStrength = "PasswordStrength"; - public const string PasswordConfirmator = "PasswordConfirmator"; - public const string Selectpath = "selectpath"; - public const string PaymentSelector = "paymentSelector"; - public const string ProductImageSelector = "ProductImageSelector"; - public const string ProductRelationshipNameSelector = "ProductRelationshipNameSelector"; - public const string ProductSectionsSelector = "ProductSectionsSelector"; - public const string ProductTypeSelector = "ProductTypeSelector"; - public const string PublicStatusSelector = "PublicStatusSelector"; - public const string Selectquery = "selectquery"; - public const string RadioButtonsControl = "RadioButtonsControl"; - public const string AgeRangeSelector = "AgeRangeSelector"; - public const string RelatedDocuments = "RelatedDocuments"; - public const string Relationshipconfiguration = "relationshipconfiguration"; - public const string SelectRelationshipName = "SelectRelationshipName"; - public const string ReportSelectorDropDown = "ReportSelectorDropDown"; - public const string RoleSelector = "RoleSelector"; - public const string SearchClassNameSelector = "SearchClassNameSelector"; - public const string SearchIndexSelector = "SearchIndexSelector"; - public const string SearchIndexTypeSelector = "SearchIndexTypeSelector"; - public const string SelectCmsVersion = "SelectCMSVersion"; - public const string SettingsKeyControlSelector = "SettingsKeyControlSelector"; - public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; - public const string SharePointListSelector = "SharePointListSelector"; - public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; - public const string ShippingSelector = "shippingSelector"; - public const string ShippingServiceSelector = "ShippingServiceSelector"; - public const string Selectsinglepath = "selectsinglepath"; - public const string SinglePathSelectorWithPermissions = "SinglePathSelectorWithPermissions"; - public const string SiteContentCulture = "SiteContentCulture"; - public const string SiteCultureSelector = "SiteCultureSelector"; - public const string SiteCultureSelectorAll = "SiteCultureSelectorAll"; - public const string Selectsite = "selectsite"; - public const string SiteSelectorWithAllFieldForGlobalAdmin = "SiteSelectorWithAllFieldForGlobalAdmin"; - public const string SkuSelector = "SKUSelector"; - public const string StopWordsSelector = "StopWordsSelector"; - public const string SupplierSelector = "SupplierSelector"; - public const string SupportedCultureSelector = "SupportedCultureSelector"; - public const string TableConversionSettings = "TableConversionSettings"; - public const string TagGroupSelector = "TagGroupSelector"; - public const string TagSelector = "TagSelector"; - public const string TaxAddressTypeSelector = "TaxAddressTypeSelector"; - public const string TextAreaControl = "TextAreaControl"; - public const string TextBoxControl = "TextBoxControl"; - public const string TextFilter = "TextFilter"; - public const string TextboxDefaultValueFromSetting = "Textbox_default_value_from_setting"; - public const string TextboxDoubleValidator = "Textbox_double_validator"; - public const string TimeZoneSelector = "TimeZoneSelector"; - public const string TimeZoneTypeSelector = "TimeZoneTypeSelector"; - public const string ToggleButton = "ToggleButton"; - public const string Selecttransformation = "selecttransformation"; - public const string TranslationServiceSelector = "Translation_service_selector"; - public const string TwitterAutoPost = "Twitter_auto_post"; - public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; - public const string Usphone = "usphone"; - public const string Uszipcode = "uszipcode"; - public const string UiCultureSelector = "UICultureSelector"; - public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; - public const string UniSelector = "Uni_selector"; - public const string UrlChecker = "UrlChecker"; - public const string UrlSelector = "URLSelector"; - public const string SmurlShortenerSelector = "SMURLShortenerSelector"; - public const string UserName = "UserName"; - public const string UserNameSelector = "UserNameSelector"; - public const string UserSelector = "UserSelector"; - public const string ValiditySelector = "ValiditySelector"; - public const string ViewSecureText = "ViewSecureText"; - public const string WhereCondition = "WhereCondition"; - public const string WorkflowScopeDefinition = "WorkflowScopeDefinition"; - } - - public class UserControlForLongText - { - public const string AbTestConversionSelector = "ABTestConversionSelector"; - public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; - public const string BbEditorControl = "BBEditorControl"; - public const string CacheDependencies = "CacheDependencies"; - public const string ClassFields = "Class_fields"; - public const string Columns = "Columns"; - public const string ConditionBuilder = "ConditionBuilder"; - public const string ContactClassFields = "Contact_class_fields"; - public const string CssStylesEditor = "CSS_Styles_Editor"; - public const string Selectcolumns = "selectcolumns"; - public const string DropDownListControl = "DropDownListControl"; - public const string FacebookAutoPost = "Facebook_auto_post"; - public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; - public const string FileSystemSelector = "FileSystemSelector"; - public const string Html5Input = "HTML5Input"; - public const string AutoResizeConfiguration = "AutoResizeConfiguration"; - public const string LabelControl = "LabelControl"; - public const string LargeTextArea = "LargeTextArea"; - public const string LinkedInAutoPost = "LinkedInAutoPost"; - public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; - public const string LocalizableTextArea = "LocalizableTextArea"; - public const string LocalizableTextBox = "LocalizableTextBox"; - public const string MacroEditor = "MacroEditor"; - public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; - public const string MultipleObjectBindingControl = "MultipleObjectBindingControl"; - public const string ObjectTypeSelector = "ObjectTypeSelector"; - public const string OptionsSelector = "OptionsSelector"; - public const string OrderBy = "OrderBy"; - public const string PageLayoutCode = "Page_layout_code"; - public const string ProductSectionsSelector = "ProductSectionsSelector"; - public const string RelatedDocuments = "RelatedDocuments"; - public const string ReportGraphSelector = "ReportGraphSelector"; - public const string ReportTableSelector = "ReportTableSelector"; - public const string ReportValueSelector = "ReportValueSelector"; - public const string HtmlAreaControl = "HtmlAreaControl"; - public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; - public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; - public const string TagSelector = "TagSelector"; - public const string TextAreaControl = "TextAreaControl"; - public const string TextBoxControl = "TextBoxControl"; - public const string TextFilter = "TextFilter"; - public const string TranslationServiceSelector = "Translation_service_selector"; - public const string TwitterAutoPost = "Twitter_auto_post"; - public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; - public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; - public const string UniSelector = "Uni_selector"; - public const string SmurlShortenerSelector = "SMURLShortenerSelector"; - public const string ViewSecureText = "ViewSecureText"; - public const string WhereCondition = "WhereCondition"; - } +// ReSharper disable InconsistentNaming +namespace Migration.Toolkit.KX12.Auxiliary; + +public class Kx12FormControls +{ + public class UserControlForText + { + public const string AbTestConversionTypeSelector = "ABTestConversionTypeSelector"; + public const string ActivityTypeSelector = "ActivityTypeSelector"; + public const string AllowedExtensionsSelector = "AllowedExtensionsSelector"; + public const string Selectalternativeform = "selectalternativeform"; + public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; + public const string AssemblyClassSelector = "AssemblyClassSelector"; + public const string Fieldselector = "fieldselector"; + public const string BizFormSelector = "BizFormSelector"; + public const string BundleInventoryTypeSelector = "BundleInventoryTypeSelector"; + public const string CampaignSelector = "CampaignSelector"; + public const string CategorySelector = "CategorySelector"; + public const string ClassFieldSelector = "ClassFieldSelector"; + public const string ClassFields = "Class_fields"; + public const string CodeName = "CodeName"; + public const string CodeNameWithPrefix = "CodeNameWithPrefix"; + public const string Selectcolor = "selectcolor"; + public const string Columns = "Columns"; + public const string ConnectionStringSelector = "Connection_string_selector"; + public const string ContactClassFields = "Contact_class_fields"; + public const string CountrySelector = "countrySelector"; + public const string CssStylesEditor = "CSS_Styles_Editor"; + public const string Selectculture = "selectculture"; + public const string CultureSelectorForSettings = "CultureSelectorForSettings"; + public const string CurrencySelector = "currencySelector"; + public const string CustomTableItemSelector = "CustomTableItemSelector"; + public const string CustomTableSelector = "CustomTableSelector"; + public const string Selectcolumns = "selectcolumns"; + public const string DepartmentSelector = "DepartmentSelector"; + public const string DropDownListControl = "DropDownListControl"; + public const string DueDateSelector = "Due_date_selector"; + public const string Emailinput = "emailinput"; + public const string EmailTemplateSelector = "Email_template_selector"; + public const string EmailTemplateTypeSelector = "Email_template_type_selector"; + public const string EncodingTextBox = "EncodingTextBox"; + public const string EncryptedPassword = "EncryptedPassword"; + public const string EnumSelector = "EnumSelector"; + public const string EventLogTypeSelector = "EventLogTypeSelector"; + public const string FacebookAutoPost = "Facebook_auto_post"; + public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; + public const string FileSystemSelector = "FileSystemSelector"; + public const string FontIconSelector = "FontIconSelector"; + public const string FormFieldSelector = "FormFieldSelector"; + public const string FormPassword = "FormPassword"; + public const string FullMediaLibrarySelector = "FullMediaLibrarySelector"; + public const string GetGoogleTranslatorApiKey = "Get_Google_Translator_API_key"; + public const string GetMsTranslatorTextApiKey = "GetMSTranslatorTextAPIKey"; + public const string GoToExternalUrl = "Go_to_external_URL"; + public const string GoogleAnalyticsParameterSelector = "Google_Analytics_parameter_selector"; + public const string Html5Input = "HTML5Input"; + public const string IconSelector = "IconSelector"; + public const string InternalStatusSelector = "InternalStatusSelector"; + public const string Internationalphone = "internationalphone"; + public const string LabelControl = "LabelControl"; + public const string LargeTextArea = "LargeTextArea"; + public const string LicenseSelector = "LicenseSelector"; + public const string LinkedInAutoPost = "LinkedInAutoPost"; + public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; + public const string ListBoxControl = "ListBoxControl"; + public const string LocalizableTextArea = "LocalizableTextArea"; + public const string LocalizableTextBox = "LocalizableTextBox"; + public const string MacroAnyAllBoolSelector = "Macro_any-all_bool_selector"; + public const string MacroAnyAllSelector = "MacroAnyAllSelector"; + public const string MacroDateOperator = "Macro_date_operator"; + public const string MacroEditor = "MacroEditor"; + public const string MacroEqualityOperator = "MacroEqualityOperator"; + public const string MacroNegationOperator = "MacroNegationOperator"; + public const string MacroNumericOperator = "Macro_numeric_operator"; + public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; + public const string MacroTextOperator = "Macro_text_operator"; + public const string MacroType = "MacroType"; + public const string ManufacturerSelector = "ManufacturerSelector"; + public const string MediaLibrarySelector = "MediaLibrarySelector"; + public const string MediaSelectionControl = "MediaSelectionControl"; + public const string MembershipSelector = "MembershipSelector"; + public const string MetafileUploaderControl = "MetafileUploaderControl"; + public const string ModuleSelector = "ModuleSelector"; + public const string MultipleCategoriesSelector = "MultipleCategoriesSelector"; + public const string MultipleChoiceControl = "MultipleChoiceControl"; + public const string RoleCheckboxSelector = "RoleCheckboxSelector"; + public const string SimpleCheckboxRoleSelector = "SimpleCheckboxRoleSelector"; + public const string SimpleCheckboxSiteSelector = "SimpleCheckboxSiteSelector"; + public const string MultipleUserSelector = "MultipleUserSelector"; + public const string NewsletterSelector = "NewsletterSelector"; + public const string NewsletterSelectorSimple = "NewsletterSelectorSimple"; + public const string NumericUpDown = "NumericUpDown"; + public const string ObjectColumnSelector = "ObjectColumnSelector"; + public const string ObjectSelector = "ObjectSelector"; + public const string ObjectTransformation = "ObjectTransformation"; + public const string ObjectTypeBinSelector = "ObjectTypeBinSelector"; + public const string ObjectTypeSelector = "ObjectTypeSelector"; + public const string OptionCategoryProductOptionSelector = "OptionCategoryProductOptionSelector"; + public const string OptionCategorySelectionTypeSelector = "OptionCategorySelectionTypeSelector"; + public const string OrderBy = "OrderBy"; + public const string OrderStatusSelector = "OrderStatusSelector"; + public const string DocumentCultureFilter = "DocumentCultureFilter"; + public const string PageLayoutCode = "Page_layout_code"; + public const string Selectdocument = "selectdocument"; + public const string PageTemplateLevels = "PageTemplateLevels"; + public const string Selectpagetemplate = "selectpagetemplate"; + public const string DocumentTypeIconSelector = "DocumentTypeIconSelector"; + public const string Selectclassnames = "selectclassnames"; + public const string Password = "Password"; + public const string PasswordStrength = "PasswordStrength"; + public const string PasswordConfirmator = "PasswordConfirmator"; + public const string Selectpath = "selectpath"; + public const string PaymentSelector = "paymentSelector"; + public const string ProductImageSelector = "ProductImageSelector"; + public const string ProductRelationshipNameSelector = "ProductRelationshipNameSelector"; + public const string ProductSectionsSelector = "ProductSectionsSelector"; + public const string ProductTypeSelector = "ProductTypeSelector"; + public const string PublicStatusSelector = "PublicStatusSelector"; + public const string Selectquery = "selectquery"; + public const string RadioButtonsControl = "RadioButtonsControl"; + public const string AgeRangeSelector = "AgeRangeSelector"; + public const string RelatedDocuments = "RelatedDocuments"; + public const string Relationshipconfiguration = "relationshipconfiguration"; + public const string SelectRelationshipName = "SelectRelationshipName"; + public const string ReportSelectorDropDown = "ReportSelectorDropDown"; + public const string RoleSelector = "RoleSelector"; + public const string SearchClassNameSelector = "SearchClassNameSelector"; + public const string SearchIndexSelector = "SearchIndexSelector"; + public const string SearchIndexTypeSelector = "SearchIndexTypeSelector"; + public const string SelectCmsVersion = "SelectCMSVersion"; + public const string SettingsKeyControlSelector = "SettingsKeyControlSelector"; + public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; + public const string SharePointListSelector = "SharePointListSelector"; + public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; + public const string ShippingSelector = "shippingSelector"; + public const string ShippingServiceSelector = "ShippingServiceSelector"; + public const string Selectsinglepath = "selectsinglepath"; + public const string SinglePathSelectorWithPermissions = "SinglePathSelectorWithPermissions"; + public const string SiteContentCulture = "SiteContentCulture"; + public const string SiteCultureSelector = "SiteCultureSelector"; + public const string SiteCultureSelectorAll = "SiteCultureSelectorAll"; + public const string Selectsite = "selectsite"; + public const string SiteSelectorWithAllFieldForGlobalAdmin = "SiteSelectorWithAllFieldForGlobalAdmin"; + public const string SkuSelector = "SKUSelector"; + public const string StopWordsSelector = "StopWordsSelector"; + public const string SupplierSelector = "SupplierSelector"; + public const string SupportedCultureSelector = "SupportedCultureSelector"; + public const string TableConversionSettings = "TableConversionSettings"; + public const string TagGroupSelector = "TagGroupSelector"; + public const string TagSelector = "TagSelector"; + public const string TaxAddressTypeSelector = "TaxAddressTypeSelector"; + public const string TextAreaControl = "TextAreaControl"; + public const string TextBoxControl = "TextBoxControl"; + public const string TextFilter = "TextFilter"; + public const string TextboxDefaultValueFromSetting = "Textbox_default_value_from_setting"; + public const string TextboxDoubleValidator = "Textbox_double_validator"; + public const string TimeZoneSelector = "TimeZoneSelector"; + public const string TimeZoneTypeSelector = "TimeZoneTypeSelector"; + public const string ToggleButton = "ToggleButton"; + public const string Selecttransformation = "selecttransformation"; + public const string TranslationServiceSelector = "Translation_service_selector"; + public const string TwitterAutoPost = "Twitter_auto_post"; + public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; + public const string Usphone = "usphone"; + public const string Uszipcode = "uszipcode"; + public const string UiCultureSelector = "UICultureSelector"; + public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; + public const string UniSelector = "Uni_selector"; + public const string UrlChecker = "UrlChecker"; + public const string UrlSelector = "URLSelector"; + public const string SmurlShortenerSelector = "SMURLShortenerSelector"; + public const string UserName = "UserName"; + public const string UserNameSelector = "UserNameSelector"; + public const string UserSelector = "UserSelector"; + public const string ValiditySelector = "ValiditySelector"; + public const string ViewSecureText = "ViewSecureText"; + public const string WhereCondition = "WhereCondition"; + public const string WorkflowScopeDefinition = "WorkflowScopeDefinition"; + } + + public class UserControlForLongText + { + public const string AbTestConversionSelector = "ABTestConversionSelector"; + public const string AlternativeUrLsConstraintEditor = "AlternativeURLsConstraintEditor"; + public const string BbEditorControl = "BBEditorControl"; + public const string CacheDependencies = "CacheDependencies"; + public const string ClassFields = "Class_fields"; + public const string Columns = "Columns"; + public const string ConditionBuilder = "ConditionBuilder"; + public const string ContactClassFields = "Contact_class_fields"; + public const string CssStylesEditor = "CSS_Styles_Editor"; + public const string Selectcolumns = "selectcolumns"; + public const string DropDownListControl = "DropDownListControl"; + public const string FacebookAutoPost = "Facebook_auto_post"; + public const string SmFacebookPageAccessToken = "SMFacebookPageAccessToken"; + public const string FileSystemSelector = "FileSystemSelector"; + public const string Html5Input = "HTML5Input"; + public const string AutoResizeConfiguration = "AutoResizeConfiguration"; + public const string LabelControl = "LabelControl"; + public const string LargeTextArea = "LargeTextArea"; + public const string LinkedInAutoPost = "LinkedInAutoPost"; + public const string LinkedInCompanyAccessToken = "LinkedInCompanyAccessToken"; + public const string LocalizableTextArea = "LocalizableTextArea"; + public const string LocalizableTextBox = "LocalizableTextBox"; + public const string MacroEditor = "MacroEditor"; + public const string MacroSyntaxHighlighter = "MacroSyntaxHighlighter"; + public const string MultipleObjectBindingControl = "MultipleObjectBindingControl"; + public const string ObjectTypeSelector = "ObjectTypeSelector"; + public const string OptionsSelector = "OptionsSelector"; + public const string OrderBy = "OrderBy"; + public const string PageLayoutCode = "Page_layout_code"; + public const string ProductSectionsSelector = "ProductSectionsSelector"; + public const string RelatedDocuments = "RelatedDocuments"; + public const string ReportGraphSelector = "ReportGraphSelector"; + public const string ReportTableSelector = "ReportTableSelector"; + public const string ReportValueSelector = "ReportValueSelector"; + public const string HtmlAreaControl = "HtmlAreaControl"; + public const string SettingsKeyDefaultValue = "SettingsKeyDefaultValue"; + public const string SharePointServerConnectionTest = "SharePointServerConnectionTest"; + public const string TagSelector = "TagSelector"; + public const string TextAreaControl = "TextAreaControl"; + public const string TextBoxControl = "TextBoxControl"; + public const string TextFilter = "TextFilter"; + public const string TranslationServiceSelector = "Translation_service_selector"; + public const string TwitterAutoPost = "Twitter_auto_post"; + public const string SmTwitterPostTextArea = "SMTwitterPostTextArea"; + public const string UiElementPropertiesEditor = "UIElementPropertiesEditor"; + public const string UniSelector = "Uni_selector"; + public const string SmurlShortenerSelector = "SMURLShortenerSelector"; + public const string ViewSecureText = "ViewSecureText"; + public const string WhereCondition = "WhereCondition"; + } } \ No newline at end of file diff --git a/Migration.Toolkit.KX12/ContextCustomizations.cs b/Migration.Toolkit.KX12/ContextCustomizations.cs index 28d4915a..6d322907 100644 --- a/Migration.Toolkit.KX12/ContextCustomizations.cs +++ b/Migration.Toolkit.KX12/ContextCustomizations.cs @@ -1,14 +1,14 @@ -namespace Migration.Toolkit.KX12.Context; - -using Microsoft.EntityFrameworkCore; - -public partial class KX12Context -{ - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - optionsBuilder - .EnableDetailedErrors() - .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); - base.OnConfiguring(optionsBuilder); - } +namespace Migration.Toolkit.KX12.Context; + +using Microsoft.EntityFrameworkCore; + +public partial class KX12Context +{ + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder + .EnableDetailedErrors() + .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); + base.OnConfiguring(optionsBuilder); + } } \ No newline at end of file diff --git a/Migration.Toolkit.KX12/DependencyInjectionExtensions.cs b/Migration.Toolkit.KX12/DependencyInjectionExtensions.cs index 45ae5acf..7a47a4ec 100644 --- a/Migration.Toolkit.KX12/DependencyInjectionExtensions.cs +++ b/Migration.Toolkit.KX12/DependencyInjectionExtensions.cs @@ -1,15 +1,15 @@ -namespace Migration.Toolkit.KX12; - -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Migration.Toolkit.Common; -using Migration.Toolkit.KX12.Context; - -public static class DependencyInjectionExtensions -{ - public static IServiceCollection UseKx12DbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) - { - services.AddDbContextFactory(options => options.UseSqlServer(toolkitConfiguration.KxConnectionString)); - return services; - } +namespace Migration.Toolkit.KX12; + +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Migration.Toolkit.Common; +using Migration.Toolkit.KX12.Context; + +public static class DependencyInjectionExtensions +{ + public static IServiceCollection UseKx12DbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) + { + services.AddDbContextFactory(options => options.UseSqlServer(toolkitConfiguration.KxConnectionString)); + return services; + } } \ No newline at end of file diff --git a/Migration.Toolkit.KX13/DependencyInjectionExtensions.cs b/Migration.Toolkit.KX13/DependencyInjectionExtensions.cs index 9eeddce9..489f6b33 100644 --- a/Migration.Toolkit.KX13/DependencyInjectionExtensions.cs +++ b/Migration.Toolkit.KX13/DependencyInjectionExtensions.cs @@ -1,15 +1,15 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Migration.Toolkit.Common; -using Migration.Toolkit.KX13.Context; - -namespace Migration.Toolkit.KX13; - -public static class DependencyInjectionExtensions -{ - public static IServiceCollection UseKx13DbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) - { - services.AddDbContextFactory(options => options.UseSqlServer(toolkitConfiguration.KxConnectionString)); - return services; - } +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Migration.Toolkit.Common; +using Migration.Toolkit.KX13.Context; + +namespace Migration.Toolkit.KX13; + +public static class DependencyInjectionExtensions +{ + public static IServiceCollection UseKx13DbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) + { + services.AddDbContextFactory(options => options.UseSqlServer(toolkitConfiguration.KxConnectionString)); + return services; + } } \ No newline at end of file diff --git a/Migration.Toolkit.KX13/KX13ContextCustomizations.cs b/Migration.Toolkit.KX13/KX13ContextCustomizations.cs index 66d71047..1a3eca6b 100644 --- a/Migration.Toolkit.KX13/KX13ContextCustomizations.cs +++ b/Migration.Toolkit.KX13/KX13ContextCustomizations.cs @@ -1,14 +1,14 @@ -namespace Migration.Toolkit.KX13.Context; - -using Microsoft.EntityFrameworkCore; - -public partial class KX13Context -{ - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - optionsBuilder - .EnableDetailedErrors() - .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); - base.OnConfiguring(optionsBuilder); - } +namespace Migration.Toolkit.KX13.Context; + +using Microsoft.EntityFrameworkCore; + +public partial class KX13Context +{ + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder + .EnableDetailedErrors() + .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); + base.OnConfiguring(optionsBuilder); + } } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/Auxiliary/FormComponents.cs b/Migration.Toolkit.KXP.Api/Auxiliary/FormComponents.cs index 89208f7b..ee925aa0 100644 --- a/Migration.Toolkit.KXP.Api/Auxiliary/FormComponents.cs +++ b/Migration.Toolkit.KXP.Api/Auxiliary/FormComponents.cs @@ -1,146 +1,146 @@ -namespace Migration.Toolkit.KXP.Api.Auxiliary; - -public class FormComponents -{ - ///Form component value type: Kentico.Forms.Web.Mvc.BoolFieldValueTypes - public static string MvcBoolComparisonTypeSelectorComponent => Kentico.Forms.Web.Mvc.BoolComparisonTypeSelectorComponent.IDENTIFIER; - ///Form component value type: System.Boolean - public static string MvcCheckBoxComponent => Kentico.Forms.Web.Mvc.CheckBoxComponent.IDENTIFIER; - ///Form component value type: System.Guid - public static string MvcCompareToFieldSelectorComponent => Kentico.Forms.Web.Mvc.CompareToFieldSelectorComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string MvcConsentAgreementComponent => Kentico.Forms.Web.Mvc.ConsentAgreementComponent.IDENTIFIER; - public static string MvcConsentSelectorComponent => Kentico.Forms.Web.Mvc.ConsentSelectorComponent.IDENTIFIER; - ///Form component value type: Kentico.Forms.Web.Mvc.DropDownProperties - public static string MvcDropDownComponent => Kentico.Forms.Web.Mvc.DropDownComponent.IDENTIFIER; - ///Form component value type: System.String - public static string MvcEmailInputComponent => Kentico.Forms.Web.Mvc.EmailInputComponent.IDENTIFIER; - ///Form component value type: CMS.OnlineForms.BizFormUploadFile - public static string MvcFileUploaderComponent => Kentico.Forms.Web.Mvc.FileUploaderComponent.IDENTIFIER; - ///Form component value type: System.Guid - public static string MvcHiddenGuidInputComponent => Kentico.Forms.Web.Mvc.HiddenGuidInputComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string MvcIntInputComponent => Kentico.Forms.Web.Mvc.IntInputComponent.IDENTIFIER; - public static string MvcNameComponent => Kentico.Forms.Web.Mvc.NameComponent.IDENTIFIER; - ///Form component value type: Kentico.Forms.Web.Mvc.NumericFieldComparisonTypes - public static string MvcNumericComparisonTypeSelectorComponent => Kentico.Forms.Web.Mvc.NumericComparisonTypeSelectorComponent.IDENTIFIER; - ///Form component value type: Kentico.Forms.Web.Mvc.RadioButtonsProperties - public static string MvcRadioButtonsComponent => Kentico.Forms.Web.Mvc.RadioButtonsComponent.IDENTIFIER; - ///Form component value type: System.String - public static string MvcRecaptchaComponent => Kentico.Forms.Web.Mvc.RecaptchaComponent.IDENTIFIER; - ///Form component value type: Kentico.Forms.Web.Mvc.StringFieldComparisonTypes - public static string MvcStringComparisonTypeSelectorComponent => Kentico.Forms.Web.Mvc.StringComparisonTypeSelectorComponent.IDENTIFIER; - ///Form component value type: System.String - public static string MvcTextAreaComponent => Kentico.Forms.Web.Mvc.TextAreaComponent.IDENTIFIER; - ///Form component value type: System.String - public static string MvcTextInputComponent => Kentico.Forms.Web.Mvc.TextInputComponent.IDENTIFIER; - ///Form component value type: System.String - public static string MvcUSPhoneComponent => Kentico.Forms.Web.Mvc.USPhoneComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.Double, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string MvcInternal_DoubleInputComponent => Kentico.Forms.Web.Mvc.Internal.DoubleInputComponent.IDENTIFIER; - ///Form component value type: Kentico.Content.Web.Mvc.MultiSelectorProperties - public static string Kentico_Content_Web_Mvc_MultipleChoiceComponent => Kentico.Content.Web.Mvc.MultipleChoiceComponent.IDENTIFIER; - ///Form component value type: System.String - public static string MvcFcRichTextComponent => Kentico.Components.Web.Mvc.FormComponents.RichTextComponent.IDENTIFIER; - ///Form component value type: System.Collections.Generic.IEnumerable`1[[Kentico.Components.Web.Mvc.FormComponents.MediaFilesSelectorItem, Kentico.Content.Web.Mvc, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] - public static string MvcFcMediaFilesSelector => Kentico.Components.Web.Mvc.FormComponents.MediaFilesSelector.IDENTIFIER; - ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.GeneralSelectorItem - public static string MvcFcGeneralSelector => Kentico.Components.Web.Mvc.FormComponents.GeneralSelector.IDENTIFIER; - ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.ObjectSelectorItem - public static string MvcFcObjectSelector => Kentico.Components.Web.Mvc.FormComponents.ObjectSelector.IDENTIFIER; - ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.PageSelectorItem - public static string MvcFcPageSelector => Kentico.Components.Web.Mvc.FormComponents.PageSelector.IDENTIFIER; - ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.PathSelectorItem - public static string MvcFcPathSelector => Kentico.Components.Web.Mvc.FormComponents.PathSelector.IDENTIFIER; - ///Form component value type: System.String - public static string MvcFcUrlSelector => Kentico.Components.Web.Mvc.FormComponents.UrlSelector.IDENTIFIER; - ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.MediaLibrary.AssetRelatedItem, CMS.MediaLibrary, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] - public static string AdminAssetSelectorComponent => Kentico.Xperience.Admin.Base.Forms.AssetSelectorComponent.IDENTIFIER; - ///Form component value type: System.Boolean - public static string AdminCheckBoxComponent => Kentico.Xperience.Admin.Base.Forms.CheckBoxComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminCodeEditorComponent => Kentico.Xperience.Admin.Base.Forms.CodeEditorComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminConditionBuilderComponent => Kentico.Xperience.Admin.Base.Forms.ConditionBuilderComponent.IDENTIFIER; - ///Form component value type: CMS.ContentEngine.ContentItemAssetMetadata - public static string AdminContentItemAssetUploaderComponent => Kentico.Xperience.Admin.Base.Forms.ContentItemAssetUploaderComponent.IDENTIFIER; - ///Form component value type: Kentico.Xperience.Admin.Base.Forms.ContentItemSelectorProperties - public static string AdminContentItemSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ContentItemSelectorComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string AdminDateInputComponent => Kentico.Xperience.Admin.Base.Forms.DateInputComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string AdminDateTimeInputComponent => Kentico.Xperience.Admin.Base.Forms.DateTimeInputComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.Decimal, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string AdminDecimalNumberInputComponent => Kentico.Xperience.Admin.Base.Forms.DecimalNumberInputComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminDropDownComponent => Kentico.Xperience.Admin.Base.Forms.DropDownComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminExtensionSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ExtensionSelectorComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminIconSelectorComponent => Kentico.Xperience.Admin.Base.Forms.IconSelectorComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminLinkComponent => Kentico.Xperience.Admin.Base.Forms.LinkComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string AdminNumberInputComponent => Kentico.Xperience.Admin.Base.Forms.NumberInputComponent.IDENTIFIER; - ///Form component value type: System.Int32 - public static string AdminNumberWithLabelComponent => Kentico.Xperience.Admin.Base.Forms.NumberWithLabelComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminObjectCodeNameSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ObjectCodeNameSelectorComponent.IDENTIFIER; - ///Form component value type: System.Guid - public static string AdminObjectGuidSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ObjectGuidSelectorComponent.IDENTIFIER; - ///Form component value type: System.Int32 - public static string AdminObjectIdSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ObjectIdSelectorComponent.IDENTIFIER; - ///Form component value type: System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] - public static string AdminSingleObjectIdSelectorComponent => Kentico.Xperience.Admin.Base.Forms.SingleObjectIdSelectorComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminPasswordComponent => Kentico.Xperience.Admin.Base.Forms.PasswordComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminRadioGroupComponent => Kentico.Xperience.Admin.Base.Forms.RadioGroupComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminRichTextEditorComponent => Kentico.Xperience.Admin.Base.Forms.RichTextEditorComponent.IDENTIFIER; - ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.ContentEngine.TagReference, CMS.ContentEngine, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] - public static string AdminTagSelectorComponent => Kentico.Xperience.Admin.Base.Forms.TagSelectorComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminTextAreaComponent => Kentico.Xperience.Admin.Base.Forms.TextAreaComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminTextInputComponent => Kentico.Xperience.Admin.Base.Forms.TextInputComponent.IDENTIFIER; - ///Form component value type: System.String - public static string AdminTextWithLabelComponent => Kentico.Xperience.Admin.Base.Forms.TextWithLabelComponent.IDENTIFIER; - ///Form component value type: Kentico.Xperience.Admin.Base.Forms.TileSelectorItem - public static string AdminTileSelectorComponent => Kentico.Xperience.Admin.Base.Forms.TileSelectorComponent.IDENTIFIER; - ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.EmailLibrary.EmailRelatedItem, CMS.EmailMarketing, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] - public static string Kentico_Xperience_Admin_DigitalMarketing_Forms_EmailSelectorComponent => Kentico.Xperience.Admin.DigitalMarketing.Forms.EmailSelectorComponent.IDENTIFIER; - ///Form component value type: Kentico.Xperience.Admin.Headless.Forms.HeadlessItemSelectorProperties - public static string Kentico_Xperience_Admin_Headless_Forms_HeadlessItemSelectorComponent => Kentico.Xperience.Admin.Headless.Forms.HeadlessItemSelectorComponent.IDENTIFIER; - ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.Websites.WebPageRelatedItem, CMS.Websites, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] - public static string Kentico_Xperience_Admin_Websites_WebPageSelectorComponent => Kentico.Xperience.Admin.Websites.WebPageSelectorComponent.IDENTIFIER; - ///Form component value type: System.String - public static string Kentico_Xperience_Admin_Websites_Forms_UrlSelectorComponent => Kentico.Xperience.Admin.Websites.Forms.UrlSelectorComponent.IDENTIFIER; - - - // Abstract control: Kentico.Forms.Web.Mvc.ComparisonTypeSelectorComponent`1 - // Abstract control: Kentico.Forms.Web.Mvc.SelectorFormComponent`1 - // No identity prop control: Kentico.Forms.Web.Mvc.InvalidComponent - // Abstract control: Kentico.Content.Web.Mvc.MultiSelectorFormComponent`1 - // Abstract control: Kentico.Components.Web.Mvc.Selectors.Internal.ObjectSelectorComponentBase`2 - // Abstract control: Kentico.Components.Web.Mvc.FormComponents.Internal.PageSelectorBase`2 - // Internal control: Kentico.Xperience.Admin.Base.Forms.AdditionalActionListComponent - // Abstract control: Kentico.Xperience.Admin.Base.Forms.FormComponentWithNestedComponents`3 - // Abstract control: Kentico.Xperience.Admin.Base.Forms.FormComponent`2 - // Internal control: Kentico.Xperience.Admin.Base.Forms.CodeNameComponent - // Abstract control: Kentico.Xperience.Admin.Base.Forms.ContentItemSelectorComponentBase`1 - // Internal control: Kentico.Xperience.Admin.Base.Forms.DateRangeInputComponent - // Internal control: Kentico.Xperience.Admin.Base.Forms.DoubleNumberInputComponent - // No identity prop control: Kentico.Xperience.Admin.Base.Forms.GeneralSelectorComponent - // No identity prop control: Kentico.Xperience.Admin.Base.Forms.SingleGeneralSelectorComponent - // Internal control: Kentico.Xperience.Admin.Base.Forms.MacroWrapperComponent - // Internal control: Kentico.Xperience.Admin.Base.Forms.NamespaceCodeNameComponent - // Abstract control: Kentico.Xperience.Admin.Base.Forms.MultipleObjectSelectorBase`2 - // Abstract control: Kentico.Xperience.Admin.Base.Forms.ObjectSelectorBase`4 - // No identity prop control: Kentico.Xperience.Admin.Base.Forms.ObjectSelectorComponent - // Abstract control: Kentico.Xperience.Admin.Base.Forms.SingleObjectSelectorBase`2 - // Internal control: Kentico.Xperience.Admin.Base.Forms.ValidationRuleListComponent - // Abstract control: Kentico.Xperience.Admin.Base.Forms.Internal.DateInputComponentBase`3 - // Abstract control: Kentico.Xperience.Admin.Base.Forms.Internal.GeneralSelectorComponentBase`3 - // No identity prop control: Kentico.Xperience.Admin.DigitalMarketing.Forms.FormSelectorComponent +namespace Migration.Toolkit.KXP.Api.Auxiliary; + +public class FormComponents +{ + ///Form component value type: Kentico.Forms.Web.Mvc.BoolFieldValueTypes + public static string MvcBoolComparisonTypeSelectorComponent => Kentico.Forms.Web.Mvc.BoolComparisonTypeSelectorComponent.IDENTIFIER; + ///Form component value type: System.Boolean + public static string MvcCheckBoxComponent => Kentico.Forms.Web.Mvc.CheckBoxComponent.IDENTIFIER; + ///Form component value type: System.Guid + public static string MvcCompareToFieldSelectorComponent => Kentico.Forms.Web.Mvc.CompareToFieldSelectorComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string MvcConsentAgreementComponent => Kentico.Forms.Web.Mvc.ConsentAgreementComponent.IDENTIFIER; + public static string MvcConsentSelectorComponent => Kentico.Forms.Web.Mvc.ConsentSelectorComponent.IDENTIFIER; + ///Form component value type: Kentico.Forms.Web.Mvc.DropDownProperties + public static string MvcDropDownComponent => Kentico.Forms.Web.Mvc.DropDownComponent.IDENTIFIER; + ///Form component value type: System.String + public static string MvcEmailInputComponent => Kentico.Forms.Web.Mvc.EmailInputComponent.IDENTIFIER; + ///Form component value type: CMS.OnlineForms.BizFormUploadFile + public static string MvcFileUploaderComponent => Kentico.Forms.Web.Mvc.FileUploaderComponent.IDENTIFIER; + ///Form component value type: System.Guid + public static string MvcHiddenGuidInputComponent => Kentico.Forms.Web.Mvc.HiddenGuidInputComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string MvcIntInputComponent => Kentico.Forms.Web.Mvc.IntInputComponent.IDENTIFIER; + public static string MvcNameComponent => Kentico.Forms.Web.Mvc.NameComponent.IDENTIFIER; + ///Form component value type: Kentico.Forms.Web.Mvc.NumericFieldComparisonTypes + public static string MvcNumericComparisonTypeSelectorComponent => Kentico.Forms.Web.Mvc.NumericComparisonTypeSelectorComponent.IDENTIFIER; + ///Form component value type: Kentico.Forms.Web.Mvc.RadioButtonsProperties + public static string MvcRadioButtonsComponent => Kentico.Forms.Web.Mvc.RadioButtonsComponent.IDENTIFIER; + ///Form component value type: System.String + public static string MvcRecaptchaComponent => Kentico.Forms.Web.Mvc.RecaptchaComponent.IDENTIFIER; + ///Form component value type: Kentico.Forms.Web.Mvc.StringFieldComparisonTypes + public static string MvcStringComparisonTypeSelectorComponent => Kentico.Forms.Web.Mvc.StringComparisonTypeSelectorComponent.IDENTIFIER; + ///Form component value type: System.String + public static string MvcTextAreaComponent => Kentico.Forms.Web.Mvc.TextAreaComponent.IDENTIFIER; + ///Form component value type: System.String + public static string MvcTextInputComponent => Kentico.Forms.Web.Mvc.TextInputComponent.IDENTIFIER; + ///Form component value type: System.String + public static string MvcUSPhoneComponent => Kentico.Forms.Web.Mvc.USPhoneComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.Double, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string MvcInternal_DoubleInputComponent => Kentico.Forms.Web.Mvc.Internal.DoubleInputComponent.IDENTIFIER; + ///Form component value type: Kentico.Content.Web.Mvc.MultiSelectorProperties + public static string Kentico_Content_Web_Mvc_MultipleChoiceComponent => Kentico.Content.Web.Mvc.MultipleChoiceComponent.IDENTIFIER; + ///Form component value type: System.String + public static string MvcFcRichTextComponent => Kentico.Components.Web.Mvc.FormComponents.RichTextComponent.IDENTIFIER; + ///Form component value type: System.Collections.Generic.IEnumerable`1[[Kentico.Components.Web.Mvc.FormComponents.MediaFilesSelectorItem, Kentico.Content.Web.Mvc, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] + public static string MvcFcMediaFilesSelector => Kentico.Components.Web.Mvc.FormComponents.MediaFilesSelector.IDENTIFIER; + ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.GeneralSelectorItem + public static string MvcFcGeneralSelector => Kentico.Components.Web.Mvc.FormComponents.GeneralSelector.IDENTIFIER; + ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.ObjectSelectorItem + public static string MvcFcObjectSelector => Kentico.Components.Web.Mvc.FormComponents.ObjectSelector.IDENTIFIER; + ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.PageSelectorItem + public static string MvcFcPageSelector => Kentico.Components.Web.Mvc.FormComponents.PageSelector.IDENTIFIER; + ///Form component value type: Kentico.Components.Web.Mvc.FormComponents.PathSelectorItem + public static string MvcFcPathSelector => Kentico.Components.Web.Mvc.FormComponents.PathSelector.IDENTIFIER; + ///Form component value type: System.String + public static string MvcFcUrlSelector => Kentico.Components.Web.Mvc.FormComponents.UrlSelector.IDENTIFIER; + ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.MediaLibrary.AssetRelatedItem, CMS.MediaLibrary, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] + public static string AdminAssetSelectorComponent => Kentico.Xperience.Admin.Base.Forms.AssetSelectorComponent.IDENTIFIER; + ///Form component value type: System.Boolean + public static string AdminCheckBoxComponent => Kentico.Xperience.Admin.Base.Forms.CheckBoxComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminCodeEditorComponent => Kentico.Xperience.Admin.Base.Forms.CodeEditorComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminConditionBuilderComponent => Kentico.Xperience.Admin.Base.Forms.ConditionBuilderComponent.IDENTIFIER; + ///Form component value type: CMS.ContentEngine.ContentItemAssetMetadata + public static string AdminContentItemAssetUploaderComponent => Kentico.Xperience.Admin.Base.Forms.ContentItemAssetUploaderComponent.IDENTIFIER; + ///Form component value type: Kentico.Xperience.Admin.Base.Forms.ContentItemSelectorProperties + public static string AdminContentItemSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ContentItemSelectorComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string AdminDateInputComponent => Kentico.Xperience.Admin.Base.Forms.DateInputComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string AdminDateTimeInputComponent => Kentico.Xperience.Admin.Base.Forms.DateTimeInputComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.Decimal, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string AdminDecimalNumberInputComponent => Kentico.Xperience.Admin.Base.Forms.DecimalNumberInputComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminDropDownComponent => Kentico.Xperience.Admin.Base.Forms.DropDownComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminExtensionSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ExtensionSelectorComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminIconSelectorComponent => Kentico.Xperience.Admin.Base.Forms.IconSelectorComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminLinkComponent => Kentico.Xperience.Admin.Base.Forms.LinkComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string AdminNumberInputComponent => Kentico.Xperience.Admin.Base.Forms.NumberInputComponent.IDENTIFIER; + ///Form component value type: System.Int32 + public static string AdminNumberWithLabelComponent => Kentico.Xperience.Admin.Base.Forms.NumberWithLabelComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminObjectCodeNameSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ObjectCodeNameSelectorComponent.IDENTIFIER; + ///Form component value type: System.Guid + public static string AdminObjectGuidSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ObjectGuidSelectorComponent.IDENTIFIER; + ///Form component value type: System.Int32 + public static string AdminObjectIdSelectorComponent => Kentico.Xperience.Admin.Base.Forms.ObjectIdSelectorComponent.IDENTIFIER; + ///Form component value type: System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] + public static string AdminSingleObjectIdSelectorComponent => Kentico.Xperience.Admin.Base.Forms.SingleObjectIdSelectorComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminPasswordComponent => Kentico.Xperience.Admin.Base.Forms.PasswordComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminRadioGroupComponent => Kentico.Xperience.Admin.Base.Forms.RadioGroupComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminRichTextEditorComponent => Kentico.Xperience.Admin.Base.Forms.RichTextEditorComponent.IDENTIFIER; + ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.ContentEngine.TagReference, CMS.ContentEngine, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] + public static string AdminTagSelectorComponent => Kentico.Xperience.Admin.Base.Forms.TagSelectorComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminTextAreaComponent => Kentico.Xperience.Admin.Base.Forms.TextAreaComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminTextInputComponent => Kentico.Xperience.Admin.Base.Forms.TextInputComponent.IDENTIFIER; + ///Form component value type: System.String + public static string AdminTextWithLabelComponent => Kentico.Xperience.Admin.Base.Forms.TextWithLabelComponent.IDENTIFIER; + ///Form component value type: Kentico.Xperience.Admin.Base.Forms.TileSelectorItem + public static string AdminTileSelectorComponent => Kentico.Xperience.Admin.Base.Forms.TileSelectorComponent.IDENTIFIER; + ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.EmailLibrary.EmailRelatedItem, CMS.EmailMarketing, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] + public static string Kentico_Xperience_Admin_DigitalMarketing_Forms_EmailSelectorComponent => Kentico.Xperience.Admin.DigitalMarketing.Forms.EmailSelectorComponent.IDENTIFIER; + ///Form component value type: Kentico.Xperience.Admin.Headless.Forms.HeadlessItemSelectorProperties + public static string Kentico_Xperience_Admin_Headless_Forms_HeadlessItemSelectorComponent => Kentico.Xperience.Admin.Headless.Forms.HeadlessItemSelectorComponent.IDENTIFIER; + ///Form component value type: System.Collections.Generic.IEnumerable`1[[CMS.Websites.WebPageRelatedItem, CMS.Websites, Version=28.4.1.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] + public static string Kentico_Xperience_Admin_Websites_WebPageSelectorComponent => Kentico.Xperience.Admin.Websites.WebPageSelectorComponent.IDENTIFIER; + ///Form component value type: System.String + public static string Kentico_Xperience_Admin_Websites_Forms_UrlSelectorComponent => Kentico.Xperience.Admin.Websites.Forms.UrlSelectorComponent.IDENTIFIER; + + + // Abstract control: Kentico.Forms.Web.Mvc.ComparisonTypeSelectorComponent`1 + // Abstract control: Kentico.Forms.Web.Mvc.SelectorFormComponent`1 + // No identity prop control: Kentico.Forms.Web.Mvc.InvalidComponent + // Abstract control: Kentico.Content.Web.Mvc.MultiSelectorFormComponent`1 + // Abstract control: Kentico.Components.Web.Mvc.Selectors.Internal.ObjectSelectorComponentBase`2 + // Abstract control: Kentico.Components.Web.Mvc.FormComponents.Internal.PageSelectorBase`2 + // Internal control: Kentico.Xperience.Admin.Base.Forms.AdditionalActionListComponent + // Abstract control: Kentico.Xperience.Admin.Base.Forms.FormComponentWithNestedComponents`3 + // Abstract control: Kentico.Xperience.Admin.Base.Forms.FormComponent`2 + // Internal control: Kentico.Xperience.Admin.Base.Forms.CodeNameComponent + // Abstract control: Kentico.Xperience.Admin.Base.Forms.ContentItemSelectorComponentBase`1 + // Internal control: Kentico.Xperience.Admin.Base.Forms.DateRangeInputComponent + // Internal control: Kentico.Xperience.Admin.Base.Forms.DoubleNumberInputComponent + // No identity prop control: Kentico.Xperience.Admin.Base.Forms.GeneralSelectorComponent + // No identity prop control: Kentico.Xperience.Admin.Base.Forms.SingleGeneralSelectorComponent + // Internal control: Kentico.Xperience.Admin.Base.Forms.MacroWrapperComponent + // Internal control: Kentico.Xperience.Admin.Base.Forms.NamespaceCodeNameComponent + // Abstract control: Kentico.Xperience.Admin.Base.Forms.MultipleObjectSelectorBase`2 + // Abstract control: Kentico.Xperience.Admin.Base.Forms.ObjectSelectorBase`4 + // No identity prop control: Kentico.Xperience.Admin.Base.Forms.ObjectSelectorComponent + // Abstract control: Kentico.Xperience.Admin.Base.Forms.SingleObjectSelectorBase`2 + // Internal control: Kentico.Xperience.Admin.Base.Forms.ValidationRuleListComponent + // Abstract control: Kentico.Xperience.Admin.Base.Forms.Internal.DateInputComponentBase`3 + // Abstract control: Kentico.Xperience.Admin.Base.Forms.Internal.GeneralSelectorComponentBase`3 + // No identity prop control: Kentico.Xperience.Admin.DigitalMarketing.Forms.FormSelectorComponent } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/DependencyInjectionExtensions.cs b/Migration.Toolkit.KXP.Api/DependencyInjectionExtensions.cs index 14c424db..9d788fc2 100644 --- a/Migration.Toolkit.KXP.Api/DependencyInjectionExtensions.cs +++ b/Migration.Toolkit.KXP.Api/DependencyInjectionExtensions.cs @@ -1,26 +1,26 @@ -namespace Migration.Toolkit.KXP.Api; - -using CMS.Core; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Migration.Toolkit.KXP.Api.Services.CmsClass; - -public static class DependencyInjectionExtensions -{ - public static IServiceCollection UseKxpApi(this IServiceCollection services, IConfiguration configuration, string? applicationPhysicalPath = null) - { - Service.Use(configuration); - if (applicationPhysicalPath != null && Directory.Exists(applicationPhysicalPath)) - { - CMS.Base.SystemContext.WebApplicationPhysicalPath = applicationPhysicalPath; - } - - services.AddSingleton(); - services.AddSingleton(); - - services.AddSingleton(); - services.AddSingleton(); - - return services; - } +namespace Migration.Toolkit.KXP.Api; + +using CMS.Core; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Migration.Toolkit.KXP.Api.Services.CmsClass; + +public static class DependencyInjectionExtensions +{ + public static IServiceCollection UseKxpApi(this IServiceCollection services, IConfiguration configuration, string? applicationPhysicalPath = null) + { + Service.Use(configuration); + if (applicationPhysicalPath != null && Directory.Exists(applicationPhysicalPath)) + { + CMS.Base.SystemContext.WebApplicationPhysicalPath = applicationPhysicalPath; + } + + services.AddSingleton(); + services.AddSingleton(); + + services.AddSingleton(); + services.AddSingleton(); + + return services; + } } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/Enums/UserPrivilegeLevelEnum.cs b/Migration.Toolkit.KXP.Api/Enums/UserPrivilegeLevelEnum.cs index 969c527f..1f2b9583 100644 --- a/Migration.Toolkit.KXP.Api/Enums/UserPrivilegeLevelEnum.cs +++ b/Migration.Toolkit.KXP.Api/Enums/UserPrivilegeLevelEnum.cs @@ -1,20 +1,20 @@ -namespace Migration.Toolkit.KXP.Api.Enums; - -/// -/// copy from Kentico Xperience 13 -/// -public enum UserPrivilegeLevelEnum -{ - /// User has no privilege level - None = 0, - /// User is able to use administration interface - Editor = 1, - /// - /// User can use all applications except the global applications and functionality - /// - Admin = 2, - /// - /// User can use all applications and functionality without any exceptions - /// - GlobalAdmin = 3, +namespace Migration.Toolkit.KXP.Api.Enums; + +/// +/// copy from Kentico Xperience 13 +/// +public enum UserPrivilegeLevelEnum +{ + /// User has no privilege level + None = 0, + /// User is able to use administration interface + Editor = 1, + /// + /// User can use all applications except the global applications and functionality + /// + Admin = 2, + /// + /// User can use all applications and functionality without any exceptions + /// + GlobalAdmin = 3, } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/KxpApiInitializer.cs b/Migration.Toolkit.KXP.Api/KxpApiInitializer.cs index 5c838f61..3bef3582 100644 --- a/Migration.Toolkit.KXP.Api/KxpApiInitializer.cs +++ b/Migration.Toolkit.KXP.Api/KxpApiInitializer.cs @@ -1,33 +1,33 @@ -namespace Migration.Toolkit.KXP.Api; - -using CMS.DataEngine; -using Microsoft.Extensions.Logging; - -public class KxpApiInitializer(ILogger logger) -{ - private bool _apiInitializationCalled = false; - - public bool EnsureApiIsInitialized() - { - if (!_apiInitializationCalled) - { - logger.LogTrace("Kxp api initialization called"); - if (!CMSApplication.Init()) - { - logger.LogError("Kxp api initialization failed!"); - return false; - } - else - { - _apiInitializationCalled = true; - logger.LogInformation("Kxp api initialization finished"); - } - } - else - { - logger.LogTrace("Kxp api initialization already called, skipping init"); - } - - return true; - } +namespace Migration.Toolkit.KXP.Api; + +using CMS.DataEngine; +using Microsoft.Extensions.Logging; + +public class KxpApiInitializer(ILogger logger) +{ + private bool _apiInitializationCalled = false; + + public bool EnsureApiIsInitialized() + { + if (!_apiInitializationCalled) + { + logger.LogTrace("Kxp api initialization called"); + if (!CMSApplication.Init()) + { + logger.LogError("Kxp api initialization failed!"); + return false; + } + else + { + _apiInitializationCalled = true; + logger.LogInformation("Kxp api initialization finished"); + } + } + else + { + logger.LogTrace("Kxp api initialization already called, skipping init"); + } + + return true; + } } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/KxpClassFacade.cs b/Migration.Toolkit.KXP.Api/KxpClassFacade.cs index 774b3bd0..273e6d16 100644 --- a/Migration.Toolkit.KXP.Api/KxpClassFacade.cs +++ b/Migration.Toolkit.KXP.Api/KxpClassFacade.cs @@ -1,81 +1,81 @@ -namespace Migration.Toolkit.KXP.Api; - -using System.Diagnostics; -using CMS.DataEngine; -using CMS.FormEngine; -using Migration.Toolkit.Common.Enumerations; - -public record CustomizedFieldInfo(string FieldName); - -public class KxpClassFacade -{ - public KxpClassFacade(KxpApiInitializer kxpApiInitializer) - { - kxpApiInitializer.EnsureApiIsInitialized(); - } - - public DataClassInfo SetClass(DataClassInfo dataClassInfo) - { - // TODO tk: 2022-05-30 dataClassInfo.ClassConnectionString - check, might cause unexpected behavior - DataClassInfoProvider.SetDataClassInfo(dataClassInfo); - Debug.Assert(dataClassInfo.ClassID != 0, "dataClassInfo.ClassID != 0"); - - // assert class form is well formed - // var formInfo = FormHelper.GetFormInfo(dataClassInfo.ClassName, false); - // var formElements = formInfo.GetFormElements(true, true); - - return dataClassInfo; - } - - public DataClassInfo GetClass(Guid classGuid) - { - return DataClassInfoProvider.GetDataClassInfo(classGuid); - } - - public DataClassInfo GetClass(string className) - { - return DataClassInfoProvider.GetDataClassInfo(className); - } - - - public IEnumerable GetCustomizedFieldInfos(string className) - { - var dci = DataClassInfoProvider.GetDataClassInfo(className); - var fi = new FormInfo(dci.ClassFormDefinition); - foreach (var columnName in fi.GetColumnNames()) - { - var field = fi.GetFormField(columnName); - if (!field.System) - { - yield return new CustomizedFieldInfo(columnName); - } - } - } - - public IEnumerable GetCustomizedFieldInfos(FormInfo formInfo) - { - foreach (var columnName in formInfo.GetColumnNames()) - { - var field = formInfo.GetFormField(columnName); - if (!field.System) - { - yield return new CustomizedFieldInfo(columnName); - } - } - } - - public IEnumerable GetCustomizedFieldInfosAll(string className) - { - var dci = DataClassInfoProvider.GetDataClassInfo(className); - - var fi = new FormInfo(dci.ClassFormDefinition); - foreach (var columnName in fi.GetColumnNames()) - { - var field = fi.GetFormField(columnName); - if (!field.System) - { - yield return new CustomizedFieldInfo(columnName); - } - } - } +namespace Migration.Toolkit.KXP.Api; + +using System.Diagnostics; +using CMS.DataEngine; +using CMS.FormEngine; +using Migration.Toolkit.Common.Enumerations; + +public record CustomizedFieldInfo(string FieldName); + +public class KxpClassFacade +{ + public KxpClassFacade(KxpApiInitializer kxpApiInitializer) + { + kxpApiInitializer.EnsureApiIsInitialized(); + } + + public DataClassInfo SetClass(DataClassInfo dataClassInfo) + { + // TODO tk: 2022-05-30 dataClassInfo.ClassConnectionString - check, might cause unexpected behavior + DataClassInfoProvider.SetDataClassInfo(dataClassInfo); + Debug.Assert(dataClassInfo.ClassID != 0, "dataClassInfo.ClassID != 0"); + + // assert class form is well formed + // var formInfo = FormHelper.GetFormInfo(dataClassInfo.ClassName, false); + // var formElements = formInfo.GetFormElements(true, true); + + return dataClassInfo; + } + + public DataClassInfo GetClass(Guid classGuid) + { + return DataClassInfoProvider.GetDataClassInfo(classGuid); + } + + public DataClassInfo GetClass(string className) + { + return DataClassInfoProvider.GetDataClassInfo(className); + } + + + public IEnumerable GetCustomizedFieldInfos(string className) + { + var dci = DataClassInfoProvider.GetDataClassInfo(className); + var fi = new FormInfo(dci.ClassFormDefinition); + foreach (var columnName in fi.GetColumnNames()) + { + var field = fi.GetFormField(columnName); + if (!field.System) + { + yield return new CustomizedFieldInfo(columnName); + } + } + } + + public IEnumerable GetCustomizedFieldInfos(FormInfo formInfo) + { + foreach (var columnName in formInfo.GetColumnNames()) + { + var field = formInfo.GetFormField(columnName); + if (!field.System) + { + yield return new CustomizedFieldInfo(columnName); + } + } + } + + public IEnumerable GetCustomizedFieldInfosAll(string className) + { + var dci = DataClassInfoProvider.GetDataClassInfo(className); + + var fi = new FormInfo(dci.ClassFormDefinition); + foreach (var columnName in fi.GetColumnNames()) + { + var field = fi.GetFormField(columnName); + if (!field.System) + { + yield return new CustomizedFieldInfo(columnName); + } + } + } } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/KxpMediaFileFacade.cs b/Migration.Toolkit.KXP.Api/KxpMediaFileFacade.cs index e75df708..607cc3a7 100644 --- a/Migration.Toolkit.KXP.Api/KxpMediaFileFacade.cs +++ b/Migration.Toolkit.KXP.Api/KxpMediaFileFacade.cs @@ -1,86 +1,86 @@ -namespace Migration.Toolkit.KXP.Api; - -using System.Diagnostics; -using CMS.DataEngine; -using CMS.MediaLibrary; -using Microsoft.Extensions.Logging; - -public class KxpMediaFileFacade -{ - private readonly ILogger _logger; - public KxpMediaFileFacade(ILogger logger, KxpApiInitializer kxpApiInitializer) - { - _logger = logger; - kxpApiInitializer.EnsureApiIsInitialized(); - } - - public void SetMediaFile(MediaFileInfo mfi, bool newInstance) - { - Debug.Assert((newInstance && mfi.FileID == 0) || (!newInstance && mfi.FileID != 0), "newInstance && mfi.FileID == 0"); - - if (newInstance) - { - mfi.SaveFileToDisk(true); - mfi.Insert(); - } - else - { - mfi.Update(); - } - } - - public MediaFileInfo? GetMediaFile(Guid mediaFileGuid) - { - return MediaFileInfoProvider.GetMediaFiles("").Where(nameof(MediaFileInfo.FileGUID), QueryOperator.Equals, mediaFileGuid).SingleOrDefault(); - } - - // flaky feature - can be supported only at cost of performance & data integrity hit - // public MediaFileInfo? GetMediaFileByPath(string siteName, string? path) - // { - // if (string.IsNullOrWhiteSpace(path)) return null; - // MediaFileInfoProvider.GetMediaFileInfo(siteName, ) - // return MediaFileInfoProvider.GetMediaFiles("").Where(nameof(MediaFileInfo.FileGUID), QueryOperator.Equals, mediaFileGuid).SingleOrDefault(); - // } - - public MediaLibraryInfo GetMediaLibraryInfo(Guid mediaLibraryGuid) - { - return MediaLibraryInfoProvider.ProviderObject.Get(mediaLibraryGuid); - } - - public void EnsureMediaFilePathExistsInLibrary(MediaFileInfo mfi, int libraryId) - { - var librarySubDir = System.IO.Path.GetDirectoryName(mfi.FilePath); - // TODOV27 tomas.krch: 2023-09-05: media library => obsolete create method with sitename - MediaLibraryInfoProvider.CreateMediaLibraryFolder(libraryId, $"{librarySubDir}", false); - } - - public MediaLibraryInfo CreateMediaLibrary(int siteId, string libraryFolder, string libraryDescription, string libraryName, string libraryDisplayName) - { - // Creates a new media library object - MediaLibraryInfo newLibrary = new MediaLibraryInfo(); - - // Sets the library properties - newLibrary.LibraryDisplayName = libraryDisplayName; - newLibrary.LibraryName = libraryName; - newLibrary.LibraryDescription = libraryDescription; - newLibrary.LibraryFolder = libraryFolder; - - // TODO tomas.krch: 2023-11-02 ?? newLibrary.LibraryUseDirectPathForContent - // TODOV27 tomas.krch: 2023-09-05: library site id ref (replace with channel?) - // newLibrary.LibrarySiteID = siteId; - - // Saves the new media library to the database - MediaLibraryInfo.Provider.Set(newLibrary); - - return newLibrary; - } - - public MediaLibraryInfo SetMediaLibrary(MediaLibraryInfo mfi) - { - MediaLibraryInfo.Provider.Set(mfi); - - Debug.Assert(mfi.LibraryID != 0, "mfi.LibraryID != 0"); - - return mfi; - } +namespace Migration.Toolkit.KXP.Api; + +using System.Diagnostics; +using CMS.DataEngine; +using CMS.MediaLibrary; +using Microsoft.Extensions.Logging; + +public class KxpMediaFileFacade +{ + private readonly ILogger _logger; + public KxpMediaFileFacade(ILogger logger, KxpApiInitializer kxpApiInitializer) + { + _logger = logger; + kxpApiInitializer.EnsureApiIsInitialized(); + } + + public void SetMediaFile(MediaFileInfo mfi, bool newInstance) + { + Debug.Assert((newInstance && mfi.FileID == 0) || (!newInstance && mfi.FileID != 0), "newInstance && mfi.FileID == 0"); + + if (newInstance) + { + mfi.SaveFileToDisk(true); + mfi.Insert(); + } + else + { + mfi.Update(); + } + } + + public MediaFileInfo? GetMediaFile(Guid mediaFileGuid) + { + return MediaFileInfoProvider.GetMediaFiles("").Where(nameof(MediaFileInfo.FileGUID), QueryOperator.Equals, mediaFileGuid).SingleOrDefault(); + } + + // flaky feature - can be supported only at cost of performance & data integrity hit + // public MediaFileInfo? GetMediaFileByPath(string siteName, string? path) + // { + // if (string.IsNullOrWhiteSpace(path)) return null; + // MediaFileInfoProvider.GetMediaFileInfo(siteName, ) + // return MediaFileInfoProvider.GetMediaFiles("").Where(nameof(MediaFileInfo.FileGUID), QueryOperator.Equals, mediaFileGuid).SingleOrDefault(); + // } + + public MediaLibraryInfo GetMediaLibraryInfo(Guid mediaLibraryGuid) + { + return MediaLibraryInfoProvider.ProviderObject.Get(mediaLibraryGuid); + } + + public void EnsureMediaFilePathExistsInLibrary(MediaFileInfo mfi, int libraryId) + { + var librarySubDir = System.IO.Path.GetDirectoryName(mfi.FilePath); + // TODOV27 tomas.krch: 2023-09-05: media library => obsolete create method with sitename + MediaLibraryInfoProvider.CreateMediaLibraryFolder(libraryId, $"{librarySubDir}", false); + } + + public MediaLibraryInfo CreateMediaLibrary(int siteId, string libraryFolder, string libraryDescription, string libraryName, string libraryDisplayName) + { + // Creates a new media library object + MediaLibraryInfo newLibrary = new MediaLibraryInfo(); + + // Sets the library properties + newLibrary.LibraryDisplayName = libraryDisplayName; + newLibrary.LibraryName = libraryName; + newLibrary.LibraryDescription = libraryDescription; + newLibrary.LibraryFolder = libraryFolder; + + // TODO tomas.krch: 2023-11-02 ?? newLibrary.LibraryUseDirectPathForContent + // TODOV27 tomas.krch: 2023-09-05: library site id ref (replace with channel?) + // newLibrary.LibrarySiteID = siteId; + + // Saves the new media library to the database + MediaLibraryInfo.Provider.Set(newLibrary); + + return newLibrary; + } + + public MediaLibraryInfo SetMediaLibrary(MediaLibraryInfo mfi) + { + MediaLibraryInfo.Provider.Set(mfi); + + Debug.Assert(mfi.LibraryID != 0, "mfi.LibraryID != 0"); + + return mfi; + } } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/Services/CmsClass/FieldMigrationService.cs b/Migration.Toolkit.KXP.Api/Services/CmsClass/FieldMigrationService.cs index df84d372..092a70fc 100644 --- a/Migration.Toolkit.KXP.Api/Services/CmsClass/FieldMigrationService.cs +++ b/Migration.Toolkit.KXP.Api/Services/CmsClass/FieldMigrationService.cs @@ -1,85 +1,85 @@ -namespace Migration.Toolkit.KXP.Api.Services.CmsClass; - -using System.Text.RegularExpressions; -using Microsoft.Extensions.Logging; -using Migration.Toolkit.Common; - -public class FieldMigrationService // shall be singleton to cache necessary data -{ - private readonly ILogger _logger; - private readonly FieldMigration[] _userDefinedMigrations; - - public FieldMigrationService(ToolkitConfiguration configuration, ILogger logger) - { - _logger = logger; - - var allUserDefinedMigrations = configuration.OptInFeatures?.CustomMigration?.FieldMigrations?.Select(fm => - new FieldMigration( - fm.SourceDataType!, - fm.TargetDataType!, - fm.SourceFormControl!, - fm.TargetFormComponent!, - fm.Actions, - fm.FieldNameRegex != null ? new Regex(fm.FieldNameRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase) : null - ) - ).ToArray() ?? Array.Empty(); - _userDefinedMigrations = allUserDefinedMigrations; - } - - public FieldMigration? GetFieldMigration(string sourceDataType, string? sourceFormControl, string? fieldName) - { - if (sourceFormControl == null) - { - _logger.LogDebug("Source field has no control defined '{SourceDataType}', field '{FieldName}'", sourceDataType, fieldName); - return null; - } - - var userDefined = GetFieldMigrationInternal(_userDefinedMigrations, sourceDataType, sourceFormControl, fieldName); - if (userDefined is { }) - { - _logger.LogDebug("Field migration matched: '{MatchType}', {Migration}", "UserDefined", userDefined); - return userDefined; - } - - var preDefined = GetFieldMigrationInternal(FieldMappingInstance.BuiltInFieldMigrations, sourceDataType, sourceFormControl, fieldName); - if (preDefined is { }) - { - _logger.LogDebug("Field migration matched: '{MatchType}', {Migration}", "BuiltIn", preDefined); - return preDefined; - } - - throw new InvalidOperationException($"No migration found for combination of '{sourceDataType}' datatype and '{sourceFormControl}'"); - } - - private static FieldMigration? GetFieldMigrationInternal(FieldMigration[] migrations, string sourceDataType, string? sourceFormControl, string? fieldName) - { - var matchedByDtFc = migrations.Where(x => - string.Equals(x.SourceDataType, sourceDataType, StringComparison.InvariantCultureIgnoreCase) && - string.Equals(x.SourceFormControl, sourceFormControl, StringComparison.InvariantCultureIgnoreCase) - ).ToArray(); - - if (matchedByDtFc is { Length: > 0 }) - { - if (matchedByDtFc.LastOrDefault(x => fieldName != null && (x.FieldNameRegex?.IsMatch(fieldName) ?? false)) is { } exactMatch) - { - return exactMatch; - } - - if (matchedByDtFc.LastOrDefault() is { } looseMatch) - { - return looseMatch; - } - } - - var generalMatch = migrations.LastOrDefault(x => - string.Equals(x.SourceDataType, sourceDataType, StringComparison.InvariantCultureIgnoreCase) && - string.Equals(x.SourceFormControl, SfcDirective.CatchAnyNonMatching, StringComparison.InvariantCultureIgnoreCase) - ); - if (generalMatch is { }) - { - return generalMatch; - } - - return null; - } +namespace Migration.Toolkit.KXP.Api.Services.CmsClass; + +using System.Text.RegularExpressions; +using Microsoft.Extensions.Logging; +using Migration.Toolkit.Common; + +public class FieldMigrationService // shall be singleton to cache necessary data +{ + private readonly ILogger _logger; + private readonly FieldMigration[] _userDefinedMigrations; + + public FieldMigrationService(ToolkitConfiguration configuration, ILogger logger) + { + _logger = logger; + + var allUserDefinedMigrations = configuration.OptInFeatures?.CustomMigration?.FieldMigrations?.Select(fm => + new FieldMigration( + fm.SourceDataType!, + fm.TargetDataType!, + fm.SourceFormControl!, + fm.TargetFormComponent!, + fm.Actions, + fm.FieldNameRegex != null ? new Regex(fm.FieldNameRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase) : null + ) + ).ToArray() ?? Array.Empty(); + _userDefinedMigrations = allUserDefinedMigrations; + } + + public FieldMigration? GetFieldMigration(string sourceDataType, string? sourceFormControl, string? fieldName) + { + if (sourceFormControl == null) + { + _logger.LogDebug("Source field has no control defined '{SourceDataType}', field '{FieldName}'", sourceDataType, fieldName); + return null; + } + + var userDefined = GetFieldMigrationInternal(_userDefinedMigrations, sourceDataType, sourceFormControl, fieldName); + if (userDefined is { }) + { + _logger.LogDebug("Field migration matched: '{MatchType}', {Migration}", "UserDefined", userDefined); + return userDefined; + } + + var preDefined = GetFieldMigrationInternal(FieldMappingInstance.BuiltInFieldMigrations, sourceDataType, sourceFormControl, fieldName); + if (preDefined is { }) + { + _logger.LogDebug("Field migration matched: '{MatchType}', {Migration}", "BuiltIn", preDefined); + return preDefined; + } + + throw new InvalidOperationException($"No migration found for combination of '{sourceDataType}' datatype and '{sourceFormControl}'"); + } + + private static FieldMigration? GetFieldMigrationInternal(FieldMigration[] migrations, string sourceDataType, string? sourceFormControl, string? fieldName) + { + var matchedByDtFc = migrations.Where(x => + string.Equals(x.SourceDataType, sourceDataType, StringComparison.InvariantCultureIgnoreCase) && + string.Equals(x.SourceFormControl, sourceFormControl, StringComparison.InvariantCultureIgnoreCase) + ).ToArray(); + + if (matchedByDtFc is { Length: > 0 }) + { + if (matchedByDtFc.LastOrDefault(x => fieldName != null && (x.FieldNameRegex?.IsMatch(fieldName) ?? false)) is { } exactMatch) + { + return exactMatch; + } + + if (matchedByDtFc.LastOrDefault() is { } looseMatch) + { + return looseMatch; + } + } + + var generalMatch = migrations.LastOrDefault(x => + string.Equals(x.SourceDataType, sourceDataType, StringComparison.InvariantCultureIgnoreCase) && + string.Equals(x.SourceFormControl, SfcDirective.CatchAnyNonMatching, StringComparison.InvariantCultureIgnoreCase) + ); + if (generalMatch is { }) + { + return generalMatch; + } + + return null; + } } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Api/Services/CmsClass/FormFieldMappingModel.cs b/Migration.Toolkit.KXP.Api/Services/CmsClass/FormFieldMappingModel.cs index d7211ae7..77a63060 100644 --- a/Migration.Toolkit.KXP.Api/Services/CmsClass/FormFieldMappingModel.cs +++ b/Migration.Toolkit.KXP.Api/Services/CmsClass/FormFieldMappingModel.cs @@ -1,97 +1,97 @@ -namespace Migration.Toolkit.KXP.Api.Services.CmsClass; - -using System.Text.RegularExpressions; -using CMS.DataEngine; -using CMS.OnlineForms; -using Migration.Toolkit.Common.Enumerations; -using Migration.Toolkit.KXP.Api.Auxiliary; -using FcText = Common.Enumerations.Kx13FormControls.UserControlForText; -using FcLongText = Common.Enumerations.Kx13FormControls.UserControlForLongText; - -public record FormComponentReplacement(string OldFormComponent, string NewFormComponent); - -public record DataTypeMigrationModel( - FieldMigration[] FieldMigrations, - FormComponentReplacement[] NotSupportedInKxpLegacyMode, - [property: Obsolete("Legacy mode is no longer supported")] - string[] SupportedInKxpLegacyMode -); -public record FieldMigration(string SourceDataType, string TargetDataType, string SourceFormControl, string? TargetFormComponent, string[]? Actions = null, Regex? FieldNameRegex = null); - -/// -/// Tca = target control action -/// -public static partial class TcaDirective -{ - public const string ClearSettings = "clear settings"; - public const string ClearMacroTable = "clear hashtable"; - public const string ConvertToAsset = "convert to asset"; - public const string ConvertToPages = "convert to pages"; -} - -/// -/// Tfc = Target form component -/// -public static class TfcDirective -{ - public const string CopySourceControl = "#copy-source-control#"; - public const string DoNothing = "#nothing#"; - public const string Clear = "#clear#"; -} - -/// -/// Sfc = source form control -/// -public static class SfcDirective -{ - public const string CatchAnyNonMatching = "#any#"; -} - -public static class FieldMappingInstance -{ - public static FieldMigration[] BuiltInFieldMigrations => - [ - new(KsFieldDataType.ALL, FieldDataType.ALL, SfcDirective.CatchAnyNonMatching, null, [TfcDirective.Clear]), - new(KsFieldDataType.Unknown, FieldDataType.Unknown, SfcDirective.CatchAnyNonMatching, null, [TfcDirective.Clear]), - new(KsFieldDataType.Text, FieldDataType.Text, FcText.TextBoxControl, FormComponents.AdminTextInputComponent), - new(KsFieldDataType.Text, FieldDataType.Text, FcText.DropDownListControl, FormComponents.AdminDropDownComponent), - new(KsFieldDataType.Text, FieldDataType.Text, FcText.IconSelector, FormComponents.AdminIconSelectorComponent), - new(KsFieldDataType.Text, FieldDataType.Text, FcText.Password, FormComponents.AdminPasswordComponent), - new(KsFieldDataType.Text, FieldDataType.Text, FcText.RadioButtonsControl, FormComponents.AdminRadioGroupComponent), - new(KsFieldDataType.Text, FieldDataType.Text, FcText.TextAreaControl, FormComponents.AdminTextAreaComponent), - new(KsFieldDataType.Text, FieldDataType.Text, SfcDirective.CatchAnyNonMatching, FormComponents.AdminTextInputComponent), - new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.HtmlAreaControl, FormComponents.AdminRichTextEditorComponent), - new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.TextBoxControl, FormComponents.AdminTextInputComponent), - new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.DropDownListControl, FormComponents.AdminDropDownComponent), - new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.TextAreaControl, FormComponents.AdminTextAreaComponent), - new(KsFieldDataType.LongText, FieldDataType.LongText, SfcDirective.CatchAnyNonMatching, FormComponents.AdminRichTextEditorComponent), - new(KsFieldDataType.Integer, FieldDataType.Integer, SfcDirective.CatchAnyNonMatching, FormComponents.AdminNumberInputComponent), - new(KsFieldDataType.LongInteger, FieldDataType.LongInteger, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear, [TfcDirective.Clear]),//FormComponents.AdminNumberInputComponent), - new(KsFieldDataType.Double, FieldDataType.Double, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear, [TfcDirective.Clear]),// FormComponents.AdminNumberInputComponent), - new(KsFieldDataType.Decimal, FieldDataType.Decimal, SfcDirective.CatchAnyNonMatching, FormComponents.AdminDecimalNumberInputComponent), - new(KsFieldDataType.DateTime, FieldDataType.DateTime, SfcDirective.CatchAnyNonMatching, FormComponents.AdminDateTimeInputComponent), - new(KsFieldDataType.Date, FieldDataType.Date, SfcDirective.CatchAnyNonMatching, FormComponents.AdminDateInputComponent), - new(KsFieldDataType.TimeSpan, FieldDataType.TimeSpan, SfcDirective.CatchAnyNonMatching, FormComponents.AdminTextInputComponent), - new(KsFieldDataType.Boolean, FieldDataType.Boolean, SfcDirective.CatchAnyNonMatching, FormComponents.AdminCheckBoxComponent), - new(KsFieldDataType.DocAttachments, FieldDataType.Assets, SfcDirective.CatchAnyNonMatching, FormComponents.AdminAssetSelectorComponent, [TcaDirective.ConvertToAsset]), - new(KsFieldDataType.File, FieldDataType.Assets, SfcDirective.CatchAnyNonMatching, FormComponents.AdminAssetSelectorComponent, [TcaDirective.ConvertToAsset]), - new(KsFieldDataType.Guid, FieldDataType.LongText, "RelatedDocuments", FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent, [TcaDirective.ConvertToPages]), - new(KsFieldDataType.Guid, FieldDataType.Guid, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear), - new(KsFieldDataType.Binary, FieldDataType.Binary, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear), - new(KsFieldDataType.Xml, FieldDataType.Xml, SfcDirective.CatchAnyNonMatching, FormComponents.AdminNumberWithLabelComponent), - new(KsFieldDataType.DocRelationships, FieldDataType.WebPages, SfcDirective.CatchAnyNonMatching, FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent, [TcaDirective.ConvertToPages]), - - new(KsFieldDataType.TimeSpan, FieldDataType.TimeSpan, SfcDirective.CatchAnyNonMatching, FormComponents.AdminTextInputComponent, [TcaDirective.ConvertToPages]), - new(KsFieldDataType.BizFormFile, BizFormUploadFile.DATATYPE_FORMFILE, SfcDirective.CatchAnyNonMatching, FormComponents.MvcFileUploaderComponent, []), - ]; - - public static DataTypeMigrationModel BuiltInModel => new( - BuiltInFieldMigrations, - [ - new(Kx13FormComponents.Kentico_AttachmentSelector, FormComponents.AdminAssetSelectorComponent), - new(Kx13FormComponents.Kentico_PageSelector, FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent), - // new(Kx13FormComponents.Kentico_PathSelector, FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent) - ], - [] // legacy mode is no more - ); +namespace Migration.Toolkit.KXP.Api.Services.CmsClass; + +using System.Text.RegularExpressions; +using CMS.DataEngine; +using CMS.OnlineForms; +using Migration.Toolkit.Common.Enumerations; +using Migration.Toolkit.KXP.Api.Auxiliary; +using FcText = Common.Enumerations.Kx13FormControls.UserControlForText; +using FcLongText = Common.Enumerations.Kx13FormControls.UserControlForLongText; + +public record FormComponentReplacement(string OldFormComponent, string NewFormComponent); + +public record DataTypeMigrationModel( + FieldMigration[] FieldMigrations, + FormComponentReplacement[] NotSupportedInKxpLegacyMode, + [property: Obsolete("Legacy mode is no longer supported")] + string[] SupportedInKxpLegacyMode +); +public record FieldMigration(string SourceDataType, string TargetDataType, string SourceFormControl, string? TargetFormComponent, string[]? Actions = null, Regex? FieldNameRegex = null); + +/// +/// Tca = target control action +/// +public static partial class TcaDirective +{ + public const string ClearSettings = "clear settings"; + public const string ClearMacroTable = "clear hashtable"; + public const string ConvertToAsset = "convert to asset"; + public const string ConvertToPages = "convert to pages"; +} + +/// +/// Tfc = Target form component +/// +public static class TfcDirective +{ + public const string CopySourceControl = "#copy-source-control#"; + public const string DoNothing = "#nothing#"; + public const string Clear = "#clear#"; +} + +/// +/// Sfc = source form control +/// +public static class SfcDirective +{ + public const string CatchAnyNonMatching = "#any#"; +} + +public static class FieldMappingInstance +{ + public static FieldMigration[] BuiltInFieldMigrations => + [ + new(KsFieldDataType.ALL, FieldDataType.ALL, SfcDirective.CatchAnyNonMatching, null, [TfcDirective.Clear]), + new(KsFieldDataType.Unknown, FieldDataType.Unknown, SfcDirective.CatchAnyNonMatching, null, [TfcDirective.Clear]), + new(KsFieldDataType.Text, FieldDataType.Text, FcText.TextBoxControl, FormComponents.AdminTextInputComponent), + new(KsFieldDataType.Text, FieldDataType.Text, FcText.DropDownListControl, FormComponents.AdminDropDownComponent), + new(KsFieldDataType.Text, FieldDataType.Text, FcText.IconSelector, FormComponents.AdminIconSelectorComponent), + new(KsFieldDataType.Text, FieldDataType.Text, FcText.Password, FormComponents.AdminPasswordComponent), + new(KsFieldDataType.Text, FieldDataType.Text, FcText.RadioButtonsControl, FormComponents.AdminRadioGroupComponent), + new(KsFieldDataType.Text, FieldDataType.Text, FcText.TextAreaControl, FormComponents.AdminTextAreaComponent), + new(KsFieldDataType.Text, FieldDataType.Text, SfcDirective.CatchAnyNonMatching, FormComponents.AdminTextInputComponent), + new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.HtmlAreaControl, FormComponents.AdminRichTextEditorComponent), + new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.TextBoxControl, FormComponents.AdminTextInputComponent), + new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.DropDownListControl, FormComponents.AdminDropDownComponent), + new(KsFieldDataType.LongText, FieldDataType.LongText, FcLongText.TextAreaControl, FormComponents.AdminTextAreaComponent), + new(KsFieldDataType.LongText, FieldDataType.LongText, SfcDirective.CatchAnyNonMatching, FormComponents.AdminRichTextEditorComponent), + new(KsFieldDataType.Integer, FieldDataType.Integer, SfcDirective.CatchAnyNonMatching, FormComponents.AdminNumberInputComponent), + new(KsFieldDataType.LongInteger, FieldDataType.LongInteger, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear, [TfcDirective.Clear]),//FormComponents.AdminNumberInputComponent), + new(KsFieldDataType.Double, FieldDataType.Double, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear, [TfcDirective.Clear]),// FormComponents.AdminNumberInputComponent), + new(KsFieldDataType.Decimal, FieldDataType.Decimal, SfcDirective.CatchAnyNonMatching, FormComponents.AdminDecimalNumberInputComponent), + new(KsFieldDataType.DateTime, FieldDataType.DateTime, SfcDirective.CatchAnyNonMatching, FormComponents.AdminDateTimeInputComponent), + new(KsFieldDataType.Date, FieldDataType.Date, SfcDirective.CatchAnyNonMatching, FormComponents.AdminDateInputComponent), + new(KsFieldDataType.TimeSpan, FieldDataType.TimeSpan, SfcDirective.CatchAnyNonMatching, FormComponents.AdminTextInputComponent), + new(KsFieldDataType.Boolean, FieldDataType.Boolean, SfcDirective.CatchAnyNonMatching, FormComponents.AdminCheckBoxComponent), + new(KsFieldDataType.DocAttachments, FieldDataType.Assets, SfcDirective.CatchAnyNonMatching, FormComponents.AdminAssetSelectorComponent, [TcaDirective.ConvertToAsset]), + new(KsFieldDataType.File, FieldDataType.Assets, SfcDirective.CatchAnyNonMatching, FormComponents.AdminAssetSelectorComponent, [TcaDirective.ConvertToAsset]), + new(KsFieldDataType.Guid, FieldDataType.LongText, "RelatedDocuments", FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent, [TcaDirective.ConvertToPages]), + new(KsFieldDataType.Guid, FieldDataType.Guid, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear), + new(KsFieldDataType.Binary, FieldDataType.Binary, SfcDirective.CatchAnyNonMatching, TfcDirective.Clear), + new(KsFieldDataType.Xml, FieldDataType.Xml, SfcDirective.CatchAnyNonMatching, FormComponents.AdminNumberWithLabelComponent), + new(KsFieldDataType.DocRelationships, FieldDataType.WebPages, SfcDirective.CatchAnyNonMatching, FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent, [TcaDirective.ConvertToPages]), + + new(KsFieldDataType.TimeSpan, FieldDataType.TimeSpan, SfcDirective.CatchAnyNonMatching, FormComponents.AdminTextInputComponent, [TcaDirective.ConvertToPages]), + new(KsFieldDataType.BizFormFile, BizFormUploadFile.DATATYPE_FORMFILE, SfcDirective.CatchAnyNonMatching, FormComponents.MvcFileUploaderComponent, []), + ]; + + public static DataTypeMigrationModel BuiltInModel => new( + BuiltInFieldMigrations, + [ + new(Kx13FormComponents.Kentico_AttachmentSelector, FormComponents.AdminAssetSelectorComponent), + new(Kx13FormComponents.Kentico_PageSelector, FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent), + // new(Kx13FormComponents.Kentico_PathSelector, FormComponents.Kentico_Xperience_Admin_Websites_WebPageSelectorComponent) + ], + [] // legacy mode is no more + ); } \ No newline at end of file diff --git a/Migration.Toolkit.KXP.Extensions/LegacyAttachmentHandler.cs b/Migration.Toolkit.KXP.Extensions/LegacyAttachmentHandler.cs index 9ad97d50..165c7f6a 100644 --- a/Migration.Toolkit.KXP.Extensions/LegacyAttachmentHandler.cs +++ b/Migration.Toolkit.KXP.Extensions/LegacyAttachmentHandler.cs @@ -1,101 +1,101 @@ -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using CMS; -using CMS.Core; -using CMS.Base; -using CMS.Base.Routing; -using CMS.Helpers; -using CMS.MediaLibrary; -using CMS.Routing.Web; - -[assembly: RegisterImplementation(typeof(AttachmentsService), typeof(AttachmentsService), Lifestyle = Lifestyle.Transient, Priority = RegistrationPriority.SystemDefault)] -[assembly: RegisterModule(typeof(LegacyAttachmentHandler))] - -public class LegacyAttachmentHandler : CMS.DataEngine.Module -{ - public LegacyAttachmentHandler() - : base("LegacyAttachmentHandler.Handler") - { - } - - /// - /// Handles the module pre-initialization. - /// - protected override void OnPreInit() - { - base.OnPreInit(); - RegisterMediaFileHandler("getimage/{fileguid:guid}/{filename}", 4); - RegisterMediaFileHandler("getattachment/{fileguid:guid}/{filename}", 5); - RegisterMediaFileHandler("getattachment/{*pathandfilename}", 6, typeof(AttachmentsService)); - } - - private static void RegisterMediaFileHandler(string routeTemplate, int order, Type customHandlerType = null) - { - var registerMethod = HttpHandlerRouteTable.Default.GetType().GetMethod("Register", BindingFlags.NonPublic | BindingFlags.Instance); - var handlerType = customHandlerType ?? typeof(MediaFileInfo).Assembly.GetType("CMS.MediaLibrary.GetMediaService"); - - registerMethod.Invoke(HttpHandlerRouteTable.Default, new object[] - { - new RegisterHttpHandlerAttribute(routeTemplate, handlerType) - { - Order = order - } - }); - } -} - -public class AttachmentsService : ActionResultServiceBase -{ - private const string LegacyOriginalPath = "__LegacyOriginalPath"; - - protected override RequestStatusEnum RequestStatusEnum => RequestStatusEnum.GetFileHandler; - - protected override CMSActionResult GetActionResultInternal() - { - var pathAndFileName = QueryHelper.GetString("pathandfilename", null); - if (pathAndFileName != null) - { - pathAndFileName = pathAndFileName.TrimEnd('/'); - var dir = System.IO.Path.GetDirectoryName(pathAndFileName)?.Replace("\\", "/"); - var fileName = System.IO.Path.GetFileNameWithoutExtension(pathAndFileName); - - var mediaFiles = MediaFileInfoProvider.ProviderObject.Get() - .Columns( - nameof(MediaFileInfo.FileID), nameof(MediaFileInfo.FilePath), nameof(MediaFileInfo.FileCustomData), - nameof(MediaFileInfo.FileLibraryID), nameof(MediaFileInfo.FileName), nameof(MediaFileInfo.FileMimeType) - ) - .WhereEquals(nameof(MediaFileInfo.FileName), fileName) - .WhereStartsWith(nameof(MediaFileInfo.FilePath), $"{dir}") - .ToArray(); - - MediaFileInfo mediaFile; - if (mediaFiles.Length > 1) - { - var narrowedByOriginalPath = mediaFiles - .Where(mf => mf.FileCustomData.GetValue(LegacyOriginalPath)?.ToString() - ?.Equals($"/{dir}", StringComparison.InvariantCultureIgnoreCase) == true) - .ToArray(); - - mediaFile = narrowedByOriginalPath.Length > 1 - ? null - : narrowedByOriginalPath.FirstOrDefault(); - } - else - { - mediaFile = mediaFiles.FirstOrDefault(); - } - - var mediaPath = MediaFileInfoProvider.GetMediaFilePath(mediaFile.FilePath, mediaFile.FileLibraryID, SystemContext.WebApplicationPhysicalPath); - var result = new CMSPhysicalFileResult(mediaPath) - { - ContentType = mediaFile.FileMimeType, - ContentDisposition = HTTPHelper.GetFileDisposition(mediaPath, System.IO.Path.GetExtension(mediaPath)) - }; - return result; - } - - return new CMSNotFoundResult(); - } +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using CMS; +using CMS.Core; +using CMS.Base; +using CMS.Base.Routing; +using CMS.Helpers; +using CMS.MediaLibrary; +using CMS.Routing.Web; + +[assembly: RegisterImplementation(typeof(AttachmentsService), typeof(AttachmentsService), Lifestyle = Lifestyle.Transient, Priority = RegistrationPriority.SystemDefault)] +[assembly: RegisterModule(typeof(LegacyAttachmentHandler))] + +public class LegacyAttachmentHandler : CMS.DataEngine.Module +{ + public LegacyAttachmentHandler() + : base("LegacyAttachmentHandler.Handler") + { + } + + /// + /// Handles the module pre-initialization. + /// + protected override void OnPreInit() + { + base.OnPreInit(); + RegisterMediaFileHandler("getimage/{fileguid:guid}/{filename}", 4); + RegisterMediaFileHandler("getattachment/{fileguid:guid}/{filename}", 5); + RegisterMediaFileHandler("getattachment/{*pathandfilename}", 6, typeof(AttachmentsService)); + } + + private static void RegisterMediaFileHandler(string routeTemplate, int order, Type customHandlerType = null) + { + var registerMethod = HttpHandlerRouteTable.Default.GetType().GetMethod("Register", BindingFlags.NonPublic | BindingFlags.Instance); + var handlerType = customHandlerType ?? typeof(MediaFileInfo).Assembly.GetType("CMS.MediaLibrary.GetMediaService"); + + registerMethod.Invoke(HttpHandlerRouteTable.Default, new object[] + { + new RegisterHttpHandlerAttribute(routeTemplate, handlerType) + { + Order = order + } + }); + } +} + +public class AttachmentsService : ActionResultServiceBase +{ + private const string LEGACY_ORIGINAL_PATH = "__LegacyOriginalPath"; + + protected override RequestStatusEnum RequestStatusEnum => RequestStatusEnum.GetFileHandler; + + protected override CMSActionResult GetActionResultInternal() + { + var pathAndFileName = QueryHelper.GetString("pathandfilename", null); + if (pathAndFileName != null) + { + pathAndFileName = pathAndFileName.TrimEnd('/'); + var dir = System.IO.Path.GetDirectoryName(pathAndFileName)?.Replace("\\", "/"); + var fileName = System.IO.Path.GetFileNameWithoutExtension(pathAndFileName); + + var mediaFiles = MediaFileInfoProvider.ProviderObject.Get() + .Columns( + nameof(MediaFileInfo.FileID), nameof(MediaFileInfo.FilePath), nameof(MediaFileInfo.FileCustomData), + nameof(MediaFileInfo.FileLibraryID), nameof(MediaFileInfo.FileName), nameof(MediaFileInfo.FileMimeType) + ) + .WhereEquals(nameof(MediaFileInfo.FileName), fileName) + .WhereStartsWith(nameof(MediaFileInfo.FilePath), $"{dir}") + .ToArray(); + + MediaFileInfo mediaFile; + if (mediaFiles.Length > 1) + { + var narrowedByOriginalPath = mediaFiles + .Where(mf => mf.FileCustomData.GetValue(LEGACY_ORIGINAL_PATH)?.ToString() + ?.Equals($"/{dir}", StringComparison.InvariantCultureIgnoreCase) == true) + .ToArray(); + + mediaFile = narrowedByOriginalPath.Length > 1 + ? null + : narrowedByOriginalPath.FirstOrDefault(); + } + else + { + mediaFile = mediaFiles.FirstOrDefault(); + } + + var mediaPath = MediaFileInfoProvider.GetMediaFilePath(mediaFile.FilePath, mediaFile.FileLibraryID, SystemContext.WebApplicationPhysicalPath); + var result = new CMSPhysicalFileResult(mediaPath) + { + ContentType = mediaFile.FileMimeType, + ContentDisposition = HTTPHelper.GetFileDisposition(mediaPath, System.IO.Path.GetExtension(mediaPath)) + }; + return result; + } + + return new CMSNotFoundResult(); + } } \ No newline at end of file diff --git a/Migration.Toolkit.KXP/DependencyInjectionExtensions.cs b/Migration.Toolkit.KXP/DependencyInjectionExtensions.cs index 1d36905e..843afc84 100644 --- a/Migration.Toolkit.KXP/DependencyInjectionExtensions.cs +++ b/Migration.Toolkit.KXP/DependencyInjectionExtensions.cs @@ -1,20 +1,20 @@ -namespace Migration.Toolkit.KXP; - -using System.Diagnostics; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Migration.Toolkit.Common; -using Migration.Toolkit.KXP.Context; - -public static class DependencyInjectionExtensions -{ - public static IServiceCollection UseKxpDbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) - { - services.AddDbContextFactory(options => - { - Debug.Assert(toolkitConfiguration.XbKConnectionString != null, "toolkitConfiguration.XbKConnectionString != null"); - options.UseSqlServer(toolkitConfiguration.XbKConnectionString); - }); - return services; - } +namespace Migration.Toolkit.KXP; + +using System.Diagnostics; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Migration.Toolkit.Common; +using Migration.Toolkit.KXP.Context; + +public static class DependencyInjectionExtensions +{ + public static IServiceCollection UseKxpDbContext(this IServiceCollection services, ToolkitConfiguration toolkitConfiguration) + { + services.AddDbContextFactory(options => + { + Debug.Assert(toolkitConfiguration.XbKConnectionString != null, "toolkitConfiguration.XbKConnectionString != null"); + options.UseSqlServer(toolkitConfiguration.XbKConnectionString); + }); + return services; + } } \ No newline at end of file diff --git a/Migration.Toolkit.Tests/MediaHelperTest.cs b/Migration.Toolkit.Tests/MediaHelperTest.cs index 223a3197..6fa20c38 100644 --- a/Migration.Toolkit.Tests/MediaHelperTest.cs +++ b/Migration.Toolkit.Tests/MediaHelperTest.cs @@ -42,12 +42,12 @@ public class UnitTest1 */ // to successfully implement next 2 instances, context will be needed - SiteName, Custom library path setting value // ~/[SITENAME] /media/[LibraryName] /[LibDir]/[LibDir] /[MediaFileName].[ext]?[query] - [InlineData("~/mysitename/media/mylibraryname/sub-dir/sub-sub-dir/somefile.png?ext=.png", "/mysitename/media/mylibraryname/sub-dir/sub-sub-dir/somefile.png", null, true, MediaKind.MediaFile, MediaLinkKind.DirectMediaPath)] + // [InlineData("~/mysitename/media/mylibraryname/sub-dir/sub-sub-dir/somefile.png?ext=.png", "/mysitename/media/mylibraryname/sub-dir/sub-sub-dir/somefile.png", null, true, MediaKind.MediaFile, MediaLinkKind.DirectMediaPath)] // ~/[CustomDir]/media/[LibraryName] /[LibDir]/[LibDir] /[MediaFileName].[ext]?[query] - [InlineData("~/custom_library_global_dir/mysite/sub-dir/sub-sub-dir/somefile.png?ext=.png", "/custom_library_global_dir/mysite/sub-dir/sub-sub-dir/somefile.png", null, true, MediaKind.MediaFile, MediaLinkKind.DirectMediaPath)] + // [InlineData("~/custom_library_global_dir/mysite/sub-dir/sub-sub-dir/somefile.png?ext=.png", "/custom_library_global_dir/mysite/sub-dir/sub-sub-dir/somefile.png", null, true, MediaKind.MediaFile, MediaLinkKind.DirectMediaPath)] // direct media path is not supported for absolute physical paths eg. C:\MyLibraries // direct media path is not supported for absolute network share paths eg. \\myserver\MyLibraries - public void ParseMediaLink(string? mediaUri, string? expectedPath, string? expectedGuid, bool expectSuccess, MediaKind expectedMediaKind, MediaLinkKind expectedMediaLinkKind) + public void ParseMediaLink(string mediaUri, string? expectedPath, string? expectedGuid, bool expectSuccess, MediaKind expectedMediaKind, MediaLinkKind expectedMediaLinkKind) { Guid? expectedMediaId = Guid.TryParse(expectedGuid ?? "", out var eg) ? eg : null; diff --git a/README.md b/README.md index bf18046d..1709a844 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,11 @@ # Xperience by Kentico: Kentico Migration Tool -The Migration tool transfers content and other data from **Kentico Xperience 13**, **Kentico 12** or **Kentico 11** to **Xperience by Kentico**. +[![CI: Build and Test](https://github.com/Kentico/xperience-by-kentico-kentico-migration-tool/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/Kentico/xperience-by-kentico-kentico-migration-tool/actions/workflows/build.yml) + +## Description + +The Kentico Migration Tool transfers content and other data from **Kentico Xperience 13**, **Kentico 12** or **Kentico 11** to **Xperience by Kentico**. ## Prerequisites & Compatibility @@ -20,14 +24,14 @@ The migration currently supports the Kentico Xperience 13, Kentico 12 or Kentico * The source of the migration data must be a Kentico Xperience 13 instance, with **Refresh 5** ([hotfix](https://devnet.kentico.com/download/hotfixes) 13.0.64) or newer applied. * The development model (Core or MVC 5) does not affect the migration - both are supported. -* The source instance's database and file system must be accessible from the environment where you run the Migration toolkit. +* The source instance's database and file system must be accessible from the environment where you run the Kentico Migration Tool. * All features described in this repository are available for migration from Kentico Xperience 13. #### Kentico 12 * The source of the migration data can be any hotfix version of the Kentico 12. -* Only MVC development model is supported by the migration tool. Any Portal Engine project that you wish to migrate to Xperience by Kentico needs to be [migrated to MVC](https://www.youtube.com/watch?v=g2oeHU0h1e0) first. -* The source instance's database and file system must be accessible from the environment where you run the Migration toolkit. +* Only MVC development model is supported by this tool. Any Portal Engine project that you wish to migrate to Xperience by Kentico needs to be [migrated to MVC](https://www.youtube.com/watch?v=g2oeHU0h1e0) first. +* The source instance's database and file system must be accessible from the environment where you run the this tool. * Migration of Page Builder content is not supported. Only structured data of pages is migrated. * As a result, [source instance API discovery](/Migration.Toolkit.CLI/README.md#source-instance-api-discovery) is also not available. * This repository describes the migration of Kentico Xperience 13 feature set. Only features relevant to Kentico 12 are migrated for this version. @@ -35,33 +39,33 @@ The migration currently supports the Kentico Xperience 13, Kentico 12 or Kentico #### Kentico 11 * The source of the migration data can be any hotfix version of the Kentico 11. If you encounter any issues, it is recommended to update to the latest hotfix. -* Only MVC development model is supported by the migration tool. Any Portal Engine project that you wish to migrate to Xperience by Kentico needs to be [migrated to MVC](https://www.youtube.com/watch?v=g2oeHU0h1e0) first. -* The source instance's database and file system must be accessible from the environment where you run the Migration toolkit. +* Only MVC development model is supported by this tool. Any Portal Engine project that you wish to migrate to Xperience by Kentico needs to be [migrated to MVC](https://www.youtube.com/watch?v=g2oeHU0h1e0) first. +* The source instance's database and file system must be accessible from the environment where you run this tool. * Only structured data of pages is migrated as Page Builder is not present in Kentico 11. * As a result, [source instance API discovery](/Migration.Toolkit.CLI/README.md#source-instance-api-discovery) is also not available. * This repository describes the migration of Kentico Xperience 13 feature set. Only features relevant to Kentico 11 are migrated for this version. ### Target -* The migration toolkit is periodically updated to support migration to the **latest version** of Xperience by Kentico. However, there may be delays between Xperience by Kentico releases and toolkit updates. +* The Kentico Migration Tool is periodically updated to support migration to the **latest version** of Xperience by Kentico. However, there may be delays between Xperience by Kentico releases and tool updates. * Currently, Xperience by Kentico **29.1.0** is tested and supported. -* The target instance's database and file system must be accessible from the environment where you run the Migration toolkit. -* The target instance's database must be empty except for data from the source instance created by previous runs of the Migration toolkit to avoid conflicts and inconsistencies. +* The target instance's database and file system must be accessible from the environment where you run this tool. +* The target instance's database must be empty except for data from the source instance created by previous runs of this tool to avoid conflicts and inconsistencies. ## Supported data and limitations -The Migration toolkit does not transfer all data available in the source instance. Xperience by Kentico currently provides a smaller, more focused set of features. As a result, some objects are discarded or migrated to a suitable alternative. +The Kentico Migration Tool does not transfer all data available in the source instance. Xperience by Kentico currently provides a smaller, more focused set of features. As a result, some objects are discarded or migrated to a suitable alternative. -The Migration toolkit only supports content and objects **stored in the database** and related binary data on the file system, such as media library files. Code, customizations, and any other types of content need to be migrated manually to the target project and adjusted for Xperience by Kentico. +This tool only supports content and objects **stored in the database** and related binary data on the file system, such as media library files. Code, customizations, and any other types of content need to be migrated manually to the target project and adjusted for Xperience by Kentico. -Currently, the Migration toolkit supports the following types of data: +Currently, the Kentico Migration Tool supports the following types of data: * **Sites** - * The toolkit migrates each site on the source to a [website channel](https://docs.kentico.com/x/34HFC) object in Xperience by Kentico. + * The tool migrates each site on the source to a [website channel](https://docs.kentico.com/x/34HFC) object in Xperience by Kentico. * **Cultures** * The set of cultures used across all sites in the source gets mapped to a [language](https://docs.kentico.com/x/OxT_Cw) in the _Languages_ application. * **Content types** (_Page types_ in earlier Kentico versions) - * The Migration toolkit attempts to map the _Data type_ and _Form control_ of page type fields to an appropriate equivalent in Xperience by Kentico. This mapping is not always possible and does not work for custom data types or form controls. We recommend checking your content type fields after the migration and adjusting them if necessary. + * The Kentico Migration Tool attempts to map the _Data type_ and _Form control_ of page type fields to an appropriate equivalent in Xperience by Kentico. This mapping is not always possible and does not work for custom data types or form controls. We recommend checking your content type fields after the migration and adjusting them if necessary. * The migration includes only page types assigned to at least one site on the source instance. * Xperience by Kentico currently does not support: * Macro expressions in page type field default values or other settings. Content type fields containing macros will not work correctly after the migration. @@ -113,7 +117,7 @@ Currently, the Migration toolkit supports the following types of data: * Alternative forms under classes and UI-related configuration of class fields (field labels, Form controls, etc.). After the migration, you must manually create the appropriate [UI forms](https://docs.kentico.com/x/V6rWCQ) in Xperience by Kentico. * Custom settings under modules, which are currently not supported in Xperience by Kentico * Module permissions (permissions work differently in Xperience by Kentico - see [Role management](https://docs.kentico.com/x/7IVwCg) and [UI page permission checks](https://docs.kentico.com/x/8IKyCg)) - * As with all object types, the migration toolkit does not transfer code files to the target project. You must manually move all code files generated for your custom classes (_Info_, _InfoProvider_, etc.). + * As with all object types, the Kentico Migration Tool does not transfer code files to the target project. You must manually move all code files generated for your custom classes (_Info_, _InfoProvider_, etc.). * **Custom tables** * Custom tables are not supported in Xperience by Kentico. Data from custom tables is migrated to the target instance as custom modules. * The migration only transfers data from custom tables to the custom module (_CMS\_Resource_) database table. @@ -126,12 +130,12 @@ Currently, the Migration toolkit supports the following types of data: ### Unsupported data -The following types of data exist in Xperience by Kentico but are currently **not supported** by the Migration toolkit: +The following types of data exist in Xperience by Kentico but are currently **not supported** by the Kentico Migration Tool: * **Contact groups** * Static contact groups are currently not supported in Xperience by Kentico. * The condition format for dynamic contact groups is not compatible. To migrate contact groups: - 1. Migrate your contacts using the toolkit. + 1. Migrate your contacts using the tool. 2. Create the [contact groups](https://docs.kentico.com/x/o4PWCQ) manually in Xperience by Kentico. 3. Build equivalent conditions. 4. Recalculate the contact groups. @@ -143,7 +147,7 @@ The following types of data exist in Xperience by Kentico but are currently **no ## Get started -Follow the steps below to run the Migration toolkit: +Follow the steps below to run the Kentico Migration Tool: 1. Clone or download the Migration.Toolkit source code from this repository. 2. Open the `Migration.Toolkit.sln` solution in Visual Studio. @@ -187,6 +191,10 @@ Please provide all available information about the problem or error when submitt Distributed under the MIT License. See [`LICENSE.md`](./LICENSE.md) for more information. -## Questions & Support +## Support + +This contribution has **Full support by 7-day bug-fix policy**. + +See [`SUPPORT.md`](https://github.com/Kentico/.github/blob/main/SUPPORT.md#full-support) for more information. -See the [Kentico home repository](https://github.com/Kentico/Home/blob/master/README.md) for more information about the products and general advice on submitting questions. +For any security issues see [`SECURITY.md`](https://github.com/Kentico/.github/blob/main/SECURITY.md). \ No newline at end of file diff --git a/global.json b/global.json index b5b37b60..0a0c1515 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ -{ - "sdk": { - "version": "8.0.0", - "rollForward": "latestMajor", - "allowPrerelease": false - } +{ + "sdk": { + "version": "8.0.100", + "rollForward": "latestMajor", + "allowPrerelease": false + } } \ No newline at end of file